Minor cleanup of SettingOverrideDecorator

We never use the _instance variable except in deepcopy, so no need to
store that.

Contributes to CURA-3719
This commit is contained in:
Arjen Hiemstra 2017-07-18 11:22:37 +02:00
parent 8fb21b39ad
commit 573d25982e

View file

@ -26,8 +26,7 @@ class SettingOverrideDecorator(SceneNodeDecorator):
super().__init__()
self._stack = ContainerStack(stack_id = id(self))
self._stack.setDirty(False) # This stack does not need to be saved.
self._instance = InstanceContainer(container_id = "SettingOverrideInstanceContainer")
self._stack.addContainer(self._instance)
self._stack.addContainer(InstanceContainer(container_id = "SettingOverrideInstanceContainer"))
if ExtruderManager.getInstance().extruderCount > 1:
self._extruder_stack = ExtruderManager.getInstance().getExtruderStack(0).getId()
@ -46,13 +45,14 @@ class SettingOverrideDecorator(SceneNodeDecorator):
## Create a fresh decorator object
deep_copy = SettingOverrideDecorator()
## Copy the instance
deep_copy._instance = copy.deepcopy(self._instance, memo)
instance_container = copy.deepcopy(self._stack.getContainer(0), memo)
## Set the copied instance as the first (and only) instance container of the stack.
deep_copy._stack.replaceContainer(0, instance_container)
# Properly set the right extruder on the copy
deep_copy.setActiveExtruder(self._extruder_stack)
## Set the copied instance as the first (and only) instance container of the stack.
deep_copy._stack.replaceContainer(0, deep_copy._instance)
return deep_copy
## Gets the currently active extruder to print this object with.