diff options
author | ChrisTerBeke <c.terbeke@ultimaker.com> | 2017-09-14 17:06:51 +0300 |
---|---|---|
committer | ChrisTerBeke <c.terbeke@ultimaker.com> | 2017-09-14 17:06:51 +0300 |
commit | 11ebdf730389eca66bafc37be7c6a741c5641f46 (patch) | |
tree | 1162230537dedd16f967dd51b01caac7b1d5c04f /cura/PlatformPhysics.py | |
parent | a37c2a5d741533bb4a5587ed93d7caa116624c32 (diff) |
CURA-4269 disable auto-drop for first time loaded models from project files
Diffstat (limited to 'cura/PlatformPhysics.py')
-rwxr-xr-x | cura/PlatformPhysics.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/cura/PlatformPhysics.py b/cura/PlatformPhysics.py index b00c5a632c..464e9682a6 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 @@ -67,10 +68,18 @@ class PlatformPhysics: # 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 + + # 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) + + # 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()) |