mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-24 07:03:56 -06:00
Only upgrade stacks based on TwoTrees printers
Both extruder stacks and global stacks though. Contributes to issue CURA-8212.
This commit is contained in:
parent
a00b21a802
commit
9a7b19f8ac
1 changed files with 15 additions and 15 deletions
|
@ -140,23 +140,23 @@ class VersionUpgrade49to410(VersionUpgrade):
|
|||
|
||||
# Change renamed profiles.
|
||||
if "containers" in parser:
|
||||
# For legacy TwoTrees printers, change the variant to 0.4.
|
||||
definition_id = parser["containers"]["7"]
|
||||
material_id = parser["containers"]["4"]
|
||||
old_quality_id = parser["containers"]["3"]
|
||||
if parser["metadata"].get("type", "machine") == "extruder_train":
|
||||
if parser["containers"]["5"] == "empty_variant":
|
||||
if definition_id in self._default_variants:
|
||||
parser["containers"]["5"] = self._default_variants[definition_id]
|
||||
if definition_id in self._quality_changes_to_two_trees_base:
|
||||
material_id = parser["containers"]["4"]
|
||||
old_quality_id = parser["containers"]["3"]
|
||||
if parser["metadata"].get("type", "machine") == "extruder_train":
|
||||
if parser["containers"]["5"] == "empty_variant":
|
||||
if definition_id in self._default_variants:
|
||||
parser["containers"]["5"] = self._default_variants[definition_id] # For legacy TwoTrees printers, change the variant to 0.4.
|
||||
|
||||
# Also change the quality to go along with it.
|
||||
if material_id in self._two_trees_quality_per_material and old_quality_id in self._two_trees_quality_per_material[material_id]:
|
||||
parser["containers"]["3"] = self._two_trees_quality_per_material[material_id][old_quality_id]
|
||||
stack_copy = {} # type: Dict[str, str] # Make a copy so that we don't modify the dict we're iterating over.
|
||||
stack_copy.update(parser["containers"])
|
||||
for position, profile_id in stack_copy.items():
|
||||
if profile_id in self._renamed_profiles:
|
||||
parser["containers"][position] = self._renamed_profiles[profile_id]
|
||||
# Also change the quality to go along with it.
|
||||
if material_id in self._two_trees_quality_per_material and old_quality_id in self._two_trees_quality_per_material[material_id]:
|
||||
parser["containers"]["3"] = self._two_trees_quality_per_material[material_id][old_quality_id]
|
||||
stack_copy = {} # type: Dict[str, str] # Make a copy so that we don't modify the dict we're iterating over.
|
||||
stack_copy.update(parser["containers"])
|
||||
for position, profile_id in stack_copy.items():
|
||||
if profile_id in self._renamed_profiles:
|
||||
parser["containers"][position] = self._renamed_profiles[profile_id]
|
||||
|
||||
result = io.StringIO()
|
||||
parser.write(result)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue