More defensive check for global_inherits_stack extruder

This should never give the keyerror any more and always default back to non-global_inherits_stack mode.

Contributes to issue CURA-2067.
This commit is contained in:
Ghostkeeper 2016-08-05 11:59:32 +02:00
parent a46f6cc14d
commit 92b154f5fe
No known key found for this signature in database
GPG key ID: 701948C5954A7385

View file

@ -62,7 +62,7 @@ class PerObjectSettingVisibilityHandler(UM.Settings.Models.SettingVisibilityHand
if definition.global_inherits_stack and self._stack.getProperty("machine_extruder_count", "value") > 1:
#Obtain the value from the correct container stack. Only once, upon adding the setting.
stack_nr = self._stack.getProperty(item, "global_inherits_stack") #Stack to get the setting from.
if float(stack_nr) >= 0: #Only if it defines an extruder stack.
if stack_nr in ExtruderManager.getInstance().extruderIds: #Only if it defines an extruder stack.
extruder_stack = UM.Settings.ContainerRegistry.getInstance().findContainerStacks(id = ExtruderManager.getInstance().extruderIds[stack_nr])[0]
new_instance.setProperty("value", extruder_stack.getProperty(item, "value"))
settings.addInstance(new_instance)