Browse Source

Reverted a previous workaround that fixed errors when selecting material and variants in the application menus - CURA-4386 CURA-4379

Diego Prado Gesto 7 years ago
parent
commit
f0e89b7e01
1 changed files with 18 additions and 2 deletions
  1. 18 2
      resources/qml/Menus/MaterialMenu.qml

+ 18 - 2
resources/qml/Menus/MaterialMenu.qml

@@ -66,7 +66,15 @@ Menu
             checkable: true
             checked: model.id == Cura.MachineManager.allActiveMaterialIds[ExtruderManager.extruderIds[extruderIndex]]
             exclusiveGroup: group
-            onTriggered: Cura.MachineManager.setActiveMaterial(model.id)
+            onTriggered:
+            {
+                // This workaround is done because of the application menus for materials and variants for multiextrusion printers.
+                // The extruder menu would always act on the correspoding extruder only, instead of acting on the extruder selected in the UI.
+                var activeExtruderIndex = ExtruderManager.activeExtruderIndex;
+                ExtruderManager.setActiveExtruderIndex(extruderIndex);
+                Cura.MachineManager.setActiveMaterial(model.id);
+                ExtruderManager.setActiveExtruderIndex(activeExtruderIndex);
+            }
         }
         onObjectAdded: menu.insertItem(index, object)
         onObjectRemoved: menu.removeItem(object)
@@ -101,7 +109,15 @@ Menu
                             checkable: true
                             checked: model.id == Cura.MachineManager.allActiveMaterialIds[ExtruderManager.extruderIds[extruderIndex]]
                             exclusiveGroup: group
-                            onTriggered: Cura.MachineManager.setActiveMaterial(model.id)
+                            onTriggered:
+                            {
+                                // This workaround is done because of the application menus for materials and variants for multiextrusion printers.
+                                // The extruder menu would always act on the correspoding extruder only, instead of acting on the extruder selected in the UI.
+                                var activeExtruderIndex = ExtruderManager.activeExtruderIndex;
+                                ExtruderManager.setActiveExtruderIndex(extruderIndex);
+                                Cura.MachineManager.setActiveMaterial(model.id);
+                                ExtruderManager.setActiveExtruderIndex(activeExtruderIndex);
+                            }
                         }
                         onObjectAdded: brandMaterialsMenu.insertItem(index, object)
                         onObjectRemoved: brandMaterialsMenu.removeItem(object)