Don't add materials forbidden by the printer definition

Contributes to issue CURA-6600.
This commit is contained in:
Ghostkeeper 2019-08-06 15:21:52 +02:00
parent 3ef0b4292d
commit 24346fc8e3
No known key found for this signature in database
GPG key ID: 86BEF881AE2CF276
2 changed files with 8 additions and 1 deletions

View file

@ -45,6 +45,9 @@ class VariantNode(ContainerNode):
materials_per_base_file.update({material["base_file"]: material for material in variant_specific_materials}) # Variant-specific profiles override all of those.
materials = materials_per_base_file.values()
for excluded_material in self.parent.exclude_materials:
del materials[excluded_material]
for material in materials:
base_file = material["base_file"]
if base_file not in self.materials:
@ -60,6 +63,8 @@ class VariantNode(ContainerNode):
if material_definition != "fdmprinter":
return
base_file = container.getMetaDataEntry("base_file")
if base_file in self.parent.exclude_materials:
return # Material is forbidden for this printer.
if base_file not in self.materials: # Completely new base file. Always better than not having a file as long as it matches our set-up.
if material_definition != "fdmprinter" and material_definition != self.parent.container_id:
return