mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-06 22:47:29 -06:00
Adding the preference drop to buildplate while opening Cura project
CURA-10542
This commit is contained in:
parent
e8bdca3dd9
commit
91a84674f0
3 changed files with 16 additions and 79 deletions
|
@ -38,7 +38,7 @@ class PlatformPhysics:
|
||||||
self._minimum_gap = 2 # It is a minimum distance (in mm) between two models, applicable for small models
|
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_push_free", False)
|
||||||
Application.getInstance().getPreferences().addPreference("physics/automatic_drop_down_per_model", "never")
|
Application.getInstance().getPreferences().addPreference("physics/automatic_drop_down", False)
|
||||||
|
|
||||||
def _onSceneChanged(self, source):
|
def _onSceneChanged(self, source):
|
||||||
if not source.callDecoration("isSliceable"):
|
if not source.callDecoration("isSliceable"):
|
||||||
|
@ -71,14 +71,6 @@ class PlatformPhysics:
|
||||||
# We try to shuffle all the nodes to prevent "locked" situations, where iteration B inverts iteration A.
|
# 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.
|
# By shuffling the order of the nodes, this might happen a few times, but at some point it will resolve.
|
||||||
random.shuffle(nodes)
|
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:
|
for node in nodes:
|
||||||
if node is root or not isinstance(node, SceneNode) or node.getBoundingBox() is None:
|
if node is root or not isinstance(node, SceneNode) or node.getBoundingBox() is None:
|
||||||
|
@ -88,9 +80,7 @@ class PlatformPhysics:
|
||||||
|
|
||||||
# Move it downwards if bottom is above platform
|
# Move it downwards if bottom is above platform
|
||||||
move_vector = Vector()
|
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
|
z_offset = node.callDecoration("getZOffset") if node.getDecorator(ZOffsetDecorator.ZOffsetDecorator) else 0
|
||||||
move_vector = move_vector.set(y = -bbox.bottom + z_offset)
|
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 there is no convex hull for the node, start calculating it and continue.
|
||||||
|
|
|
@ -299,6 +299,20 @@ UM.Dialog
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Row
|
||||||
|
{
|
||||||
|
id: dropToBuildPlate
|
||||||
|
width: parent.width
|
||||||
|
height: childrenRect.height
|
||||||
|
spacing: UM.Theme.getSize("default_margin").width
|
||||||
|
UM.CheckBox
|
||||||
|
{
|
||||||
|
id: rememberChoiceCheckBox
|
||||||
|
text: catalog.i18nc("@text:window", "Drop models to buildplate")
|
||||||
|
checked: UM.Preferences.getValue("physics/automatic_drop_down") == True
|
||||||
|
onCheckedChanged: UM.Preferences.setValue("physics/automatic_drop_down", checked)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Row
|
Row
|
||||||
{
|
{
|
||||||
|
|
|
@ -63,18 +63,6 @@ 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()
|
function reset()
|
||||||
{
|
{
|
||||||
UM.Preferences.resetPreference("general/language")
|
UM.Preferences.resetPreference("general/language")
|
||||||
|
@ -525,61 +513,6 @@ 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
|
UM.TooltipArea
|
||||||
{
|
{
|
||||||
width: childrenRect.width;
|
width: childrenRect.width;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue