mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-06 22:47:29 -06:00
WIP: fix material container renaming in project loading
CURA-3756
This commit is contained in:
parent
f436da8674
commit
bb0e711577
1 changed files with 19 additions and 9 deletions
|
@ -650,20 +650,30 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
|
|||
each_extruder_stack.definitionChanges = each_changes_container
|
||||
|
||||
if self._resolve_strategies["material"] == "new":
|
||||
for material in material_containers:
|
||||
for each_material in material_containers:
|
||||
old_material = global_stack.material
|
||||
if old_material.getId() in self._id_mapping:
|
||||
material_index = global_stack.getContainerIndex(old_material)
|
||||
global_stack.replaceContainer(material_index, material)
|
||||
|
||||
# check if the old material container has been renamed to this material container ID
|
||||
# if the container hasn't been renamed, we do nothing.
|
||||
new_id = self._id_mapping.get(old_material.getId())
|
||||
if new_id is None or new_id != each_material.getId():
|
||||
continue
|
||||
|
||||
for stack in extruder_stacks:
|
||||
old_material = stack.findContainer({"type": "material"})
|
||||
if old_material.getId() in self._id_mapping:
|
||||
material_index = stack.getContainerIndex(old_material)
|
||||
stack.replaceContainer(material_index, material)
|
||||
global_stack.material = each_material
|
||||
|
||||
for each_extruder_stack in extruder_stacks:
|
||||
old_material = each_extruder_stack.material
|
||||
|
||||
# check if the old material container has been renamed to this material container ID
|
||||
# if the container hasn't been renamed, we do nothing.
|
||||
new_id = self._id_mapping.get(old_material.getId())
|
||||
if new_id is None or new_id != each_material.getId():
|
||||
continue
|
||||
|
||||
if old_material.getId() in self._id_mapping:
|
||||
each_extruder_stack.material = each_material
|
||||
|
||||
if extruder_stacks:
|
||||
for stack in extruder_stacks:
|
||||
ExtruderManager.getInstance().registerExtruder(stack, global_stack.getId())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue