mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-06-04 11:14:21 +08:00
If a group node is outside build area, all it's children are also marked as such
CURA-403
This commit is contained in:
parent
6db03538a1
commit
75c1f12d33
@ -48,6 +48,8 @@ class PlatformPhysics:
|
|||||||
# same direction.
|
# same direction.
|
||||||
transformed_nodes = []
|
transformed_nodes = []
|
||||||
|
|
||||||
|
group_nodes = []
|
||||||
|
|
||||||
for node in BreadthFirstIterator(root):
|
for node in BreadthFirstIterator(root):
|
||||||
if node is root or type(node) is not SceneNode or node.getBoundingBox() is None:
|
if node is root or type(node) is not SceneNode or node.getBoundingBox() is None:
|
||||||
continue
|
continue
|
||||||
@ -69,6 +71,9 @@ class PlatformPhysics:
|
|||||||
if build_volume_bounding_box.intersectsBox(bbox) != AxisAlignedBox.IntersectionResult.FullIntersection:
|
if build_volume_bounding_box.intersectsBox(bbox) != AxisAlignedBox.IntersectionResult.FullIntersection:
|
||||||
node._outside_buildarea = True
|
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 it downwards if bottom is above platform
|
||||||
move_vector = Vector()
|
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
|
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)
|
overlap = convex_hull.intersectsPolygon(area)
|
||||||
if overlap is None:
|
if overlap is None:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
node._outside_buildarea = True
|
node._outside_buildarea = True
|
||||||
|
|
||||||
if not Vector.Null.equals(move_vector, epsilon=1e-5):
|
if not Vector.Null.equals(move_vector, epsilon=1e-5):
|
||||||
@ -152,6 +156,12 @@ class PlatformPhysics:
|
|||||||
op = PlatformPhysicsOperation.PlatformPhysicsOperation(node, move_vector)
|
op = PlatformPhysicsOperation.PlatformPhysicsOperation(node, move_vector)
|
||||||
op.push()
|
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):
|
def _onToolOperationStarted(self, tool):
|
||||||
self._enabled = False
|
self._enabled = False
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user