[Bf-blender-cvs] [40aa321dc76] temp_bmesh_multires: Sculpt dyntopo: fix bug with dyntopo geometry undo push

Joseph Eagar noreply at git.blender.org
Thu Aug 12 07:51:26 CEST 2021


Commit: 40aa321dc7673526f1294d735c7f5174b9bda157
Author: Joseph Eagar
Date:   Wed Aug 11 22:51:09 2021 -0700
Branches: temp_bmesh_multires
https://developer.blender.org/rB40aa321dc7673526f1294d735c7f5174b9bda157

Sculpt dyntopo: fix bug with dyntopo geometry undo push

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

M	release/datafiles/locale
M	release/scripts/addons
M	source/blender/bmesh/intern/bmesh_log.c
M	source/blender/editors/sculpt_paint/sculpt.c

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

diff --git a/release/datafiles/locale b/release/datafiles/locale
index ca39c1459bc..35573b45adc 160000
--- a/release/datafiles/locale
+++ b/release/datafiles/locale
@@ -1 +1 @@
-Subproject commit ca39c1459bcd99300afe3591fa5ffe40f5ba5eef
+Subproject commit 35573b45adc0cc00a29538a68567621ab571a88f
diff --git a/release/scripts/addons b/release/scripts/addons
index aebb668f75b..78107f78694 160000
--- a/release/scripts/addons
+++ b/release/scripts/addons
@@ -1 +1 @@
-Subproject commit aebb668f75b57ba7cbd8f8f8ad41f0ddb4f27389
+Subproject commit 78107f78694f47ee6e50a7eb7c16b506af921199
diff --git a/source/blender/bmesh/intern/bmesh_log.c b/source/blender/bmesh/intern/bmesh_log.c
index 9cab7fb02af..6d20b273675 100644
--- a/source/blender/bmesh/intern/bmesh_log.c
+++ b/source/blender/bmesh/intern/bmesh_log.c
@@ -826,22 +826,8 @@ static BMLogEntry *bm_log_entry_create(BMLogEntryType type)
 /* Free the data in a log entry
  *
  * NOTE: does not free the log entry itself. */
-static void bm_log_entry_free(BMLogEntry *entry)
+static void bm_log_entry_free_direct(BMLogEntry *entry)
 {
-  BMLog *log = entry->log;
-  bool kill_log = false;
-
-  if (log) {
-    log->refcount--;
-
-    if (log->refcount < 0) {
-      fprintf(stderr, "BMLog refcount error\n");
-      log->refcount = 0;
-    }
-
-    kill_log = !log->refcount;
-  }
-
   switch (entry->type) {
     case LOG_ENTRY_MESH_IDS:
       log_idmap_free(entry);
@@ -881,6 +867,28 @@ static void bm_log_entry_free(BMLogEntry *entry)
       CustomData_free(&entry->pdata, 0);
       break;
   }
+}
+
+/* Free the data in a log entry
+ * and handles bmlog ref counting
+ * NOTE: does not free the log entry itself. */
+static void bm_log_entry_free(BMLogEntry *entry)
+{
+  BMLog *log = entry->log;
+  bool kill_log = false;
+
+  if (log) {
+    log->refcount--;
+
+    if (log->refcount < 0) {
+      fprintf(stderr, "BMLog refcount error\n");
+      log->refcount = 0;
+    }
+
+    kill_log = !log->refcount;
+  }
+
+  bm_log_entry_free_direct(entry);
 
   if (kill_log) {
     bm_log_free_direct(log, true);
@@ -2064,15 +2072,27 @@ void BM_log_full_mesh(BMesh *bm, BMLog *log)
     entry = bm_log_entry_add_ex(bm, log, false, LOG_ENTRY_FULL_MESH, NULL);
   }
 
-  bool add = BLI_ghash_len(entry->added_faces) > 0;
-  add |= BLI_ghash_len(entry->modified_verts) > 0;
-  add |= BLI_ghash_len(entry->modified_faces) > 0;
-  add |= BLI_ghash_len(entry->deleted_verts) > 0;
-  add |= BLI_ghash_len(entry->deleted_faces) > 0;
+  // add an entry if current entry isn't empty or isn't LOG_ENTRY_PARTIAL
+  bool add = false;
+
+  if (entry->type == LOG_ENTRY_PARTIAL) {
+    add = BLI_ghash_len(entry->added_faces) > 0;
+    add |= BLI_ghash_len(entry->modified_verts) > 0;
+    add |= BLI_ghash_len(entry->modified_faces) > 0;
+    add |= BLI_ghash_len(entry->deleted_verts) > 0;
+    add |= BLI_ghash_len(entry->deleted_faces) > 0;
+  }
+  else {
+    add = true;
+  }
 
   if (add) {
     entry = bm_log_entry_add_ex(bm, log, true, LOG_ENTRY_FULL_MESH, NULL);
   }
+  else {
+    bm_log_entry_free_direct(entry);
+    entry->type = LOG_ENTRY_FULL_MESH;
+  }
 
   bm_log_full_mesh_intern(bm, log, entry);
 
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index 7f828346544..a7c8cca4aa9 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -9535,7 +9535,6 @@ static int sculpt_symmetrize_exec(bContext *C, wmOperator *op)
 
       // symmetrize is messing up ids, regenerate them from scratch
       BM_reassign_ids(ss->bm);
-
       BM_log_full_mesh(ss->bm, ss->bm_log);
 
       /* Finish undo. */



More information about the Bf-blender-cvs mailing list