Browse Source

We now remove all material containers instead of the active machine variant

CURA-2210
Jaime van Kessel 8 years ago
parent
commit
e12acb8110
1 changed files with 8 additions and 1 deletions
  1. 8 1
      resources/qml/Preferences/MaterialsPage.qml

+ 8 - 1
resources/qml/Preferences/MaterialsPage.qml

@@ -242,7 +242,14 @@ UM.ManagementPage
             object: base.currentItem != null ? base.currentItem.name : ""
             onYes:
             {
-                var containers = Cura.ContainerManager.findInstanceContainers({"id": base.currentItem.id})
+                // A material container can actually be multiple items, so we need to find (and remove) all of them.
+                var base_file = Cura.ContainerManager.getContainerMetaDataEntry(base.currentItem.id, "base_file")
+                if(base_file == "")
+                {
+                    base_file = base.currentItem.id
+                }
+                var guid = Cura.ContainerManager.getContainerMetaDataEntry(base.currentItem.id, "GUID")
+                var containers = Cura.ContainerManager.findInstanceContainers({"GUID": guid, "base_file": base_file, "type": "material"})
                 for(var i in containers)
                 {
                     Cura.ContainerManager.removeContainer(containers[i])