Don't show invisible materials in material selection

CURA-10953
This commit is contained in:
Jaime van Kessel 2023-09-07 13:24:40 +02:00
parent 331ff75315
commit 1a41f2650a
No known key found for this signature in database
GPG key ID: C85F7A3AF1BAA7C4
2 changed files with 7 additions and 0 deletions

View file

@ -44,6 +44,10 @@ class MaterialBrandsModel(BaseMaterialsModel):
if bool(container_node.getMetaDataEntry("removed", False)):
continue
# Ignore materials that are marked as not visible for whatever reason
if not bool(container_node.getMetaDataEntry("visible", True)):
continue
# Add brands we haven't seen yet to the dict, skipping generics
brand = container_node.getMetaDataEntry("brand", "")
if brand.lower() == "generic":

View file

@ -910,6 +910,9 @@ class XmlMaterialProfile(InstanceContainer):
base_metadata["properties"] = property_values
base_metadata["definition"] = "fdmprinter"
# Certain materials are loaded but should not be visible / selectable to the user.
base_metadata["visible"] = not property_values.get("abstract_color", False)
compatible_entries = data.iterfind("./um:settings/um:setting[@key='hardware compatible']", cls.__namespaces)
try:
common_compatibility = cls._parseCompatibleValue(next(compatible_entries).text) # type: ignore