mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-20 13:17:51 -06:00
Short circuit finding the extruders that are active
CURA-7106
This commit is contained in:
parent
f9b288f3c6
commit
7e8e051eb2
1 changed files with 8 additions and 0 deletions
|
@ -204,9 +204,12 @@ class ExtruderManager(QObject):
|
||||||
# If no extruders are registered in the extruder manager yet, return an empty array
|
# If no extruders are registered in the extruder manager yet, return an empty array
|
||||||
if len(self.extruderIds) == 0:
|
if len(self.extruderIds) == 0:
|
||||||
return []
|
return []
|
||||||
|
number_active_extruders = len([extruder for extruder in self.getActiveExtruderStacks() if extruder.isEnabled])
|
||||||
|
|
||||||
# Get the extruders of all printable meshes in the scene
|
# Get the extruders of all printable meshes in the scene
|
||||||
nodes = [node for node in DepthFirstIterator(scene_root) if node.isSelectable() and not node.callDecoration("isAntiOverhangMesh") and not node.callDecoration("isSupportMesh")] #type: ignore #Ignore type error because iter() should get called automatically by Python syntax.
|
nodes = [node for node in DepthFirstIterator(scene_root) if node.isSelectable() and not node.callDecoration("isAntiOverhangMesh") and not node.callDecoration("isSupportMesh")] #type: ignore #Ignore type error because iter() should get called automatically by Python syntax.
|
||||||
|
if not nodes:
|
||||||
|
return []
|
||||||
|
|
||||||
for node in nodes:
|
for node in nodes:
|
||||||
extruder_stack_id = node.callDecoration("getActiveExtruder")
|
extruder_stack_id = node.callDecoration("getActiveExtruder")
|
||||||
|
@ -215,6 +218,11 @@ class ExtruderManager(QObject):
|
||||||
extruder_stack_id = self.extruderIds["0"]
|
extruder_stack_id = self.extruderIds["0"]
|
||||||
used_extruder_stack_ids.add(extruder_stack_id)
|
used_extruder_stack_ids.add(extruder_stack_id)
|
||||||
|
|
||||||
|
if len(used_extruder_stack_ids) == number_active_extruders:
|
||||||
|
# We're already done. Stop looking.
|
||||||
|
# Especially with a lot of models on the buildplate, this will speed up things rather dramatically.
|
||||||
|
break
|
||||||
|
|
||||||
# Get whether any of them use support.
|
# Get whether any of them use support.
|
||||||
stack_to_use = node.callDecoration("getStack") # if there is a per-mesh stack, we use it
|
stack_to_use = node.callDecoration("getStack") # if there is a per-mesh stack, we use it
|
||||||
if not stack_to_use:
|
if not stack_to_use:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue