From bb476752a41ca17a37b5db35bf28702f99577958 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Wed, 11 Oct 2017 14:04:19 +0200 Subject: [PATCH] Fix infill density binding in Recommended mode CURA-4438 Infill density in Recommended mode should be bound to the correct stack when the infill extruder is/is not set to a specific extruder. --- resources/qml/SidebarSimple.qml | 34 +++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/resources/qml/SidebarSimple.qml b/resources/qml/SidebarSimple.qml index 114a53eda1..99929daf31 100644 --- a/resources/qml/SidebarSimple.qml +++ b/resources/qml/SidebarSimple.qml @@ -898,6 +898,40 @@ Item storeIndex: 0 } + Binding + { + target: infillDensity + property: "containerStackId" + 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 activeStackId = Cura.MachineManager.activeStackId; + + if(machineExtruderCount.properties.value == 1) + { + //Not settable per extruder or there only is global, so we must pick global. + return activeStackId; + } + if(infillInheritStackProvider.properties.limit_to_extruder != null && infillInheritStackProvider.properties.limit_to_extruder >= 0) + { + //We have limit_to_extruder, so pick that stack. + return ExtruderManager.extruderIds[String(infillInheritStackProvider.properties.limit_to_extruder)]; + } + return activeStackId; + } + } + + UM.SettingPropertyProvider + { + id: infillInheritStackProvider + containerStackId: Cura.MachineManager.activeMachineId + key: "infill_sparse_density" + watchedProperties: [ "limit_to_extruder" ] + } + UM.SettingPropertyProvider { id: infillDensity