From 2c63e33b015d2b0e47a1cf424d678f8268e025ad Mon Sep 17 00:00:00 2001 From: Paul Kuiper <46715907+pkuiper-ultimaker@users.noreply.github.com> Date: Thu, 26 Sep 2024 13:35:55 +0200 Subject: [PATCH 1/6] Prevent abstract color profiles to be filtered out for machines that support them. CURA-11634 --- plugins/XmlMaterialProfile/XmlMaterialProfile.py | 4 +++- resources/definitions/fdmprinter.def.json | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/plugins/XmlMaterialProfile/XmlMaterialProfile.py b/plugins/XmlMaterialProfile/XmlMaterialProfile.py index eb2bb2a788..6893a77ec5 100644 --- a/plugins/XmlMaterialProfile/XmlMaterialProfile.py +++ b/plugins/XmlMaterialProfile/XmlMaterialProfile.py @@ -919,7 +919,9 @@ class XmlMaterialProfile(InstanceContainer): base_metadata["definition"] = "fdmprinter" # Certain materials are loaded but should not be visible / selectable to the user. - base_metadata["visible"] = not base_metadata.get("abstract_color", False) + # 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: diff --git a/resources/definitions/fdmprinter.def.json b/resources/definitions/fdmprinter.def.json index 571d501212..88c5811430 100644 --- a/resources/definitions/fdmprinter.def.json +++ b/resources/definitions/fdmprinter.def.json @@ -16,7 +16,8 @@ "preferred_quality_type": "normal", "machine_extruder_trains": { "0": "fdmextruder" }, "supports_usb_connection": true, - "supports_network_connection": false + "supports_network_connection": false, + "supports_abstract_color": false }, "settings": { From 437613dcbaa3bb51ae26db1d32ab993914a6433b Mon Sep 17 00:00:00 2001 From: Paul Kuiper <46715907+pkuiper-ultimaker@users.noreply.github.com> Date: Thu, 26 Sep 2024 13:36:06 +0200 Subject: [PATCH 2/6] Prevent abstract color profiles to be filtered out for machines that support them. CURA-11634 --- resources/definitions/ultimaker_factor4.def.json | 1 + resources/definitions/ultimaker_s5.def.json | 1 + resources/definitions/ultimaker_s7.def.json | 1 + 3 files changed, 3 insertions(+) diff --git a/resources/definitions/ultimaker_factor4.def.json b/resources/definitions/ultimaker_factor4.def.json index 5945d3a262..9d9ff0e3df 100644 --- a/resources/definitions/ultimaker_factor4.def.json +++ b/resources/definitions/ultimaker_factor4.def.json @@ -42,6 +42,7 @@ "supports_material_export": true, "supports_network_connection": true, "supports_usb_connection": false, + "supports_abstract_color": true, "variants_name": "Print core", "weight": -1 }, diff --git a/resources/definitions/ultimaker_s5.def.json b/resources/definitions/ultimaker_s5.def.json index 3c35c84a00..eeb71e2701 100644 --- a/resources/definitions/ultimaker_s5.def.json +++ b/resources/definitions/ultimaker_s5.def.json @@ -51,6 +51,7 @@ "supports_material_export": true, "supports_network_connection": true, "supports_usb_connection": false, + "supports_abstract_color": true, "variants_name": "Print core", "weight": -2 }, diff --git a/resources/definitions/ultimaker_s7.def.json b/resources/definitions/ultimaker_s7.def.json index bb3f5a938d..ffff20184e 100644 --- a/resources/definitions/ultimaker_s7.def.json +++ b/resources/definitions/ultimaker_s7.def.json @@ -39,6 +39,7 @@ "supports_material_export": true, "supports_network_connection": true, "supports_usb_connection": false, + "supports_abstract_color": true, "variants_name": "Print core", "weight": -2 }, From 4c1b70db67b12dea64210ab68b58dc19ec80b9a5 Mon Sep 17 00:00:00 2001 From: pkuiper-ultimaker Date: Thu, 26 Sep 2024 11:37:32 +0000 Subject: [PATCH 3/6] Applied printer-linter format --- resources/definitions/ultimaker_factor4.def.json | 2 +- resources/definitions/ultimaker_s5.def.json | 2 +- resources/definitions/ultimaker_s7.def.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/resources/definitions/ultimaker_factor4.def.json b/resources/definitions/ultimaker_factor4.def.json index 9d9ff0e3df..909f180b09 100644 --- a/resources/definitions/ultimaker_factor4.def.json +++ b/resources/definitions/ultimaker_factor4.def.json @@ -39,10 +39,10 @@ "preferred_quality_type": "draft", "preferred_variant_name": "AA 0.4", "supported_actions": [ "DiscoverUM3Action" ], + "supports_abstract_color": true, "supports_material_export": true, "supports_network_connection": true, "supports_usb_connection": false, - "supports_abstract_color": true, "variants_name": "Print core", "weight": -1 }, diff --git a/resources/definitions/ultimaker_s5.def.json b/resources/definitions/ultimaker_s5.def.json index eeb71e2701..3bc3f7b50c 100644 --- a/resources/definitions/ultimaker_s5.def.json +++ b/resources/definitions/ultimaker_s5.def.json @@ -48,10 +48,10 @@ "preferred_variant_buildplate_name": "Glass", "preferred_variant_name": "AA 0.4", "supported_actions": [ "DiscoverUM3Action" ], + "supports_abstract_color": true, "supports_material_export": true, "supports_network_connection": true, "supports_usb_connection": false, - "supports_abstract_color": true, "variants_name": "Print core", "weight": -2 }, diff --git a/resources/definitions/ultimaker_s7.def.json b/resources/definitions/ultimaker_s7.def.json index ffff20184e..12cd714dd9 100644 --- a/resources/definitions/ultimaker_s7.def.json +++ b/resources/definitions/ultimaker_s7.def.json @@ -36,10 +36,10 @@ "preferred_variant_name": "AA 0.4", "quality_definition": "ultimaker_s5", "supported_actions": [ "DiscoverUM3Action" ], + "supports_abstract_color": true, "supports_material_export": true, "supports_network_connection": true, "supports_usb_connection": false, - "supports_abstract_color": true, "variants_name": "Print core", "weight": -2 }, From 99b6fd76166e0c84c064ae792baffb336b4a550c Mon Sep 17 00:00:00 2001 From: Paul Kuiper <46715907+pkuiper-ultimaker@users.noreply.github.com> Date: Thu, 26 Sep 2024 14:51:22 +0200 Subject: [PATCH 4/6] Adjusted code to filter out the abstract colors per machine. CURA-11634 --- cura/Machines/MachineNode.py | 1 + cura/Machines/VariantNode.py | 3 +++ plugins/XmlMaterialProfile/XmlMaterialProfile.py | 5 ----- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/cura/Machines/MachineNode.py b/cura/Machines/MachineNode.py index 67b8559b2e..3723cf4a7a 100644 --- a/cura/Machines/MachineNode.py +++ b/cura/Machines/MachineNode.py @@ -48,6 +48,7 @@ class MachineNode(ContainerNode): 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() diff --git a/cura/Machines/VariantNode.py b/cura/Machines/VariantNode.py index e037c9259d..a9dd8aa96b 100644 --- a/cura/Machines/VariantNode.py +++ b/cura/Machines/VariantNode.py @@ -63,6 +63,9 @@ class VariantNode(ContainerNode): 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) diff --git a/plugins/XmlMaterialProfile/XmlMaterialProfile.py b/plugins/XmlMaterialProfile/XmlMaterialProfile.py index 6893a77ec5..f756a79868 100644 --- a/plugins/XmlMaterialProfile/XmlMaterialProfile.py +++ b/plugins/XmlMaterialProfile/XmlMaterialProfile.py @@ -918,11 +918,6 @@ 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. - # 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 From d0080042ff5475604d71e3e2c148cebdabd863eb Mon Sep 17 00:00:00 2001 From: Erwan MATHIEU Date: Mon, 30 Sep 2024 13:10:19 +0200 Subject: [PATCH 5/6] Slightly simplify code CURA-11634 --- cura/Machines/VariantNode.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/cura/Machines/VariantNode.py b/cura/Machines/VariantNode.py index a9dd8aa96b..b9ff0b5fad 100644 --- a/cura/Machines/VariantNode.py +++ b/cura/Machines/VariantNode.py @@ -63,9 +63,8 @@ class VariantNode(ContainerNode): 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 + if material.get("abstract_color", False) and 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) From 2e7450bbf3a24cc26e8e3b0b4b69a4a5952d1e95 Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Wed, 2 Oct 2024 11:49:29 +0200 Subject: [PATCH 6/6] Also check for 'abstract color' (support) when a single material is added. Previously, this was only checked on 'load all' leading to some weird edge-ish cases where loading an any-color material on a printer that does support it, briefly also made it available on printers that (otherwise would, but) don't -- but only for that session. part of CURA-12159 (also refer to CURA-11634) --- cura/Machines/VariantNode.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cura/Machines/VariantNode.py b/cura/Machines/VariantNode.py index b9ff0b5fad..44f73ae2d7 100644 --- a/cura/Machines/VariantNode.py +++ b/cura/Machines/VariantNode.py @@ -128,6 +128,8 @@ class VariantNode(ContainerNode): return # We won't add any materials. material_definition = container.getMetaDataEntry("definition") + if (not self.machine.supports_abstract_color) and container.getMetaDataEntry("abstract_color", False): + return base_file = container.getMetaDataEntry("base_file") if self.machine.isExcludedMaterialBaseFile(base_file): return # Material is forbidden for this printer.