mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-11 08:47:50 -06:00
Delay adding global stack when creating new machine until after extruder stacks are created - CURA-4828
This commit is contained in:
parent
d03ecf3cba
commit
e4a111dd2e
1 changed files with 8 additions and 6 deletions
|
@ -63,6 +63,7 @@ class CuraStackBuilder:
|
||||||
next_stack = new_global_stack
|
next_stack = new_global_stack
|
||||||
)
|
)
|
||||||
new_global_stack.addExtruder(new_extruder)
|
new_global_stack.addExtruder(new_extruder)
|
||||||
|
registry.addContainer(new_extruder)
|
||||||
else:
|
else:
|
||||||
# create extruder stack for each found extruder definition
|
# create extruder stack for each found extruder definition
|
||||||
for extruder_definition in registry.findDefinitionContainers(machine = machine_definition.id):
|
for extruder_definition in registry.findDefinitionContainers(machine = machine_definition.id):
|
||||||
|
@ -81,6 +82,11 @@ class CuraStackBuilder:
|
||||||
next_stack = new_global_stack
|
next_stack = new_global_stack
|
||||||
)
|
)
|
||||||
new_global_stack.addExtruder(new_extruder)
|
new_global_stack.addExtruder(new_extruder)
|
||||||
|
registry.addContainer(new_extruder)
|
||||||
|
|
||||||
|
# Register the global stack after the extruder stacks are created. This prevents the registry from adding another
|
||||||
|
# extruder stack because the global stack didn't have one yet (which is enforced since Cura 3.1).
|
||||||
|
registry.addContainer(new_global_stack)
|
||||||
|
|
||||||
return new_global_stack
|
return new_global_stack
|
||||||
|
|
||||||
|
@ -135,9 +141,7 @@ class CuraStackBuilder:
|
||||||
# Only add the created containers to the registry after we have set all the other
|
# Only add the created containers to the registry after we have set all the other
|
||||||
# properties. This makes the create operation more transactional, since any problems
|
# properties. This makes the create operation more transactional, since any problems
|
||||||
# setting properties will not result in incomplete containers being added.
|
# setting properties will not result in incomplete containers being added.
|
||||||
registry = ContainerRegistry.getInstance()
|
ContainerRegistry.getInstance().addContainer(user_container)
|
||||||
registry.addContainer(stack)
|
|
||||||
registry.addContainer(user_container)
|
|
||||||
|
|
||||||
return stack
|
return stack
|
||||||
|
|
||||||
|
@ -181,9 +185,7 @@ class CuraStackBuilder:
|
||||||
if "quality_changes" in kwargs:
|
if "quality_changes" in kwargs:
|
||||||
stack.setQualityChangesById(kwargs["quality_changes"])
|
stack.setQualityChangesById(kwargs["quality_changes"])
|
||||||
|
|
||||||
registry = ContainerRegistry.getInstance()
|
ContainerRegistry.getInstance().addContainer(user_container)
|
||||||
registry.addContainer(stack)
|
|
||||||
registry.addContainer(user_container)
|
|
||||||
|
|
||||||
return stack
|
return stack
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue