[Bf-blender-cvs] [3c0fd51cf43] blender-v2.83-release: Fix T76738: Duplicate brushes cause assertion on undo

Campbell Barton noreply at git.blender.org
Fri May 15 09:47:32 CEST 2020


Commit: 3c0fd51cf43ea7504a4457784d6a085bfb4b92d0
Author: Campbell Barton
Date:   Fri May 15 17:45:41 2020 +1000
Branches: blender-v2.83-release
https://developer.blender.org/rB3c0fd51cf43ea7504a4457784d6a085bfb4b92d0

Fix T76738: Duplicate brushes cause assertion on undo

===================================================================

M	source/blender/blenkernel/BKE_blender_version.h
M	source/blender/blenloader/intern/versioning_280.c

===================================================================

diff --git a/source/blender/blenkernel/BKE_blender_version.h b/source/blender/blenkernel/BKE_blender_version.h
index 52a603ede72..c0ac87368c4 100644
--- a/source/blender/blenkernel/BKE_blender_version.h
+++ b/source/blender/blenkernel/BKE_blender_version.h
@@ -27,7 +27,7 @@
  * \note Use #STRINGIFY() rather than defining with quotes.
  */
 #define BLENDER_VERSION 283
-#define BLENDER_SUBVERSION 16
+#define BLENDER_SUBVERSION 17
 /** Several breakages with 280, e.g. collections vs layers. */
 #define BLENDER_MINVERSION 280
 #define BLENDER_MINSUBVERSION 0
diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c
index 2c4cc544e2a..72c7c10d7ee 100644
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@ -5046,6 +5046,27 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
     }
   }
 
+  if (!MAIN_VERSION_ATLEAST(bmain, 283, 17)) {
+    /* Reset the cloth mass to 1.0 in brushes with an invalid value. */
+    for (Brush *br = bmain->brushes.first; br; br = br->id.next) {
+      if (br->sculpt_tool == SCULPT_TOOL_CLOTH) {
+        if (br->cloth_mass == 0.0f) {
+          br->cloth_mass = 1.0f;
+        }
+      }
+    }
+  }
+
+  /** Repair files from duplicate brushes added to blend files, see: T76738. */
+  if (!MAIN_VERSION_ATLEAST(bmain, 283, 17) ||
+      ((bmain->versionfile == 290) && !MAIN_VERSION_ATLEAST(bmain, 290, 2))) {
+    short id_codes[] = {ID_BR, ID_PAL};
+    for (int i = 0; i < ARRAY_SIZE(id_codes); i++) {
+      ListBase *lb = which_libbase(bmain, id_codes[i]);
+      BKE_main_id_repair_duplicate_names_listbase(lb);
+    }
+  }
+
   /**
    * Versioning code until next subversion bump goes here.
    *
@@ -5058,14 +5079,5 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
    */
   {
     /* Keep this block, even when empty. */
-
-    /* Reset the cloth mass to 1.0 in brushes with an invalid value. */
-    for (Brush *br = bmain->brushes.first; br; br = br->id.next) {
-      if (br->sculpt_tool == SCULPT_TOOL_CLOTH) {
-        if (br->cloth_mass == 0.0f) {
-          br->cloth_mass = 1.0f;
-        }
-      }
-    }
   }
 }



More information about the Bf-blender-cvs mailing list