Merge branch 'feature_intent_container_tree' of https://github.com/Ultimaker/Cura into feature_intent_container_tree

This commit is contained in:
Remco Burema 2019-08-27 15:50:21 +02:00
commit c333e980dc
7 changed files with 97 additions and 29 deletions

View file

@ -223,10 +223,10 @@ 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]]
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,12 @@ 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
variant_dict = {"variant_type": container.getMetaDataEntry("hardware_type", str(VariantType.NOZZLE)),
"material_container": container}
machine_variant_map[definition_id][variant_name] = variant_dict
# Map machine human-readable names to IDs
product_id_map = self.getProductIdMap()
@ -285,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})