mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-08 07:27:29 -06:00
Fix overriding extruder stacks for project loading
CURA-3756
This commit is contained in:
parent
a1457fa890
commit
ee831928ba
1 changed files with 20 additions and 1 deletions
|
@ -592,8 +592,27 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
|
||||||
if container_stacks:
|
if container_stacks:
|
||||||
# this container stack already exists, try to resolve
|
# this container stack already exists, try to resolve
|
||||||
stack = container_stacks[0]
|
stack = container_stacks[0]
|
||||||
|
|
||||||
if self._resolve_strategies["machine"] == "override":
|
if self._resolve_strategies["machine"] == "override":
|
||||||
pass # do nothing
|
# NOTE: This is the same code as those in the lower part
|
||||||
|
global_stacks = self._container_registry.findContainerStacks(id = global_stack_id_original)
|
||||||
|
# deserialize new extruder stack over the current ones
|
||||||
|
if global_stacks:
|
||||||
|
old_extruder_stack_id = global_stacks[0].extruders[index].getId()
|
||||||
|
# HACK delete file
|
||||||
|
self._container_registry._deleteFiles(global_stacks[0].extruders[index])
|
||||||
|
global_stacks[0].extruders[index].deserialize(archive.open(extruder_stack_file).read().decode("utf-8"))
|
||||||
|
# HACK
|
||||||
|
global_stacks[0]._extruders = global_stacks[0]._extruders[:2]
|
||||||
|
# HACK update cache
|
||||||
|
del self._container_registry._id_container_cache[old_extruder_stack_id]
|
||||||
|
new_extruder_stack_id = global_stacks[0].extruders[index].getId()
|
||||||
|
self._container_registry._id_container_cache[new_extruder_stack_id] = global_stacks[0].extruders[index]
|
||||||
|
|
||||||
|
stack = global_stacks[0].extruders[index]
|
||||||
|
else:
|
||||||
|
Logger.log("w", "Could not find global stack, while I expected it: %s" % global_stack_id_original)
|
||||||
|
|
||||||
elif self._resolve_strategies["machine"] == "new":
|
elif self._resolve_strategies["machine"] == "new":
|
||||||
# create a new extruder stack from this one
|
# create a new extruder stack from this one
|
||||||
new_id = self.getNewId(container_id)
|
new_id = self.getNewId(container_id)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue