Browse Source

Copy values of global-only setting values to all extruders

CURA-1758
fieldOfView 8 years ago
parent
commit
97b3dd8f70
2 changed files with 17 additions and 3 deletions
  1. 10 3
      cura/Settings/ExtruderManager.py
  2. 7 0
      cura/Settings/MachineManager.py

+ 10 - 3
cura/Settings/ExtruderManager.py

@@ -112,8 +112,11 @@ class ExtruderManager(QObject):
             for extruder_train in extruder_trains:
                 self._extruder_trains[machine_id][extruder_train.getMetaDataEntry("position")] = extruder_train
 
-                # Ensure that the extruder train stacks are linked to global stack.
-                extruder_train.setNextStack(UM.Application.getInstance().getGlobalContainerStack())
+                # Make sure the next stack is a stack that contains only the machine definition
+                if not extruder_train.getNextStack():
+                    shallowStack = UM.Settings.ContainerStack(machine_id + "_shallow")
+                    shallowStack.addContainer(machine_definition)
+                    extruder_train.setNextStack(shallowStack)
                 changed = True
         if changed:
             self.extrudersChanged.emit(machine_id)
@@ -226,7 +229,11 @@ class ExtruderManager(QObject):
             container_registry.addContainer(user_profile)
         container_stack.addContainer(user_profile)
 
-        container_stack.setNextStack(UM.Application.getInstance().getGlobalContainerStack())
+        # Make sure the next stack is a stack that contains only the machine definition
+        if not container_stack.getNextStack():
+            shallowStack = UM.Settings.ContainerStack(machine_id + "_shallow")
+            shallowStack.addContainer(machine_definition)
+            container_stack.setNextStack(shallowStack)
 
         container_registry.addContainer(container_stack)
 

+ 7 - 0
cura/Settings/MachineManager.py

@@ -204,6 +204,13 @@ class MachineManager(QObject):
                 if self._active_container_stack.getProperty("extruder_nr", "value") == int(self._active_container_stack.getProperty(key, "global_inherits_stack")):
                     self._global_container_stack.getTop().setProperty(key, "value", self._active_container_stack.getProperty(key, "value"))
 
+                # Global-only setting values should be set on all extruders at once
+                if not self._global_container_stack.getProperty(key, "settable_per_extruder"):
+                    extruder_stacks = ExtruderManager.getInstance().getMachineExtruders(self._global_container_stack.getId())
+                    for extruder_stack in extruder_stacks:
+                        if extruder_stacks != self._active_container_stack:
+                            extruder_stack.getTop().setProperty(key, "value", self._active_container_stack.getProperty(key, "value"))
+
         if property_name == "validationState":
             if self._global_stack_valid:
                 changed_validation_state = self._active_container_stack.getProperty(key, property_name)