diff options
author | Ghostkeeper <rubend@tutanota.com> | 2019-02-21 11:09:19 +0300 |
---|---|---|
committer | Ghostkeeper <rubend@tutanota.com> | 2019-02-21 11:09:19 +0300 |
commit | 650204dae79b71176d2549483c96cd021e1ba7bf (patch) | |
tree | 8e30ecdf35bc9e0f78871092c65386bea8d0a0c1 /plugins/XmlMaterialProfile/XmlMaterialProfile.py | |
parent | 3040fde9ebe4d2b6ea46352662f0055d2cc53cbe (diff) | |
parent | ab25bcaf2f361ae115a331a6fe694ad48c72848a (diff) |
Merge branch '4.0'
Diffstat (limited to 'plugins/XmlMaterialProfile/XmlMaterialProfile.py')
-rw-r--r-- | plugins/XmlMaterialProfile/XmlMaterialProfile.py | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/plugins/XmlMaterialProfile/XmlMaterialProfile.py b/plugins/XmlMaterialProfile/XmlMaterialProfile.py index 1a0d3bc85e..b6dff65403 100644 --- a/plugins/XmlMaterialProfile/XmlMaterialProfile.py +++ b/plugins/XmlMaterialProfile/XmlMaterialProfile.py @@ -72,7 +72,9 @@ class XmlMaterialProfile(InstanceContainer): material_manager = CuraApplication.getInstance().getMaterialManager() root_material_id = self.getMetaDataEntry("base_file") #if basefile is self.getId, this is a basefile. material_group = material_manager.getMaterialGroup(root_material_id) - + if not material_group: #If the profile is not registered in the registry but loose/temporary, it will not have a base file tree. + super().setMetaDataEntry(key, value) + return # Update the root material container root_material_container = material_group.root_material_node.getContainer() if root_material_container is not None: @@ -142,23 +144,13 @@ class XmlMaterialProfile(InstanceContainer): # setting_version is derived from the "version" tag in the schema, so don't serialize it into a file if ignored_metadata_keys is None: ignored_metadata_keys = set() - ignored_metadata_keys |= {"setting_version"} + ignored_metadata_keys |= {"setting_version", "definition", "status", "variant", "type", "base_file", "approximate_diameter", "id", "container_type", "name"} # remove the keys that we want to ignore in the metadata for key in ignored_metadata_keys: if key in metadata: del metadata[key] properties = metadata.pop("properties", {}) - # Metadata properties that should not be serialized. - metadata.pop("status", "") - metadata.pop("variant", "") - metadata.pop("type", "") - metadata.pop("base_file", "") - metadata.pop("approximate_diameter", "") - metadata.pop("id", "") - metadata.pop("container_type", "") - metadata.pop("name", "") - ## Begin Name Block builder.start("name") # type: ignore @@ -1166,6 +1158,8 @@ class XmlMaterialProfile(InstanceContainer): with open(product_to_id_file, encoding = "utf-8") as f: product_to_id_map = json.load(f) product_to_id_map = {key: [value] for key, value in product_to_id_map.items()} + #This also loads "Ultimaker S5" -> "ultimaker_s5" even though that is not strictly necessary with the default to change spaces into underscores. + #However it is not always loaded with that default; this mapping is also used in serialize() without that default. return product_to_id_map ## Parse the value of the "material compatible" property. |