From 50c4b88050cdd135ff831679bfedc637c1c85258 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 22 May 2017 16:56:54 +0200 Subject: [PATCH 1/3] Let global stack handle limit to extruder Contributes to issue CURA-3738. --- cura/ConvexHullDecorator.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/cura/ConvexHullDecorator.py b/cura/ConvexHullDecorator.py index 44150cb76f..51b22755dd 100644 --- a/cura/ConvexHullDecorator.py +++ b/cura/ConvexHullDecorator.py @@ -298,7 +298,7 @@ class ConvexHullDecorator(SceneNodeDecorator): self._onChanged() ## Private convenience function to get a setting from the correct extruder (as defined by limit_to_extruder property). - def _getSettingProperty(self, setting_key, property="value"): + def _getSettingProperty(self, setting_key, property = "value"): per_mesh_stack = self._node.callDecoration("getStack") if per_mesh_stack: return per_mesh_stack.getProperty(setting_key, property) @@ -314,10 +314,8 @@ class ConvexHullDecorator(SceneNodeDecorator): extruder_stack_id = ExtruderManager.getInstance().extruderIds["0"] extruder_stack = ContainerRegistry.getInstance().findContainerStacks(id = extruder_stack_id)[0] return extruder_stack.getProperty(setting_key, property) - else: #Limit_to_extruder is set. Use that one. - extruder_stack_id = ExtruderManager.getInstance().extruderIds[str(extruder_index)] - stack = ContainerRegistry.getInstance().findContainerStacks(id = extruder_stack_id)[0] - return stack.getProperty(setting_key, property) + else: #Limit_to_extruder is set. The global stack handles this then. + return self._global_stack.getProperty(setting_key, property) ## Returns true if node is a descendant or the same as the root node. def __isDescendant(self, root, node): From b797fcc74d73805788dcd60b12d04767e61a521a Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Wed, 24 May 2017 10:17:11 +0200 Subject: [PATCH 2/3] Use global stack to evaluate limit_to_extruder value CURA-3738 Getting limit_to_extruder from definition in QML returns a SettingFunction which hasn't been evaluated. This causes the comparison not to be working. We change it to use the global stack to evaluate so we can get an actual extruder number string. --- resources/qml/Settings/SettingItem.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/qml/Settings/SettingItem.qml b/resources/qml/Settings/SettingItem.qml index 65e8b7e1c1..7108d2a04c 100644 --- a/resources/qml/Settings/SettingItem.qml +++ b/resources/qml/Settings/SettingItem.qml @@ -140,7 +140,7 @@ Item { { id: linkedSettingIcon; - visible: Cura.MachineManager.activeStackId != Cura.MachineManager.activeMachineId && (!definition.settable_per_extruder || definition.limit_to_extruder != "-1") && base.showLinkedSettingIcon + visible: Cura.MachineManager.activeStackId != Cura.MachineManager.activeMachineId && (!definition.settable_per_extruder || globalPropertyProvider.properties.limit_to_extruder != "-1") && base.showLinkedSettingIcon height: parent.height; width: height; From 585bc788927667ec583c7f0c4e05670fc231fab8 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Mon, 29 May 2017 15:52:00 +0200 Subject: [PATCH 3/3] Only set material for imported quality profile if there is an active material CURA-3881 CuraContainerRegistry._activeMaterialId() can return an empty string if there is no active material, and in this case, importing a custom quality file will fail. --- cura/Settings/CuraContainerRegistry.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cura/Settings/CuraContainerRegistry.py b/cura/Settings/CuraContainerRegistry.py index b159183241..a67b502b4a 100644 --- a/cura/Settings/CuraContainerRegistry.py +++ b/cura/Settings/CuraContainerRegistry.py @@ -281,8 +281,10 @@ class CuraContainerRegistry(ContainerRegistry): if self._machineHasOwnQualities(): profile.setDefinition(self._activeQualityDefinition()) if self._machineHasOwnMaterials(): - profile.addMetaDataEntry("material", self._activeMaterialId()) - quality_type_criteria["material"] = self._activeMaterialId() + active_material_id = self._activeMaterialId() + if active_material_id: # only update if there is an active material + profile.addMetaDataEntry("material", active_material_id) + quality_type_criteria["material"] = active_material_id quality_type_criteria["definition"] = profile.getDefinition().getId()