mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-12-05 16:51:12 -07:00
Fix merge conflicts after multi-buildplate refactor
This commit is contained in:
commit
c7c989f2a0
87 changed files with 12891 additions and 740 deletions
|
|
@ -14,6 +14,7 @@ from UM.Decorators import override
|
|||
from UM.Settings.ContainerRegistry import ContainerRegistry
|
||||
from UM.Settings.ContainerStack import ContainerStack
|
||||
from UM.Settings.InstanceContainer import InstanceContainer
|
||||
from UM.Settings.SettingInstance import SettingInstance
|
||||
from UM.Application import Application
|
||||
from UM.Logger import Logger
|
||||
from UM.Message import Message
|
||||
|
|
@ -224,7 +225,7 @@ class CuraContainerRegistry(ContainerRegistry):
|
|||
# This is assumed to be the global profile
|
||||
profile_id = (global_container_stack.getBottom().getId() + "_" + name_seed).lower().replace(" ", "_")
|
||||
|
||||
elif len(machine_extruders) > profile_index:
|
||||
elif profile_index < len(machine_extruders) + 1:
|
||||
# This is assumed to be an extruder profile
|
||||
extruder_id = Application.getInstance().getMachineManager().getQualityDefinitionId(machine_extruders[profile_index - 1].getBottom())
|
||||
if not profile.getMetaDataEntry("extruder"):
|
||||
|
|
@ -430,11 +431,42 @@ class CuraContainerRegistry(ContainerRegistry):
|
|||
extruder_stack.setDefinition(extruder_definition)
|
||||
extruder_stack.addMetaDataEntry("position", extruder_definition.getMetaDataEntry("position"))
|
||||
|
||||
from cura.CuraApplication import CuraApplication
|
||||
|
||||
# create a new definition_changes container for the extruder stack
|
||||
definition_changes_id = self.uniqueName(extruder_stack.getId() + "_settings")
|
||||
definition_changes_name = definition_changes_id
|
||||
definition_changes = InstanceContainer(definition_changes_id)
|
||||
definition_changes.setName(definition_changes_name)
|
||||
definition_changes.addMetaDataEntry("setting_version", CuraApplication.SettingVersion)
|
||||
definition_changes.addMetaDataEntry("type", "definition_changes")
|
||||
definition_changes.addMetaDataEntry("definition", extruder_definition.getId())
|
||||
|
||||
# move definition_changes settings if exist
|
||||
for setting_key in definition_changes.getAllKeys():
|
||||
if machine.definition.getProperty(setting_key, "settable_per_extruder"):
|
||||
setting_value = machine.definitionChanges.getProperty(setting_key, "value")
|
||||
if setting_value is not None:
|
||||
# move it to the extruder stack's definition_changes
|
||||
setting_definition = machine.getSettingDefinition(setting_key)
|
||||
new_instance = SettingInstance(setting_definition, definition_changes)
|
||||
new_instance.setProperty("value", setting_value)
|
||||
new_instance.resetState() # Ensure that the state is not seen as a user state.
|
||||
definition_changes.addInstance(new_instance)
|
||||
definition_changes.setDirty(True)
|
||||
|
||||
machine.definitionChanges.removeInstance(setting_key, postpone_emit = True)
|
||||
|
||||
self.addContainer(definition_changes)
|
||||
extruder_stack.setDefinitionChanges(definition_changes)
|
||||
|
||||
# create empty user changes container otherwise
|
||||
user_container = InstanceContainer(extruder_stack.id + "_user")
|
||||
user_container_id = self.uniqueName(extruder_stack.getId() + "_user")
|
||||
user_container_name = user_container_id
|
||||
user_container = InstanceContainer(user_container_id)
|
||||
user_container.setName(user_container_name)
|
||||
user_container.addMetaDataEntry("type", "user")
|
||||
user_container.addMetaDataEntry("machine", extruder_stack.getId())
|
||||
from cura.CuraApplication import CuraApplication
|
||||
user_container.addMetaDataEntry("setting_version", CuraApplication.SettingVersion)
|
||||
user_container.setDefinition(machine.definition.getId())
|
||||
|
||||
|
|
@ -444,7 +476,15 @@ class CuraContainerRegistry(ContainerRegistry):
|
|||
for user_setting_key in machine.userChanges.getAllKeys():
|
||||
settable_per_extruder = machine.getProperty(user_setting_key, "settable_per_extruder")
|
||||
if settable_per_extruder:
|
||||
user_container.addInstance(machine.userChanges.getInstance(user_setting_key))
|
||||
setting_value = machine.getProperty(user_setting_key, "value")
|
||||
|
||||
setting_definition = machine.getSettingDefinition(user_setting_key)
|
||||
new_instance = SettingInstance(setting_definition, definition_changes)
|
||||
new_instance.setProperty("value", setting_value)
|
||||
new_instance.resetState() # Ensure that the state is not seen as a user state.
|
||||
user_container.addInstance(new_instance)
|
||||
user_container.setDirty(True)
|
||||
|
||||
machine.userChanges.removeInstance(user_setting_key, postpone_emit = True)
|
||||
|
||||
self.addContainer(user_container)
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ from UM.MimeTypeDatabase import MimeType, MimeTypeDatabase
|
|||
from UM.Settings.ContainerStack import ContainerStack
|
||||
from UM.Settings.ContainerRegistry import ContainerRegistry
|
||||
from UM.Settings.Interfaces import ContainerInterface, PropertyEvaluationContext
|
||||
from UM.Settings.SettingInstance import SettingInstance
|
||||
|
||||
from . import Exceptions
|
||||
from .CuraContainerStack import CuraContainerStack
|
||||
|
|
@ -16,6 +17,11 @@ from .ExtruderManager import ExtruderManager
|
|||
if TYPE_CHECKING:
|
||||
from cura.Settings.GlobalStack import GlobalStack
|
||||
|
||||
|
||||
_EXTRUDER_SPECIFIC_DEFINITION_CHANGES_SETTINGS = ["machine_nozzle_size",
|
||||
"material_diameter"]
|
||||
|
||||
|
||||
## Represents an Extruder and its related containers.
|
||||
#
|
||||
#
|
||||
|
|
@ -39,6 +45,29 @@ class ExtruderStack(CuraContainerStack):
|
|||
# For backward compatibility: Register the extruder with the Extruder Manager
|
||||
ExtruderManager.getInstance().registerExtruder(self, stack.id)
|
||||
|
||||
# Now each machine will have at least one extruder stack. If this is the first extruder, the extruder-specific
|
||||
# settings such as nozzle size and material diameter should be moved from the machine's definition_changes to
|
||||
# the this extruder's definition_changes.
|
||||
#
|
||||
# We do this here because it is tooooo expansive to do it in the version upgrade: During the version upgrade,
|
||||
# when we are upgrading a definition_changes container file, there is NO guarantee that other files such as
|
||||
# machine an extruder stack files are upgraded before this, so we cannot read those files assuming they are in
|
||||
# the latest format.
|
||||
if self.getMetaDataEntry("position") == "0":
|
||||
for key in _EXTRUDER_SPECIFIC_DEFINITION_CHANGES_SETTINGS:
|
||||
setting_value = stack.definitionChanges.getProperty(key, "value")
|
||||
if setting_value is None:
|
||||
continue
|
||||
|
||||
setting_definition = stack.getSettingDefinition(key)
|
||||
new_instance = SettingInstance(setting_definition, self.definitionChanges)
|
||||
new_instance.setProperty("value", setting_value)
|
||||
new_instance.resetState() # Ensure that the state is not seen as a user state.
|
||||
self.definitionChanges.addInstance(new_instance)
|
||||
self.definitionChanges.setDirty(True)
|
||||
|
||||
stack.definitionChanges.removeInstance(key, postpone_emit = True)
|
||||
|
||||
@override(ContainerStack)
|
||||
def getNextStack(self) -> Optional["GlobalStack"]:
|
||||
return super().getNextStack()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue