diff options
author | Ghostkeeper <rubend@tutanota.com> | 2019-08-27 16:06:44 +0300 |
---|---|---|
committer | Ghostkeeper <rubend@tutanota.com> | 2019-08-27 16:47:41 +0300 |
commit | b60b13e5bfaf43dec47d94e58da13554721dd765 (patch) | |
tree | e9dd0b5d3a52fb70cb2b92917f6549adab64a0e4 /plugins/XmlMaterialProfile/XmlMaterialProfile.py | |
parent | 3dc7c7b61c4c354ceb7fe16b84cb0bbacf434372 (diff) |
Use container tree to check for variants when serialising
Not the variant manager, because it's deprecated.
Contributes to issue CURA-6600.
Diffstat (limited to 'plugins/XmlMaterialProfile/XmlMaterialProfile.py')
-rw-r--r-- | plugins/XmlMaterialProfile/XmlMaterialProfile.py | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/plugins/XmlMaterialProfile/XmlMaterialProfile.py b/plugins/XmlMaterialProfile/XmlMaterialProfile.py index 157d871d54..4c1920a97e 100644 --- a/plugins/XmlMaterialProfile/XmlMaterialProfile.py +++ b/plugins/XmlMaterialProfile/XmlMaterialProfile.py @@ -226,7 +226,7 @@ class XmlMaterialProfile(InstanceContainer): machine_container_map = {} # type: Dict[str, InstanceContainer] machine_variant_map = {} # type: Dict[str, Dict[str, Any]] - variant_manager = CuraApplication.getInstance().getVariantManager() + container_tree = ContainerTree.getInstance() root_material_id = self.getMetaDataEntry("base_file") # if basefile is self.getId, this is a basefile. all_containers = registry.findInstanceContainers(base_file = root_material_id) @@ -243,16 +243,15 @@ class XmlMaterialProfile(InstanceContainer): machine_variant_map[definition_id] = {} variant_name = container.getMetaDataEntry("variant_name") - if variant_name: - variant_node = variant_manager.getVariantNode(definition_id, variant_name) - if variant_node is None: - continue - variant_dict = {"variant_node":variant_node , - "material_container": container} - machine_variant_map[definition_id][variant_name] = variant_dict - continue + if not variant_name: + machine_container_map[definition_id] = container - machine_container_map[definition_id] = container + if variant_name not in container_tree.machines[definition_id].variants: + continue + variant_node = container_tree.machines[definition_id].variants[variant_name] + variant_dict = {"variant_node": variant_node, + "material_container": container} + machine_variant_map[definition_id][variant_name] = variant_dict # Map machine human-readable names to IDs product_id_map = self.getProductIdMap() |