diff options
author | Jack Ha <j.ha@ultimaker.com> | 2017-03-30 17:26:39 +0300 |
---|---|---|
committer | Jack Ha <j.ha@ultimaker.com> | 2017-03-30 17:26:39 +0300 |
commit | 1164805a68c6d08524983bfe2be767e1176c1f5f (patch) | |
tree | 4bb2e16b835ce5614c1020c019d2beb5a8550994 /cura/PlatformPhysics.py | |
parent | 3135dc7d77add478c3ed1d62d40948ac6435ca5b (diff) |
WIP Solved stash apply. CURA-3610
Diffstat (limited to 'cura/PlatformPhysics.py')
-rwxr-xr-x[-rw-r--r--] | cura/PlatformPhysics.py | 40 |
1 files changed, 4 insertions, 36 deletions
diff --git a/cura/PlatformPhysics.py b/cura/PlatformPhysics.py index 42ea26f153..9fcd2f9251 100644..100755 --- a/cura/PlatformPhysics.py +++ b/cura/PlatformPhysics.py @@ -3,10 +3,10 @@ from PyQt5.QtCore import QTimer +from UM.Application import Application from UM.Scene.SceneNode import SceneNode from UM.Scene.Iterator.BreadthFirstIterator import BreadthFirstIterator from UM.Math.Vector import Vector -from UM.Math.AxisAlignedBox import AxisAlignedBox from UM.Scene.Selection import Selection from UM.Preferences import Preferences @@ -51,7 +51,6 @@ class PlatformPhysics: # same direction. transformed_nodes = [] - group_nodes = [] # We try to shuffle all the nodes to prevent "locked" situations, where iteration B inverts iteration A. # By shuffling the order of the nodes, this might happen a few times, but at some point it will resolve. nodes = list(BreadthFirstIterator(root)) @@ -62,24 +61,6 @@ class PlatformPhysics: bbox = node.getBoundingBox() - # Ignore intersections with the bottom - build_volume_bounding_box = self._build_volume.getBoundingBox() - if build_volume_bounding_box: - # It's over 9000! - build_volume_bounding_box = build_volume_bounding_box.set(bottom=-9001) - else: - # No bounding box. This is triggered when running Cura from command line with a model for the first time - # In that situation there is a model, but no machine (and therefore no build volume. - return - node._outside_buildarea = False - - # Mark the node as outside the build volume if the bounding box test fails. - 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")) and node.isEnabled(): #If an object is grouped, don't move it down @@ -145,27 +126,14 @@ class PlatformPhysics: # Simply waiting for the next tick seems to resolve this correctly. overlap = None - convex_hull = node.callDecoration("getConvexHull") - if convex_hull: - if not convex_hull.isValid(): - return - # Check for collisions between disallowed areas and the object - for area in self._build_volume.getDisallowedAreas(): - overlap = convex_hull.intersectsPolygon(area) - if overlap is None: - continue - node._outside_buildarea = True - if not Vector.Null.equals(move_vector, epsilon=1e-5): transformed_nodes.append(node) 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 - + # After moving, we have to evaluate the boundary checks for nodes + build_volume = Application.getInstance().getBuildVolume() + build_volume.updateNodeBoundaryCheck() def _onToolOperationStarted(self, tool): self._enabled = False |