mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-19 04:37:51 -06:00
Always create a definition changes container for a newly created stack
CURA-4107 A newly created stack will have an empty definition changes container by default, but when a machine or extruder gets activate, Cura will create a definition changes container for it if it has an empty one. This lazy creation caused the problem when after Cura creates a multi-extrusion machine for the first time, switching to a different extruder tab will cause an extruder stack change, which eventually triggers an unnecessary auto-slice.
This commit is contained in:
parent
05879e0dfc
commit
792feaade6
1 changed files with 18 additions and 0 deletions
|
@ -93,6 +93,8 @@ class CuraStackBuilder:
|
|||
# assume the material and variant have already been set.
|
||||
if "definition_changes" in kwargs:
|
||||
stack.setDefinitionChangesById(kwargs["definition_changes"])
|
||||
else:
|
||||
stack.setDefinitionChanges(cls._createDefinitionChangesContainer(stack, new_stack_id + "_settings"))
|
||||
|
||||
if "variant" in kwargs:
|
||||
stack.setVariantById(kwargs["variant"])
|
||||
|
@ -140,6 +142,8 @@ class CuraStackBuilder:
|
|||
# assume the material and variant have already been set.
|
||||
if "definition_changes" in kwargs:
|
||||
stack.setDefinitionChangesById(kwargs["definition_changes"])
|
||||
else:
|
||||
stack.setDefinitionChanges(cls._createDefinitionChangesContainer(stack, new_stack_id + "_settings"))
|
||||
|
||||
if "variant" in kwargs:
|
||||
stack.setVariantById(kwargs["variant"])
|
||||
|
@ -158,3 +162,17 @@ class CuraStackBuilder:
|
|||
registry.addContainer(user_container)
|
||||
|
||||
return stack
|
||||
|
||||
@classmethod
|
||||
def _createDefinitionChangesContainer(cls, container_stack, container_name, container_index = None):
|
||||
from cura.CuraApplication import CuraApplication
|
||||
definition_changes_container = InstanceContainer(container_name)
|
||||
definition = container_stack.getBottom()
|
||||
definition_changes_container.setDefinition(definition)
|
||||
definition_changes_container.addMetaDataEntry("type", "definition_changes")
|
||||
definition_changes_container.addMetaDataEntry("setting_version", CuraApplication.SettingVersion)
|
||||
|
||||
ContainerRegistry.getInstance().addContainer(definition_changes_container)
|
||||
container_stack.definitionChanges = definition_changes_container
|
||||
|
||||
return definition_changes_container
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue