mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-10-10 15:27:53 -06:00
Added deepcopy function to settingOverrideDecorator
CURA-1636
This commit is contained in:
parent
51ea6779df
commit
4695862b49
1 changed files with 10 additions and 1 deletions
|
@ -7,7 +7,7 @@ from UM.Settings.InstanceContainer import InstanceContainer
|
|||
from UM.Settings.ContainerRegistry import ContainerRegistry
|
||||
|
||||
from UM.Application import Application
|
||||
|
||||
import copy
|
||||
## A decorator that adds a container stack to a Node. This stack should be queried for all settings regarding
|
||||
# the linked node. The Stack in question will refer to the global stack (so that settings that are not defined by
|
||||
# this stack still resolve.
|
||||
|
@ -25,6 +25,15 @@ class SettingOverrideDecorator(SceneNodeDecorator):
|
|||
Application.getInstance().globalContainerStackChanged.connect(self._onGlobalContainerStackChanged)
|
||||
self._onGlobalContainerStackChanged()
|
||||
|
||||
def __deepcopy__(self, memo):
|
||||
## Create a fresh decorator object
|
||||
deep_copy = SettingOverrideDecorator()
|
||||
## Copy the stack
|
||||
deep_copy._stack = copy.deepcopy(self._stack, memo)
|
||||
## Ensure that the id is unique.
|
||||
deep_copy._stack._id = id(deep_copy)
|
||||
return deep_copy
|
||||
|
||||
def _onSettingChanged(self, instance, property):
|
||||
if property == "value": # Only reslice if the value has changed.
|
||||
Application.getInstance().getBackend().forceSlice()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue