mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-07 15:07:28 -06:00
Fix selection for intents if only one of the extruders has an intent
CURA-6598
This commit is contained in:
parent
49276db073
commit
884a3ea819
2 changed files with 22 additions and 3 deletions
|
@ -66,12 +66,26 @@ class IntentModel(ListModel):
|
||||||
|
|
||||||
container_tree = ContainerTree.getInstance()
|
container_tree = ContainerTree.getInstance()
|
||||||
machine_node = container_tree.machines[global_stack.definition.getId()]
|
machine_node = container_tree.machines[global_stack.definition.getId()]
|
||||||
active_extruder = ExtruderManager.getInstance().getActiveExtruderStack()
|
|
||||||
|
# We can't just look at the active extruder, since it is possible for only one extruder to have an intent
|
||||||
|
# and the other extruders have no intent (eg, default). It is not possible for one extruder to have intent A and
|
||||||
|
# the other to have B.
|
||||||
|
# So we will use the first extruder that we find that has an intent that is not default as the "active" extruder
|
||||||
|
|
||||||
|
active_extruder = None
|
||||||
|
for extruder in global_stack.extruderList:
|
||||||
|
if extruder.intent.getMetaDataEntry("intent_category", "default") == "default":
|
||||||
|
if active_extruder is None:
|
||||||
|
active_extruder = extruder # If there is no extruder found and the intent is default, use that.
|
||||||
|
else: # We found an intent, use that extruder as "active"
|
||||||
|
active_extruder = extruder
|
||||||
|
|
||||||
if not active_extruder:
|
if not active_extruder:
|
||||||
return
|
return
|
||||||
active_variant_name = active_extruder.variant.getMetaDataEntry("name")
|
active_variant_name = active_extruder.variant.getMetaDataEntry("name")
|
||||||
active_variant_node = machine_node.variants[active_variant_name]
|
active_variant_node = machine_node.variants[active_variant_name]
|
||||||
active_material_node = active_variant_node.materials[active_extruder.material.getMetaDataEntry("base_file")]
|
active_material_node = active_variant_node.materials[active_extruder.material.getMetaDataEntry("base_file")]
|
||||||
|
|
||||||
layer_heights_added = []
|
layer_heights_added = []
|
||||||
for quality_id, quality_node in active_material_node.qualities.items():
|
for quality_id, quality_node in active_material_node.qualities.items():
|
||||||
if quality_node.quality_type not in quality_groups: # Don't add the empty quality type (or anything else that would crash, defensively).
|
if quality_node.quality_type not in quality_groups: # Don't add the empty quality type (or anything else that would crash, defensively).
|
||||||
|
|
|
@ -615,10 +615,15 @@ class MachineManager(QObject):
|
||||||
|
|
||||||
@pyqtProperty(str, notify=activeIntentChanged)
|
@pyqtProperty(str, notify=activeIntentChanged)
|
||||||
def activeIntentCategory(self):
|
def activeIntentCategory(self):
|
||||||
|
global_container_stack = cura.CuraApplication.CuraApplication.getInstance().getGlobalContainerStack()
|
||||||
|
|
||||||
if not self._active_container_stack:
|
if not global_container_stack:
|
||||||
return ""
|
return ""
|
||||||
intent_category = self._active_container_stack.intent.getMetaDataEntry("intent_category", "default")
|
intent_category = "default"
|
||||||
|
for extruder in global_container_stack.extruderList:
|
||||||
|
category = extruder.intent.getMetaDataEntry("intent_category", "default")
|
||||||
|
if category != "default" and category != intent_category:
|
||||||
|
intent_category = category
|
||||||
return intent_category
|
return intent_category
|
||||||
|
|
||||||
## Returns whether there is anything unsupported in the current set-up.
|
## Returns whether there is anything unsupported in the current set-up.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue