Skip to content

Commit

Permalink
Adjusted code to filter out the abstract colors per machine.
Browse files Browse the repository at this point in the history
  • Loading branch information
pkuiper-ultimaker committed Sep 26, 2024
1 parent 437613d commit 99b6fd7
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
1 change: 1 addition & 0 deletions cura/Machines/MachineNode.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ def __init__(self, container_id: str) -> None:
self.preferred_variant_name = my_metadata.get("preferred_variant_name", "")
self.preferred_material = my_metadata.get("preferred_material", "")
self.preferred_quality_type = my_metadata.get("preferred_quality_type", "")
self.supports_abstract_color = parseBool(my_metadata.get("supports_abstract_color", "false"))

self._loadAll()

Expand Down
3 changes: 3 additions & 0 deletions cura/Machines/VariantNode.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ def _loadAll(self) -> None:
filtered_materials = [material for material in materials if not self.machine.isExcludedMaterialBaseFile(material["id"])]

for material in filtered_materials:
if material.get("abstract_color", False):
if not self.machine.supports_abstract_color:
continue # do not show abstract color profiles if the machine does not support them
base_file = material["base_file"]
if base_file not in self.materials:
self.materials[base_file] = MaterialNode(material["id"], variant = self)
Expand Down
5 changes: 0 additions & 5 deletions plugins/XmlMaterialProfile/XmlMaterialProfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -918,11 +918,6 @@ def deserializeMetadata(cls, serialized: str, container_id: str) -> List[Dict[st
base_metadata["properties"] = property_values
base_metadata["definition"] = "fdmprinter"

# Certain materials are loaded but should not be visible / selectable to the user.
# Only show abstract color profiles (Any Color) if the machine supports them
base_metadata["visible"] = (not base_metadata.get("abstract_color", False)
or base_metadata.get("supports_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
Expand Down

0 comments on commit 99b6fd7

Please sign in to comment.