[Bf-blender-cvs] [e74c298cf9a] temp_bmesh_multires: Fix dyntopo undo bug

Joseph Eagar noreply at git.blender.org
Mon Apr 12 07:03:28 CEST 2021


Commit: e74c298cf9a2c6482287578c6157e51434b6e272
Author: Joseph Eagar
Date:   Sun Apr 11 22:03:16 2021 -0700
Branches: temp_bmesh_multires
https://developer.blender.org/rBe74c298cf9a2c6482287578c6157e51434b6e272

Fix dyntopo undo bug

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

M	source/blender/bmesh/intern/bmesh_log.c

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

diff --git a/source/blender/bmesh/intern/bmesh_log.c b/source/blender/bmesh/intern/bmesh_log.c
index edfbab1d18c..faf29b8af00 100644
--- a/source/blender/bmesh/intern/bmesh_log.c
+++ b/source/blender/bmesh/intern/bmesh_log.c
@@ -408,6 +408,7 @@ static void bm_log_faces_unmake(BMesh *bm, BMLog *log, GHash *faces, BMLogEntry
   GHashIterator gh_iter;
   GHASH_ITER (gh_iter, faces) {
     void *key = BLI_ghashIterator_getKey(&gh_iter);
+    BMLogFace *lf = BLI_ghashIterator_getValue(&gh_iter);
     uint id = POINTER_AS_UINT(key);
     BMFace *f = bm_log_face_from_id(log, id);
 
@@ -425,8 +426,25 @@ static void bm_log_faces_unmake(BMesh *bm, BMLog *log, GHash *faces, BMLogEntry
       e_tri[i] = l_iter->e;
     }
 
-    /* Remove any unused edges */
+    //ensure we have final customdata for face in log
+#ifdef CUSTOMDATA
+    if (lf->customdata_f) {
+      CustomData_bmesh_copy_data(&bm->pdata, &entry->pdata, f->head.data, &lf->customdata_f);
+    }
+
+    BMLoop *ls[3] = {f->l_first, f->l_first->next, f->l_first->prev};
+
+    for (int i = 0; i < 3; i++) {
+      if (lf->customdata[i]) {
+        CustomData_bmesh_copy_data(
+            &bm->ldata, &entry->ldata, ls[i]->head.data, &lf->customdata[i]);
+      }
+    }
+#endif
+
     BM_face_kill(bm, f);
+
+    /* Remove any unused edges */
     for (i = 0; i < 3; i++) {
       if (BM_edge_is_wire(e_tri[i])) {
         BM_edge_kill(bm, e_tri[i]);



More information about the Bf-blender-cvs mailing list