Handle rounding errors in stack_nr

Wouldn't want it to index extruder '1.0'.

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

View file

@ -61,7 +61,7 @@ class PerObjectSettingVisibilityHandler(UM.Settings.Models.SettingVisibilityHand
new_instance = SettingInstance(definition, settings)
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.
stack_nr = str(int(round(float(self._stack.getProperty(item, "global_inherits_stack"))))) #Stack to get the setting from. Round it and remove the fractional part.
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"))