mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-06 22:47:29 -06:00
Load setting_version from XML material profile
The setting_version is translated from the version number. The setting_version number currently happens to be the same as the version number of XML but that won't always be the case so we introduce a translation-step as well. Contributes to issue CURA-3427.
This commit is contained in:
parent
38f081539a
commit
c8295434f3
1 changed files with 12 additions and 0 deletions
|
@ -21,6 +21,17 @@ class XmlMaterialProfile(InstanceContainer):
|
|||
super().__init__(container_id, *args, **kwargs)
|
||||
self._inherited_files = []
|
||||
|
||||
## Translates the version number in the XML files to the setting_version
|
||||
# metadata entry.
|
||||
#
|
||||
# Since the two may increment independently we need a way to say which
|
||||
# versions of the XML specification are compatible with our setting data
|
||||
# version numbers.
|
||||
def xmlVersionToSettingVersion(self, xml_version):
|
||||
if xml_version == 1: #Only one known version and it happens to be the same as our current setting_version.
|
||||
return 1
|
||||
return 0
|
||||
|
||||
def getInheritedFiles(self):
|
||||
return self._inherited_files
|
||||
|
||||
|
@ -403,6 +414,7 @@ class XmlMaterialProfile(InstanceContainer):
|
|||
meta_data["type"] = "material"
|
||||
meta_data["base_file"] = self.id
|
||||
meta_data["status"] = "unknown" # TODO: Add material verfication
|
||||
meta_data["setting_version"] = self.getVersionFromSerialized(serialized)
|
||||
|
||||
inherits = data.find("./um:inherits", self.__namespaces)
|
||||
if inherits is not None:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue