mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-05-07 03:39:06 +08:00
Remove material types that have no fallbacks from fallback_materials_map
CURA-5098
This commit is contained in:
parent
4d5013d3ad
commit
5ca4203940
@ -107,6 +107,7 @@ class MaterialManager(QObject):
|
|||||||
# Map #2
|
# Map #2
|
||||||
# Lookup table for material type -> fallback material metadata, only for read-only materials
|
# Lookup table for material type -> fallback material metadata, only for read-only materials
|
||||||
grouped_by_type_dict = dict()
|
grouped_by_type_dict = dict()
|
||||||
|
material_types_without_fallback = set()
|
||||||
for root_material_id, material_node in self._material_group_map.items():
|
for root_material_id, material_node in self._material_group_map.items():
|
||||||
if not self._container_registry.isReadOnly(root_material_id):
|
if not self._container_registry.isReadOnly(root_material_id):
|
||||||
continue
|
continue
|
||||||
@ -114,6 +115,7 @@ class MaterialManager(QObject):
|
|||||||
if material_type not in grouped_by_type_dict:
|
if material_type not in grouped_by_type_dict:
|
||||||
grouped_by_type_dict[material_type] = {"generic": None,
|
grouped_by_type_dict[material_type] = {"generic": None,
|
||||||
"others": []}
|
"others": []}
|
||||||
|
material_types_without_fallback.add(material_type)
|
||||||
brand = material_node.root_material_node.metadata["brand"]
|
brand = material_node.root_material_node.metadata["brand"]
|
||||||
if brand.lower() == "generic":
|
if brand.lower() == "generic":
|
||||||
to_add = True
|
to_add = True
|
||||||
@ -123,6 +125,10 @@ class MaterialManager(QObject):
|
|||||||
to_add = False # don't add if it's not the default diameter
|
to_add = False # don't add if it's not the default diameter
|
||||||
if to_add:
|
if to_add:
|
||||||
grouped_by_type_dict[material_type] = material_node.root_material_node.metadata
|
grouped_by_type_dict[material_type] = material_node.root_material_node.metadata
|
||||||
|
material_types_without_fallback.remove(material_type)
|
||||||
|
# Remove the materials that have no fallback materials
|
||||||
|
for material_type in material_types_without_fallback:
|
||||||
|
del grouped_by_type_dict[material_type]
|
||||||
self._fallback_materials_map = grouped_by_type_dict
|
self._fallback_materials_map = grouped_by_type_dict
|
||||||
|
|
||||||
# Map #3
|
# Map #3
|
||||||
|
Loading…
x
Reference in New Issue
Block a user