mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-08 23:46:22 -06:00
Create container stacks when loading older project file - CURA-4482
This commit is contained in:
parent
743285f426
commit
97421ecf58
2 changed files with 11 additions and 6 deletions
|
@ -402,9 +402,9 @@ class CuraContainerRegistry(ContainerRegistry):
|
||||||
def _registerSingleExtrusionMachinesExtruderStacks(self):
|
def _registerSingleExtrusionMachinesExtruderStacks(self):
|
||||||
machines = ContainerRegistry.getInstance().findContainerStacks(machine_extruder_trains = {"0": "fdmextruder"})
|
machines = ContainerRegistry.getInstance().findContainerStacks(machine_extruder_trains = {"0": "fdmextruder"})
|
||||||
for machine in machines:
|
for machine in machines:
|
||||||
self._addExtruderStackForSingleExtrusionMachine(machine, "fdmextruder")
|
self.addExtruderStackForSingleExtrusionMachine(machine, "fdmextruder")
|
||||||
|
|
||||||
def _addExtruderStackForSingleExtrusionMachine(self, machine, extruder_id):
|
def addExtruderStackForSingleExtrusionMachine(self, machine, extruder_id):
|
||||||
new_extruder_id = extruder_id
|
new_extruder_id = extruder_id
|
||||||
extruder_stack = None
|
extruder_stack = None
|
||||||
|
|
||||||
|
|
|
@ -739,9 +739,15 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
|
||||||
|
|
||||||
# Create a new definition_changes container if it was empty
|
# Create a new definition_changes container if it was empty
|
||||||
if stack.definitionChanges == self._container_registry.getEmptyInstanceContainer():
|
if stack.definitionChanges == self._container_registry.getEmptyInstanceContainer():
|
||||||
stack.setDefinitionChanges(CuraStackBuilder.createDefinitionChangesContainer(stack, stack._id + "_settings"))
|
stack.setDefinitionChanges(CuraStackBuilder.createDefinitionChangesContainer(stack, stack.getId() + "_settings"))
|
||||||
if global_stack.getProperty("machine_extruder_count", "value") > 1:
|
|
||||||
extruder_stacks.append(stack)
|
extruder_stacks.append(stack)
|
||||||
|
|
||||||
|
# If not extruder stacks were saved in the project file (pre 3.1) create one manually
|
||||||
|
# We re-use the container registry's addExtruderStackForSingleExtrusionMachine method for this
|
||||||
|
if not extruder_stacks:
|
||||||
|
self._container_registry.addExtruderStackForSingleExtrusionMachine(global_stack, "fdmextruder")
|
||||||
|
|
||||||
except:
|
except:
|
||||||
Logger.logException("w", "We failed to serialize the stack. Trying to clean up.")
|
Logger.logException("w", "We failed to serialize the stack. Trying to clean up.")
|
||||||
# Something went really wrong. Try to remove any data that we added.
|
# Something went really wrong. Try to remove any data that we added.
|
||||||
|
@ -774,7 +780,6 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
|
||||||
for stack in [global_stack] + extruder_stacks:
|
for stack in [global_stack] + extruder_stacks:
|
||||||
stack.replaceContainer(_ContainerIndexes.Quality, empty_quality_container)
|
stack.replaceContainer(_ContainerIndexes.Quality, empty_quality_container)
|
||||||
|
|
||||||
#
|
|
||||||
# Replacing the old containers if resolve is "new".
|
# Replacing the old containers if resolve is "new".
|
||||||
# When resolve is "new", some containers will get renamed, so all the other containers that reference to those
|
# When resolve is "new", some containers will get renamed, so all the other containers that reference to those
|
||||||
# MUST get updated too.
|
# MUST get updated too.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue