Browse Source

Fix providing of global_inherits_stack settings

I've rewritten this part and documented what each case catches. There is a base case which is not required any more since we removed the global tab, but I left it in for defense.

Contributes to issue CURA-2006.
Ghostkeeper 8 years ago
parent
commit
1c1bfbe114
1 changed files with 20 additions and 12 deletions
  1. 20 12
      resources/qml/Settings/SettingView.qml

+ 20 - 12
resources/qml/Settings/SettingView.qml

@@ -94,21 +94,29 @@ ScrollView
             {
                 target: provider
                 property: "containerStackId"
-                when: model.settable_per_extruder || (inheritStackProvider.properties.global_inherits_stack == -1 || inheritStackProvider.properties.global_inherits_stack == null)
+                when: {
+                    var now = model.settable_per_extruder || model.settable_per_mesh || (inheritStackProvider.properties.global_inherits_stack == null && inheritStackProvider.properties.global_inherits_stack < 0);
+                    return now;
+                }
                 value:
                 {
-                    if(inheritStackProvider.properties.global_inherits_stack == -1 || inheritStackProvider.properties.global_inherits_stack == null)
+                    if(!model.settable_per_extruder && !model.settable_per_mesh)
+                    {
+                        //Not settable per extruder, so we must pick global.
+                        return Cura.MachineManager.activeMachineId;
+                    }
+                    if(inheritStackProvider.properties.global_inherits_stack != null && inheritStackProvider.properties.global_inherits_stack >= 0)
+                    {
+                        //We have global_inherits_stack, so pick that stack.
+                        return ExtruderManager.extruderIds[String(inheritStackProvider.properties.global_inherits_stack)];
+                    }
+                    if(ExtruderManager.activeExtruderStackId)
                     {
-                        if( ExtruderManager.activeExtruderStackId)
-                        {
-                            return ExtruderManager.activeExtruderStackId
-                        }
-                        else
-                        {
-                            return Cura.MachineManager.activeMachineId
-                        }
+                        //We're on an extruder tab. Pick the current extruder.
+                        return ExtruderManager.activeExtruderStackId;
                     }
-                    return ExtruderManager.extruderIds[String(inheritStackProvider.properties.global_inherits_stack)]
+                    //No extruder tab is selected. Pick the global stack. Shouldn't happen any more since we removed the global tab.
+                    return Cura.MachineManager.activeMachineId;
                 }
             }
 
@@ -119,7 +127,7 @@ ScrollView
                 id: inheritStackProvider
                 containerStackId: Cura.MachineManager.activeMachineId
                 key: model.key
-                watchedProperties: [ "global_inherits_stack"]
+                watchedProperties: [ "global_inherits_stack" ]
             }
 
             UM.SettingPropertyProvider