Create intent nodes based on the selected quality type

Previously it would use the material type from the material, but since
the material from the node can be different to that of the quality, we need
to use the one from quality instead (This is due to the fallback system)

CURA-6807
This commit is contained in:
Jaime van Kessel 2019-09-24 11:57:50 +02:00
parent 56c7fb9f7d
commit f469b99471
No known key found for this signature in database
GPG Key ID: 3710727397403C91

View File

@ -23,15 +23,17 @@ class QualityNode(ContainerNode):
my_metadata = ContainerRegistry.getInstance().findContainersMetadata(id = container_id)[0] my_metadata = ContainerRegistry.getInstance().findContainersMetadata(id = container_id)[0]
self.quality_type = my_metadata["quality_type"] self.quality_type = my_metadata["quality_type"]
# The material type of the parent doesn't need to be the same as this due to generic fallbacks.
self._material = my_metadata.get("material")
self._loadAll() self._loadAll()
def _loadAll(self) -> None: def _loadAll(self) -> None:
container_registry = ContainerRegistry.getInstance() container_registry = ContainerRegistry.getInstance()
# Find all intent profiles that fit the current configuration. # Find all intent profiles that fit the current configuration.
from cura.Machines.MachineNode import MachineNode from cura.Machines.MachineNode import MachineNode
if not isinstance(self.parent, MachineNode): # Not a global profile. if not isinstance(self.parent, MachineNode): # Not a global profile.
for intent in container_registry.findInstanceContainersMetadata(type = "intent", definition = self.parent.variant.machine.quality_definition, variant = self.parent.variant.variant_name, material = self.parent.base_file, quality_type = self.quality_type): for intent in container_registry.findInstanceContainersMetadata(type = "intent", definition = self.parent.variant.machine.quality_definition, variant = self.parent.variant.variant_name, material = self._material, quality_type = self.quality_type):
self.intents[intent["id"]] = IntentNode(intent["id"], quality = self) self.intents[intent["id"]] = IntentNode(intent["id"], quality = self)
self.intents["empty_intent"] = IntentNode("empty_intent", quality = self) self.intents["empty_intent"] = IntentNode("empty_intent", quality = self)