mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-07 06:57:28 -06:00
Fix PerObjectSettingsPanel.qml
CURA-4186 - The UI shouldn't be bound to the limit_to_extruder stack, it should always be bound to the per-object stack. - The ActiveTool.getValue() calls cannot be bound in QML, so use a Connections to update the values based on signals.
This commit is contained in:
parent
759d44dbef
commit
2ec7c14422
1 changed files with 12 additions and 26 deletions
|
@ -135,6 +135,8 @@ Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Specialty provider that only watches global_inherits (we cant filter on what property changed we get events
|
||||||
|
// so we bypass that to make a dedicated provider).
|
||||||
UM.SettingPropertyProvider
|
UM.SettingPropertyProvider
|
||||||
{
|
{
|
||||||
id: provider
|
id: provider
|
||||||
|
@ -146,8 +148,6 @@ Item {
|
||||||
removeUnusedValue: false
|
removeUnusedValue: false
|
||||||
}
|
}
|
||||||
|
|
||||||
// Specialty provider that only watches global_inherits (we cant filter on what property changed we get events
|
|
||||||
// so we bypass that to make a dedicated provider).
|
|
||||||
UM.SettingPropertyProvider
|
UM.SettingPropertyProvider
|
||||||
{
|
{
|
||||||
id: inheritStackProvider
|
id: inheritStackProvider
|
||||||
|
@ -156,36 +156,22 @@ Item {
|
||||||
watchedProperties: [ "limit_to_extruder" ]
|
watchedProperties: [ "limit_to_extruder" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
Binding
|
Connections
|
||||||
{
|
{
|
||||||
target: provider
|
target: UM.ActiveTool
|
||||||
property: "containerStackId"
|
onPropertiesChanged:
|
||||||
when: model.settable_per_extruder || (inheritStackProvider.properties.limit_to_extruder != null && inheritStackProvider.properties.limit_to_extruder >= 0);
|
|
||||||
value:
|
|
||||||
{
|
{
|
||||||
// associate this binding with Cura.MachineManager.activeMachineId in the beginning so this
|
// the values cannot be bound with UM.ActiveTool.properties.getValue() calls,
|
||||||
// binding will be triggered when activeMachineId is changed too.
|
// so here we connect to the signal and update the those values.
|
||||||
// Otherwise, if this value only depends on the extruderIds, it won't get updated when the
|
if (typeof UM.ActiveTool.properties.getValue("SelectedObjectId") !== "undefined")
|
||||||
// machine gets changed.
|
|
||||||
var activeMachineId = Cura.MachineManager.activeMachineId;
|
|
||||||
|
|
||||||
if(!model.settable_per_extruder || machineExtruderCount.properties.value == 1)
|
|
||||||
{
|
{
|
||||||
//Not settable per extruder or there only is global, so we must pick global.
|
addedSettingsModel.visibilityHandler.selectedObjectId = UM.ActiveTool.properties.getValue("SelectedObjectId");
|
||||||
return activeMachineId;
|
|
||||||
}
|
}
|
||||||
if(inheritStackProvider.properties.limit_to_extruder != null && inheritStackProvider.properties.limit_to_extruder >= 0)
|
if (typeof UM.ActiveTool.properties.getValue("ContainerID") !== "undefined")
|
||||||
{
|
{
|
||||||
//We have limit_to_extruder, so pick that stack.
|
provider.containerStackId = UM.ActiveTool.properties.getValue("ContainerID");
|
||||||
return ExtruderManager.extruderIds[String(inheritStackProvider.properties.limit_to_extruder)];
|
inheritStackProvider.containerStackId = UM.ActiveTool.properties.getValue("ContainerID");
|
||||||
}
|
}
|
||||||
if(UM.ActiveTool.properties.getValue("ContainerID"))
|
|
||||||
{
|
|
||||||
//We're on an extruder tab. Pick the current extruder.
|
|
||||||
return UM.ActiveTool.properties.getValue("ContainerID");
|
|
||||||
}
|
|
||||||
//No extruder tab is selected. Pick the global stack. Shouldn't happen any more since we removed the global tab.
|
|
||||||
return activeMachineId;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue