diff --git a/cura/PlatformPhysics.py b/cura/PlatformPhysics.py index 1ef39de80d..98e9e823c6 100755 --- a/cura/PlatformPhysics.py +++ b/cura/PlatformPhysics.py @@ -38,7 +38,7 @@ class PlatformPhysics: self._minimum_gap = 2 # It is a minimum distance (in mm) between two models, applicable for small models Application.getInstance().getPreferences().addPreference("physics/automatic_push_free", False) - Application.getInstance().getPreferences().addPreference("physics/automatic_drop_down", True) + Application.getInstance().getPreferences().addPreference("physics/automatic_drop_down_per_model", "never") def _onSceneChanged(self, source): if not source.callDecoration("isSliceable"): @@ -71,6 +71,15 @@ class PlatformPhysics: # 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. random.shuffle(nodes) + default_value = False + if app_automatic_drop_down == "always": + default_value = True + if app_automatic_drop_down == "never": + default_value = False + if app_automatic_drop_down == "always_ask": + # ask_during_loading_model + pass + for node in nodes: if node is root or not isinstance(node, SceneNode) or node.getBoundingBox() is None: continue @@ -80,10 +89,10 @@ class PlatformPhysics: # Move it downwards if bottom is above platform move_vector = Vector() - if node.getSetting(SceneNodeSettings.AutoDropDown, app_automatic_drop_down) and not (node.getParent() and node.getParent().callDecoration("isGroup") or node.getParent() != root) and node.isEnabled(): #If an object is grouped, don't move it down + + if node.getSetting(SceneNodeSettings.AutoDropDown, default_value) and not (node.getParent() and node.getParent().callDecoration("isGroup") or node.getParent() != root) and node.isEnabled(): #If an object is grouped, don't move it down z_offset = node.callDecoration("getZOffset") if node.getDecorator(ZOffsetDecorator.ZOffsetDecorator) else 0 move_vector = move_vector.set(y = -bbox.bottom + z_offset) - # If there is no convex hull for the node, start calculating it and continue. if not node.getDecorator(ConvexHullDecorator) and not node.callDecoration("isNonPrintingMesh") and node.callDecoration("getLayerData") is None: node.addDecorator(ConvexHullDecorator()) diff --git a/resources/qml/Preferences/GeneralPage.qml b/resources/qml/Preferences/GeneralPage.qml index c313ffbd94..963f95da4b 100644 --- a/resources/qml/Preferences/GeneralPage.qml +++ b/resources/qml/Preferences/GeneralPage.qml @@ -63,6 +63,18 @@ UM.PreferencesPage } } + function setDefaultDropDown(code) + { + for (var i = 0; i < choiceOnDropDown.model.count; ++i) + { + if (choiceOnDropDown.model.get(i).code == code) + { + choiceOnDropDown.currentIndex = i + break; + } + } + } + function reset() { UM.Preferences.resetPreference("general/language") @@ -513,6 +525,60 @@ UM.PreferencesPage } } + UM.TooltipArea + { + width: childrenRect.width + height: childrenRect.height + text: catalog.i18nc("@info:tooltip", "This setting will set a default (or not) for the Per Model Drop to buildplate feature (Either Always, Never, decide every time") + + Column + { + spacing: UM.Theme.getSize("narrow_margin").height + + UM.Label + { + text: catalog.i18nc("@window:text", " Default per model setting for drop to build plate when importing a model: ") + } + + Cura.ComboBox + { + id: choiceOnDropDown + width: UM.Theme.getSize("combobox").width + height: UM.Theme.getSize("combobox").height + + model: ListModel + { + id: dropDownOptions + + Component.onCompleted: + { + append({ text: catalog.i18nc("@option:openProject", "Always"), code: "always" }) + append({ text: catalog.i18nc("@option:openProject", "Never"), code: "never" }) + append({ text: catalog.i18nc("@option:openProject", "Always ask me this"), code: "always_ask" }) + } + } + textRole: "text" + + currentIndex: + { + var index = 0; + var currentChoice = UM.Preferences.getValue("physics/automatic_drop_down_per_model"); + for (var i = 0; i < model.count; ++i) + { + if (model.get(i).code == currentChoice) + { + index = i; + break; + } + } + return index; + } + + onActivated: UM.Preferences.setValue("physics/automatic_drop_down_per_model", model.get(index).code) + } + } + } + UM.TooltipArea { diff --git a/resources/qml/Toolbar.qml b/resources/qml/Toolbar.qml index 1af4e958f4..81f6c5d682 100644 --- a/resources/qml/Toolbar.qml +++ b/resources/qml/Toolbar.qml @@ -222,7 +222,7 @@ Item UM.Label { id: toolHint - text: UM.Controller.properties.getValue("ToolHint") != undefined ? UM.ActiveTool.properties.getValue("ToolHint") : "" + text: UM.Controller.properties.getValue("ToolHint") != undefined ? UM.Controller.properties.getValue("ToolHint") : "" color: UM.Theme.getColor("tooltip_text") anchors.horizontalCenter: parent.horizontalCenter }