Extruder stacks are no longer renamed when loading from workspace

CURA-1263
This commit is contained in:
Jaime van Kessel 2016-11-14 17:08:43 +01:00
parent 2e4b430cf8
commit 3245c2fe32

View file

@ -213,13 +213,17 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
stack = ContainerStack(new_id)
stack.deserialize(archive.open(container_stack_file).read().decode("utf-8"))
# Ensure a unique ID and name
stack._id = new_id
# Extruder stacks are "bound" to a machine. If we add the machine as a new one, the id of the
# bound machine also needs to change.
if stack.getMetaDataEntry("machine", None):
stack.setMetaDataEntry("machine", self.getNewId(stack.getMetaDataEntry("machine")))
# Ensure a unique ID and name
stack._id = new_id
stack.setName(self._container_registry.uniqueName(stack.getName()))
if stack.getMetaDataEntry("type") != "extruder_train":
# Only machines need a new name, stacks may be non-unique
stack.setName(self._container_registry.uniqueName(stack.getName()))
self._container_registry.addContainer(stack)
else:
Logger.log("w", "Resolve strategy of %s for machine is not supported", self._resolve_strategies["machine"])