diff options
author | Lipu Fei <lipu.fei815@gmail.com> | 2017-06-01 14:26:43 +0300 |
---|---|---|
committer | Lipu Fei <lipu.fei815@gmail.com> | 2017-06-01 14:26:45 +0300 |
commit | 6bcc1c296d40436d3cbb3f3c2bb7c86e9d05ccb2 (patch) | |
tree | a7148b8ec8f8d368665d9311d14a2f8163d90b06 /cura/QualityManager.py | |
parent | 654b9cfa1cc351082684e3cbc3ffbbe20dffcf7c (diff) |
Do not override filter_by_material if no material is found
CURA-3884
We rely on the machine to decide whether it needs machine specific
materials, so we don't override the filter_by_material flag when
looking for quality profiles for a material.
Diffstat (limited to 'cura/QualityManager.py')
-rw-r--r-- | cura/QualityManager.py | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/cura/QualityManager.py b/cura/QualityManager.py index e4a09ca8ea..ecea46a352 100644 --- a/cura/QualityManager.py +++ b/cura/QualityManager.py @@ -202,7 +202,11 @@ class QualityManager: if quality_definition_id is not None:
machine_definition = ContainerRegistry.getInstance().findDefinitionContainers(id=quality_definition_id)[0]
+ # for convenience
if material_containers is None:
+ material_containers = []
+
+ if not material_containers:
active_stacks = ExtruderManager.getInstance().getActiveGlobalAndExtruderStacks()
if active_stacks:
material_containers = [stack.material for stack in active_stacks]
@@ -219,24 +223,22 @@ class QualityManager: filter_by_material = whole_machine_definition.getMetaDataEntry("has_materials")
else:
criteria["definition"] = "fdmprinter"
- material_ids = set()
+
# Stick the material IDs in a set
- if material_containers is None or len(material_containers) == 0:
- filter_by_material = False
- else:
- for material_instance in material_containers:
- if material_instance is not None:
- # Add the parent material too.
- for basic_material in self._getBasicMaterials(material_instance):
- material_ids.add(basic_material.getId())
- material_ids.add(material_instance.getId())
+ material_ids = set()
+ for material_instance in material_containers:
+ if material_instance is not None:
+ # Add the parent material too.
+ for basic_material in self._getBasicMaterials(material_instance):
+ material_ids.add(basic_material.getId())
+ material_ids.add(material_instance.getId())
containers = ContainerRegistry.getInstance().findInstanceContainers(**criteria)
result = []
for container in containers:
# If the machine specifies we should filter by material, exclude containers that do not match any active material.
- if filter_by_material and container.getMetaDataEntry("material") not in material_ids and not "global_quality" in kwargs:
+ if filter_by_material and container.getMetaDataEntry("material") not in material_ids and "global_quality" not in kwargs:
continue
result.append(container)
return result
|