mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-12 17:27:51 -06:00
Replace fix for 'None' materials
This was fixed in 4.0 and accidentally got reverted when merging another branch in. Contributes to CL-1160
This commit is contained in:
parent
4dab33d41b
commit
0f357e1078
1 changed files with 11 additions and 0 deletions
|
@ -609,6 +609,17 @@ class ClusterUM3OutputDevice(NetworkedPrinterOutputDevice):
|
||||||
material_manager = CuraApplication.getInstance().getMaterialManager()
|
material_manager = CuraApplication.getInstance().getMaterialManager()
|
||||||
material_group_list = material_manager.getMaterialGroupListByGUID(material_data["guid"])
|
material_group_list = material_manager.getMaterialGroupListByGUID(material_data["guid"])
|
||||||
|
|
||||||
|
# This can happen if the connected machine has no material in one or more extruders (if GUID is empty), or the
|
||||||
|
# material is unknown to Cura, so we should return an "empty" or "unknown" material model.
|
||||||
|
if material_group_list is None:
|
||||||
|
material_name = "Empty" if len(material_data["guid"]) == 0 else "Unknown"
|
||||||
|
return MaterialOutputModel(guid = material_data["guid"],
|
||||||
|
type = material_data.get("type", ""),
|
||||||
|
color = material_data.get("color", ""),
|
||||||
|
brand = material_data.get("brand", ""),
|
||||||
|
name = material_data.get("name", material_name)
|
||||||
|
)
|
||||||
|
|
||||||
# Sort the material groups by "is_read_only = True" first, and then the name alphabetically.
|
# Sort the material groups by "is_read_only = True" first, and then the name alphabetically.
|
||||||
read_only_material_group_list = list(filter(lambda x: x.is_read_only, material_group_list))
|
read_only_material_group_list = list(filter(lambda x: x.is_read_only, material_group_list))
|
||||||
non_read_only_material_group_list = list(filter(lambda x: not x.is_read_only, material_group_list))
|
non_read_only_material_group_list = list(filter(lambda x: not x.is_read_only, material_group_list))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue