mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-09-13 16:03:14 +08:00
Prefer a read-only material in findDefaultMaterial.
Contributes to CURA-4243.
This commit is contained in:
parent
41cde7c7f4
commit
ce78bddfbb
@ -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…
x
Reference in New Issue
Block a user