From 6f77c8735c387c5b26cac22164a370a117094e04 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Thu, 22 Aug 2019 15:37:05 +0200 Subject: [PATCH] Don't load any materials for printers that don't have them For instance the Ultimaker 2 shouldn't display any materials. Contributes to issue CURA-6600. --- cura/Machines/MachineNode.py | 1 + cura/Machines/VariantNode.py | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/cura/Machines/MachineNode.py b/cura/Machines/MachineNode.py index 5fd01ac2d5..7cf3e71c05 100644 --- a/cura/Machines/MachineNode.py +++ b/cura/Machines/MachineNode.py @@ -31,6 +31,7 @@ class MachineNode(ContainerNode): # Some of the metadata is cached upon construction here. # ONLY DO THAT FOR METADATA THAT DOESN'T CHANGE DURING RUNTIME! # Otherwise you need to keep it up-to-date during runtime. + self.has_materials = parseBool(my_metadata.get("has_materials", "true")) self.has_machine_materials = parseBool(my_metadata.get("has_machine_materials", "false")) self.has_machine_quality = parseBool(my_metadata.get("has_machine_quality", "false")) self.quality_definition = my_metadata.get("quality_definition", container_id) diff --git a/cura/Machines/VariantNode.py b/cura/Machines/VariantNode.py index 63134a55f4..d4b9831f66 100644 --- a/cura/Machines/VariantNode.py +++ b/cura/Machines/VariantNode.py @@ -38,6 +38,10 @@ class VariantNode(ContainerNode): ## (Re)loads all materials under this variant. def _loadAll(self): container_registry = ContainerRegistry.getInstance() + + if not self.machine.has_materials: + return # There should not be any materials loaded for this printer. + # Find all the materials for this variant's name. if not self.machine.has_machine_materials: # Printer has no specific materials. Look for all fdmprinter materials. materials = container_registry.findInstanceContainersMetadata(type = "material", definition = "fdmprinter") # These are ONLY the base materials.