diff options
author | ChrisTerBeke <c.terbeke@ultimaker.com> | 2017-09-18 11:50:52 +0300 |
---|---|---|
committer | ChrisTerBeke <c.terbeke@ultimaker.com> | 2017-09-18 11:50:52 +0300 |
commit | 4ca5987ca8fbf89cdf938c82dc6ff65e9ebc2942 (patch) | |
tree | f7c9cfcc97e7ba17ab9a30b056a359f8d33f3b27 /cura/PlatformPhysics.py | |
parent | 86e5a1ed974b3e18dffd7fb5745d7afe96021705 (diff) |
CURA-4269 added a flag to determine wether auto drop should be executed or not
Diffstat (limited to 'cura/PlatformPhysics.py')
-rwxr-xr-x | cura/PlatformPhysics.py | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/cura/PlatformPhysics.py b/cura/PlatformPhysics.py index dc5594dc7b..3db681eb06 100755 --- a/cura/PlatformPhysics.py +++ b/cura/PlatformPhysics.py @@ -9,6 +9,7 @@ from UM.Scene.Iterator.BreadthFirstIterator import BreadthFirstIterator from UM.Math.Vector import Vector from UM.Scene.Selection import Selection from UM.Preferences import Preferences +from UM.Logger import Logger from cura.ConvexHullDecorator import ConvexHullDecorator @@ -41,10 +42,12 @@ class PlatformPhysics: def _onSceneChanged(self, source): self._change_timer.start() - def _onChangeTimerFinished(self): + def _onChangeTimerFinished(self, was_triggered_by_tool=False): if not self._enabled: return + Logger.log("d", "was_triggered_by_tool=%s", was_triggered_by_tool) + root = self._controller.getScene().getRoot() # Keep a list of nodes that are moving. We use this so that we don't move two intersecting objects in the @@ -71,14 +74,15 @@ class PlatformPhysics: # Check if this is the first time a project file node was loaded (disable auto drop in that case), defaults to True should_auto_drop = node.getSetting("auto_drop", True) + # This should NOT happen if the scene change was triggered by a tool (like translate), only on project load + if was_triggered_by_tool: + should_auto_drop = True + # If a node is grouped or it's loaded from a project file (auto-drop disabled), don't move it down if Preferences.getInstance().getValue("physics/automatic_drop_down") and not (node.getParent() and node.getParent().callDecoration("isGroup")) and node.isEnabled() and should_auto_drop: z_offset = node.callDecoration("getZOffset") if node.getDecorator(ZOffsetDecorator.ZOffsetDecorator) else 0 move_vector = move_vector.set(y=-bbox.bottom + z_offset) - # Enable auto-drop after processing the project file node for the first time - node.setSetting("auto_drop", False) - # If there is no convex hull for the node, start calculating it and continue. if not node.getDecorator(ConvexHullDecorator): node.addDecorator(ConvexHullDecorator()) @@ -167,4 +171,4 @@ class PlatformPhysics: node.removeDecorator(ZOffsetDecorator.ZOffsetDecorator) self._enabled = True - self._onChangeTimerFinished() + self._onChangeTimerFinished(True) |