mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-06 22:47:29 -06:00
Revert "Make 3MF-reader aware of setting-version for introduction Intent."
This reverts commit 16ea437255
.
Should have been (and is now) done in the version upgrade instead.
This commit is contained in:
parent
3479a3df76
commit
cb7d99d2dc
2 changed files with 11 additions and 33 deletions
|
@ -1,7 +1,7 @@
|
||||||
# Copyright (c) 2018 Ultimaker B.V.
|
# Copyright (c) 2018 Ultimaker B.V.
|
||||||
# Cura is released under the terms of the LGPLv3 or higher.
|
# Cura is released under the terms of the LGPLv3 or higher.
|
||||||
|
|
||||||
from typing import Any, cast, Dict, List, Optional
|
from typing import Any, cast, List, Optional
|
||||||
from PyQt5.QtCore import pyqtProperty, pyqtSignal, QObject
|
from PyQt5.QtCore import pyqtProperty, pyqtSignal, QObject
|
||||||
|
|
||||||
from UM.Application import Application
|
from UM.Application import Application
|
||||||
|
@ -364,22 +364,3 @@ class _ContainerIndexes:
|
||||||
|
|
||||||
# Reverse lookup: type -> index
|
# Reverse lookup: type -> index
|
||||||
TypeIndexMap = dict([(v, k) for k, v in IndexTypeMap.items()])
|
TypeIndexMap = dict([(v, k) for k, v in IndexTypeMap.items()])
|
||||||
|
|
||||||
# Mapping to old values before Intent introduction. Used for reading older versions of input files.
|
|
||||||
IndexToOldIndexMap = {
|
|
||||||
UserChanges: 0,
|
|
||||||
QualityChanges: 1,
|
|
||||||
Intent: -1, # Wasn't there in the old 'format'!
|
|
||||||
Quality: 2,
|
|
||||||
Material: 3,
|
|
||||||
Variant: 4,
|
|
||||||
DefinitionChanges: 5,
|
|
||||||
Definition: 6,
|
|
||||||
}
|
|
||||||
|
|
||||||
# Reverse lookup: old index -> new index
|
|
||||||
OldIndexToIndexMap = dict([(v, k) for k, v in IndexToOldIndexMap.items()])
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def getIndexMapping(cls, setting_version: int) -> Dict[int, int]:
|
|
||||||
return dict([(x, x) for x in list(range(99))]) if setting_version >= 10 else cls.IndexToOldIndexMap
|
|
||||||
|
|
|
@ -371,8 +371,7 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
|
||||||
# Get quality type
|
# Get quality type
|
||||||
parser = ConfigParser(interpolation = None)
|
parser = ConfigParser(interpolation = None)
|
||||||
parser.read_string(serialized)
|
parser.read_string(serialized)
|
||||||
index_map_version = _ContainerIndexes.getIndexMapping(int(parser["metadata"]["setting_version"]))
|
quality_container_id = parser["containers"][str(_ContainerIndexes.Quality)]
|
||||||
quality_container_id = parser["containers"][str(index_map_version[_ContainerIndexes.Quality])]
|
|
||||||
quality_type = "empty_quality"
|
quality_type = "empty_quality"
|
||||||
if quality_container_id not in ("empty", "empty_quality"):
|
if quality_container_id not in ("empty", "empty_quality"):
|
||||||
quality_type = instance_container_info_dict[quality_container_id].parser["metadata"]["quality_type"]
|
quality_type = instance_container_info_dict[quality_container_id].parser["metadata"]["quality_type"]
|
||||||
|
@ -382,11 +381,10 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
|
||||||
serialized = GlobalStack._updateSerialized(serialized, global_stack_file)
|
serialized = GlobalStack._updateSerialized(serialized, global_stack_file)
|
||||||
parser = ConfigParser(interpolation = None)
|
parser = ConfigParser(interpolation = None)
|
||||||
parser.read_string(serialized)
|
parser.read_string(serialized)
|
||||||
index_map_version = _ContainerIndexes.getIndexMapping(int(parser["metadata"]["setting_version"]))
|
definition_changes_id = parser["containers"][str(_ContainerIndexes.DefinitionChanges)]
|
||||||
definition_changes_id = parser["containers"][str(index_map_version[_ContainerIndexes.DefinitionChanges])]
|
|
||||||
if definition_changes_id not in ("empty", "empty_definition_changes"):
|
if definition_changes_id not in ("empty", "empty_definition_changes"):
|
||||||
self._machine_info.definition_changes_info = instance_container_info_dict[definition_changes_id]
|
self._machine_info.definition_changes_info = instance_container_info_dict[definition_changes_id]
|
||||||
user_changes_id = parser["containers"][str(index_map_version[_ContainerIndexes.UserChanges])]
|
user_changes_id = parser["containers"][str(_ContainerIndexes.UserChanges)]
|
||||||
if user_changes_id not in ("empty", "empty_user_changes"):
|
if user_changes_id not in ("empty", "empty_user_changes"):
|
||||||
self._machine_info.user_changes_info = instance_container_info_dict[user_changes_id]
|
self._machine_info.user_changes_info = instance_container_info_dict[user_changes_id]
|
||||||
|
|
||||||
|
@ -396,8 +394,8 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
|
||||||
|
|
||||||
extruder_info = ExtruderInfo()
|
extruder_info = ExtruderInfo()
|
||||||
extruder_info.position = position
|
extruder_info.position = position
|
||||||
variant_id = parser["containers"][str(index_map_version[_ContainerIndexes.Variant])]
|
variant_id = parser["containers"][str(_ContainerIndexes.Variant)]
|
||||||
material_id = parser["containers"][str(index_map_version[_ContainerIndexes.Material])]
|
material_id = parser["containers"][str(_ContainerIndexes.Material)]
|
||||||
if variant_id not in ("empty", "empty_variant"):
|
if variant_id not in ("empty", "empty_variant"):
|
||||||
extruder_info.variant_info = instance_container_info_dict[variant_id]
|
extruder_info.variant_info = instance_container_info_dict[variant_id]
|
||||||
if material_id not in ("empty", "empty_material"):
|
if material_id not in ("empty", "empty_material"):
|
||||||
|
@ -405,7 +403,7 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
|
||||||
extruder_info.root_material_id = root_material_id
|
extruder_info.root_material_id = root_material_id
|
||||||
self._machine_info.extruder_info_dict[position] = extruder_info
|
self._machine_info.extruder_info_dict[position] = extruder_info
|
||||||
else:
|
else:
|
||||||
variant_id = parser["containers"][str(index_map_version[_ContainerIndexes.Variant])]
|
variant_id = parser["containers"][str(_ContainerIndexes.Variant)]
|
||||||
if variant_id not in ("empty", "empty_variant"):
|
if variant_id not in ("empty", "empty_variant"):
|
||||||
self._machine_info.variant_info = instance_container_info_dict[variant_id]
|
self._machine_info.variant_info = instance_container_info_dict[variant_id]
|
||||||
QCoreApplication.processEvents() # Ensure that the GUI does not freeze.
|
QCoreApplication.processEvents() # Ensure that the GUI does not freeze.
|
||||||
|
@ -417,14 +415,13 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
|
||||||
serialized = ExtruderStack._updateSerialized(serialized, extruder_stack_file)
|
serialized = ExtruderStack._updateSerialized(serialized, extruder_stack_file)
|
||||||
parser = ConfigParser(interpolation = None)
|
parser = ConfigParser(interpolation = None)
|
||||||
parser.read_string(serialized)
|
parser.read_string(serialized)
|
||||||
index_map_version = _ContainerIndexes.getIndexMapping(int(parser["metadata"]["setting_version"]))
|
|
||||||
|
|
||||||
# The check should be done for the extruder stack that's associated with the existing global stack,
|
# The check should be done for the extruder stack that's associated with the existing global stack,
|
||||||
# and those extruder stacks may have different IDs.
|
# and those extruder stacks may have different IDs.
|
||||||
# So we check according to the positions
|
# So we check according to the positions
|
||||||
position = parser["metadata"]["position"]
|
position = parser["metadata"]["position"]
|
||||||
variant_id = parser["containers"][str(index_map_version[_ContainerIndexes.Variant])]
|
variant_id = parser["containers"][str(_ContainerIndexes.Variant)]
|
||||||
material_id = parser["containers"][str(index_map_version[_ContainerIndexes.Material])]
|
material_id = parser["containers"][str(_ContainerIndexes.Material)]
|
||||||
|
|
||||||
extruder_info = ExtruderInfo()
|
extruder_info = ExtruderInfo()
|
||||||
extruder_info.position = position
|
extruder_info.position = position
|
||||||
|
@ -438,11 +435,11 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
|
||||||
root_material_id = reverse_material_id_dict[material_id]
|
root_material_id = reverse_material_id_dict[material_id]
|
||||||
extruder_info.root_material_id = root_material_id
|
extruder_info.root_material_id = root_material_id
|
||||||
|
|
||||||
definition_changes_id = parser["containers"][str(index_map_version[_ContainerIndexes.DefinitionChanges])]
|
definition_changes_id = parser["containers"][str(_ContainerIndexes.DefinitionChanges)]
|
||||||
if definition_changes_id not in ("empty", "empty_definition_changes"):
|
if definition_changes_id not in ("empty", "empty_definition_changes"):
|
||||||
extruder_info.definition_changes_info = instance_container_info_dict[definition_changes_id]
|
extruder_info.definition_changes_info = instance_container_info_dict[definition_changes_id]
|
||||||
|
|
||||||
user_changes_id = parser["containers"][str(index_map_version[_ContainerIndexes.UserChanges])]
|
user_changes_id = parser["containers"][str(_ContainerIndexes.UserChanges)]
|
||||||
if user_changes_id not in ("empty", "empty_user_changes"):
|
if user_changes_id not in ("empty", "empty_user_changes"):
|
||||||
extruder_info.user_changes_info = instance_container_info_dict[user_changes_id]
|
extruder_info.user_changes_info = instance_container_info_dict[user_changes_id]
|
||||||
self._machine_info.extruder_info_dict[position] = extruder_info
|
self._machine_info.extruder_info_dict[position] = extruder_info
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue