mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-13 09:47:50 -06:00
Prefer a read-only material in findDefaultMaterial.
Contributes to CURA-4243.
This commit is contained in:
parent
41cde7c7f4
commit
ce78bddfbb
1 changed files with 10 additions and 4 deletions
|
@ -487,12 +487,18 @@ class CuraContainerStack(ContainerStack):
|
|||
search_criteria.pop("name", None)
|
||||
materials = ContainerRegistry.getInstance().findInstanceContainers(**search_criteria)
|
||||
|
||||
if materials:
|
||||
return materials[0]
|
||||
|
||||
if not materials:
|
||||
Logger.log("w", "Could not find a valid material for stack {stack}", stack = self.id)
|
||||
return None
|
||||
|
||||
for material in materials:
|
||||
# Prefer a read-only material
|
||||
if ContainerRegistry.getInstance().isReadOnly(material.getId()):
|
||||
return material
|
||||
|
||||
return materials[0]
|
||||
|
||||
|
||||
## Find the quality that should be used as "default" quality.
|
||||
#
|
||||
# This will search for qualities that match the current definition and pick the preferred one,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue