If a group node is outside build area, all it's children are also marked as such

CURA-403
This commit is contained in:
Jaime van Kessel 2016-09-06 11:42:46 +02:00
parent 6db03538a1
commit 75c1f12d33

View File

@ -48,6 +48,8 @@ class PlatformPhysics:
# same direction.
transformed_nodes = []
group_nodes = []
for node in BreadthFirstIterator(root):
if node is root or type(node) is not SceneNode or node.getBoundingBox() is None:
continue
@ -69,6 +71,9 @@ class PlatformPhysics:
if build_volume_bounding_box.intersectsBox(bbox) != AxisAlignedBox.IntersectionResult.FullIntersection:
node._outside_buildarea = True
if node.callDecoration("isGroup"):
group_nodes.append(node) # Keep list of affected group_nodes
# Move it downwards if bottom is above platform
move_vector = Vector()
if Preferences.getInstance().getValue("physics/automatic_drop_down") and not (node.getParent() and node.getParent().callDecoration("isGroup")): #If an object is grouped, don't move it down
@ -144,7 +149,6 @@ class PlatformPhysics:
overlap = convex_hull.intersectsPolygon(area)
if overlap is None:
continue
node._outside_buildarea = True
if not Vector.Null.equals(move_vector, epsilon=1e-5):
@ -152,6 +156,12 @@ class PlatformPhysics:
op = PlatformPhysicsOperation.PlatformPhysicsOperation(node, move_vector)
op.push()
# Group nodes should override the _outside_buildarea property of their children.
for group_node in group_nodes:
for child_node in group_node.getAllChildren():
child_node._outside_buildarea = group_node._outside_buildarea
def _onToolOperationStarted(self, tool):
self._enabled = False