mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-07 06:57:28 -06:00
Adding binding for per-object settings to update stack ID
CURA-4186 The stack ID to use for a setting in per-object settings is not updated when it is set to limit to extruder.
This commit is contained in:
parent
812e262f39
commit
39ab740adb
1 changed files with 34 additions and 1 deletions
|
@ -151,10 +151,43 @@ Item {
|
||||||
UM.SettingPropertyProvider
|
UM.SettingPropertyProvider
|
||||||
{
|
{
|
||||||
id: inheritStackProvider
|
id: inheritStackProvider
|
||||||
containerStackId: Cura.MachineManager.activeMachineId
|
containerStackId: UM.ActiveTool.properties.getValue("ContainerID")
|
||||||
key: model.key
|
key: model.key
|
||||||
watchedProperties: [ "limit_to_extruder" ]
|
watchedProperties: [ "limit_to_extruder" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Binding
|
||||||
|
{
|
||||||
|
target: provider
|
||||||
|
property: "containerStackId"
|
||||||
|
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
|
||||||
|
// binding will be triggered when activeMachineId is changed too.
|
||||||
|
// Otherwise, if this value only depends on the extruderIds, it won't get updated when the
|
||||||
|
// 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.
|
||||||
|
return activeMachineId;
|
||||||
|
}
|
||||||
|
if(inheritStackProvider.properties.limit_to_extruder != null && inheritStackProvider.properties.limit_to_extruder >= 0)
|
||||||
|
{
|
||||||
|
//We have limit_to_extruder, so pick that stack.
|
||||||
|
return ExtruderManager.extruderIds[String(inheritStackProvider.properties.limit_to_extruder)];
|
||||||
|
}
|
||||||
|
if(ExtruderManager.activeExtruderStackId)
|
||||||
|
{
|
||||||
|
//We're on an extruder tab. Pick the current extruder.
|
||||||
|
return ExtruderManager.activeExtruderStackId;
|
||||||
|
}
|
||||||
|
//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