diff options
author | Jaime van Kessel <nallath@gmail.com> | 2017-06-12 14:53:35 +0300 |
---|---|---|
committer | Jaime van Kessel <nallath@gmail.com> | 2017-06-12 14:53:35 +0300 |
commit | a306b4dadacf6361d084afe95ea88e19b9a01014 (patch) | |
tree | a8d567d8038d7abae256cdacdc20fdd007fdad5d /cura/QualityManager.py | |
parent | 82224c0ed0800e439342bb1f2b70d3762b239cb9 (diff) |
We now properly fall back if no basic material is found
CURA-3911
Diffstat (limited to 'cura/QualityManager.py')
-rw-r--r-- | cura/QualityManager.py | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/cura/QualityManager.py b/cura/QualityManager.py index ecea46a352..f13181ef06 100644 --- a/cura/QualityManager.py +++ b/cura/QualityManager.py @@ -101,12 +101,11 @@ class QualityManager: if quality_type:
criteria["quality_type"] = quality_type
result = self._getFilteredContainersForStack(machine_definition, material_containers, **criteria)
-
# Fall back to using generic materials and qualities if nothing could be found.
if not result and material_containers and len(material_containers) == 1:
basic_materials = self._getBasicMaterials(material_containers[0])
- result = self._getFilteredContainersForStack(machine_definition, basic_materials, **criteria)
-
+ if basic_materials:
+ result = self._getFilteredContainersForStack(machine_definition, basic_materials, **criteria)
return result[0] if result else None
## Find all suitable qualities for a combination of machine and material.
@@ -179,7 +178,6 @@ class QualityManager: definition_id = material_container.getDefinition().getMetaDataEntry("quality_definition", material_container.getDefinition().getId())
else:
definition_id = "fdmprinter"
-
if base_material:
# There is a basic material specified
criteria = { "type": "material", "name": base_material, "definition": definition_id }
@@ -226,13 +224,13 @@ class QualityManager: # Stick the material IDs in a set
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 = []
@@ -241,6 +239,7 @@ class QualityManager: if filter_by_material and container.getMetaDataEntry("material") not in material_ids and "global_quality" not in kwargs:
continue
result.append(container)
+
return result
## Get the parent machine definition of a machine definition.
|