FIX: fix two tree support bugs

1. hybrid(auto) on_buildplate_only option not working correctly because
parent is not set.
2. tree(auto) on_buildplate_only not working correctly because unsupported
branch isn't deleted completely. I add child to track the dangling nodes
and then delete nodes with no child.

Change-Id: I24c69a7cf400d2961b22a720a6069cf95db6c1a5
(cherry picked from commit bce77c16128d35c668b175e7135b9fe9acd71d13)
This commit is contained in:
Arthur 2022-09-30 16:30:10 +08:00 committed by Lane.Wei
parent c37f489f35
commit c9e8ef3f93
3 changed files with 33 additions and 15 deletions

View file

@ -222,7 +222,7 @@ public:
, height(0.0)
{}
Node(const Point position, const size_t distance_to_top, const bool skin_direction, const int support_roof_layers_below, const bool to_buildplate, Node* const parent,
Node(const Point position, const size_t distance_to_top, const bool skin_direction, const int support_roof_layers_below, const bool to_buildplate, Node* parent,
coordf_t print_z_, coordf_t height_)
: distance_to_top(distance_to_top)
, position(position)
@ -233,7 +233,13 @@ public:
, parent(parent)
, print_z(print_z_)
, height(height_)
{}
{
if (parent) {
type = parent->type;
overhang = parent->overhang;
parent->child = this;
}
}
#ifdef DEBUG // Clear the delete node's data so if there's invalid access after, we may get a clue by inspecting that node.
~Node()
@ -294,6 +300,7 @@ public:
* the entire branch needs to be known.
*/
Node *parent;
Node *child = nullptr;
/*!
* \brief All neighbours (on the same layer) that where merged into this node.