From 649ca99fe0561521ac081d162432436bd949d1f6 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 1 Oct 2019 17:28:06 +0200 Subject: [PATCH] Only match on printer-specific materials, not variant-specific too If a submaterial doesn't exist for the current variant node but it does exist for a different variant node, then it would not be found in the variant-specific materials and then would be looked up in the printer-specific materials. It then depends on the order in which findInstanceContainersMetadata returns things for whether the actual printer-specific material is selected or a different variant-specific material is selected. No longer now, because the variant name is specified to be absent so it may not match on variant-specific profiles any more. Maybe this even gives us a small performance gain when combining these dictionaries, since there are now like 80% fewer profiles in that query. Contributes to issue CURA-6831. --- cura/Machines/VariantNode.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cura/Machines/VariantNode.py b/cura/Machines/VariantNode.py index 2e31399397..c8593f9eba 100644 --- a/cura/Machines/VariantNode.py +++ b/cura/Machines/VariantNode.py @@ -48,7 +48,7 @@ class VariantNode(ContainerNode): # Find all the materials for this variant's name. else: # Printer has its own material profiles. Look for material profiles with this printer's definition. base_materials = container_registry.findInstanceContainersMetadata(type = "material", definition = "fdmprinter") - printer_specific_materials = container_registry.findInstanceContainersMetadata(type = "material", definition = self.machine.container_id) + printer_specific_materials = container_registry.findInstanceContainersMetadata(type = "material", definition = self.machine.container_id, variant_name = None) variant_specific_materials = container_registry.findInstanceContainersMetadata(type = "material", definition = self.machine.container_id, variant_name = self.variant_name) # If empty_variant, this won't return anything. materials_per_base_file = {material["base_file"]: material for material in base_materials} materials_per_base_file.update({material["base_file"]: material for material in printer_specific_materials}) # Printer-specific profiles override global ones.