Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Ultimaker/Cura.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGhostkeeper <rubend@tutanota.com>2019-08-27 16:47:23 +0300
committerGhostkeeper <rubend@tutanota.com>2019-08-27 16:47:42 +0300
commitdabd905853b178856dd2fc8320b4a4633b7fa2f3 (patch)
treedc8aef9d0394eb7428592e616d8fe1e6e7ecaa4d /plugins/XmlMaterialProfile
parent63ae6ee9ec874f734ad28975fe2866b0df8d03b9 (diff)
Fix serialising materials with submaterials in not loaded container trees
Material profiles need to serialise subprofiles that belong to different printers as well. Some of these materials may not be loaded in the ContainerTree structure. To prevent having to load that as well, we're just not going to use the container tree any more. It turns out that the only reason it was using the container tree was to get the hardware_type metadata from the node in the tree. So just get that from the container itself and we're fine. Contributes to issue CURA-6600.
Diffstat (limited to 'plugins/XmlMaterialProfile')
-rw-r--r--plugins/XmlMaterialProfile/XmlMaterialProfile.py12
1 files changed, 4 insertions, 8 deletions
diff --git a/plugins/XmlMaterialProfile/XmlMaterialProfile.py b/plugins/XmlMaterialProfile/XmlMaterialProfile.py
index 4c1920a97e..ac53564eaf 100644
--- a/plugins/XmlMaterialProfile/XmlMaterialProfile.py
+++ b/plugins/XmlMaterialProfile/XmlMaterialProfile.py
@@ -223,8 +223,8 @@ class XmlMaterialProfile(InstanceContainer):
for instance in self.findInstances():
self._addSettingElement(builder, instance)
- machine_container_map = {} # type: Dict[str, InstanceContainer]
- machine_variant_map = {} # type: Dict[str, Dict[str, Any]]
+ machine_container_map = {} # type: Dict[str, InstanceContainer]
+ machine_variant_map = {} # type: Dict[str, Dict[str, Any]]
container_tree = ContainerTree.getInstance()
@@ -246,10 +246,7 @@ class XmlMaterialProfile(InstanceContainer):
if not variant_name:
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,
+ variant_dict = {"variant_type": container.getMetaDataEntry("hardware_type", str(VariantType.NOZZLE)),
"material_container": container}
machine_variant_map[definition_id][variant_name] = variant_dict
@@ -284,8 +281,7 @@ class XmlMaterialProfile(InstanceContainer):
# Find all hotend sub-profiles corresponding to this material and machine and add them to this profile.
buildplate_dict = {} # type: Dict[str, Any]
for variant_name, variant_dict in machine_variant_map[definition_id].items():
- variant_type = variant_dict["variant_node"].getMetaDataEntry("hardware_type", str(VariantType.NOZZLE))
- variant_type = VariantType(variant_type)
+ variant_type = VariantType(variant_dict["variant_type"])
if variant_type == VariantType.NOZZLE:
# The hotend identifier is not the containers name, but its "name".
builder.start("hotend", {"id": variant_name})