Browse Source

Reconstruct ID for submaterials from unique base name

When you make the ID of the subprofile unique it doesn't get linked to the base profile any more since the '#2' gets put at the end.

Contributes to issue CURA-4243.
Ghostkeeper 7 years ago
parent
commit
72c7d2bd76
1 changed files with 5 additions and 1 deletions
  1. 5 1
      cura/Settings/ContainerManager.py

+ 5 - 1
cura/Settings/ContainerManager.py

@@ -785,7 +785,11 @@ class ContainerManager(QObject):
         for container_to_copy in containers_to_copy:
             #Create unique IDs for every clone.
             current_id = container_to_copy.getId()
-            new_id = self._container_registry.uniqueName(current_id)
+            new_id = new_base_id
+            if container_to_copy.getMetaDataEntry("definition") != "fdmprinter":
+                new_id += "_" + container_to_copy.getMetaDataEntry("definition")
+                if container_to_copy.getMetaDataEntry("variant"):
+                    new_id += "_" + container_to_copy.getMetaDataEntry("variant")
             if current_id == material_id:
                 clone_of_original = new_id