[Bf-blender-cvs] [82f5e0200c5] temp_bmesh_multires: * Fix bug in last commit where boundary flags weren't properly updated after symmetrize.

Joseph Eagar noreply at git.blender.org
Tue Apr 27 02:45:03 CEST 2021


Commit: 82f5e0200c55453e33d992f6c84e5e11a4de889c
Author: Joseph Eagar
Date:   Mon Apr 26 17:44:38 2021 -0700
Branches: temp_bmesh_multires
https://developer.blender.org/rB82f5e0200c55453e33d992f6c84e5e11a4de889c

* Fix bug in last commit where boundary flags weren't properly
updated after symmetrize.

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

M	source/blender/blenkernel/BKE_pbvh.h
M	source/blender/blenkernel/intern/pbvh_bmesh.c
M	source/blender/editors/sculpt_paint/sculpt.c

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

diff --git a/source/blender/blenkernel/BKE_pbvh.h b/source/blender/blenkernel/BKE_pbvh.h
index d804bd6e7bc..2d9872d5068 100644
--- a/source/blender/blenkernel/BKE_pbvh.h
+++ b/source/blender/blenkernel/BKE_pbvh.h
@@ -693,6 +693,10 @@ void BKE_pbvh_bmesh_check_tris(PBVH *pbvh, PBVHNode *node);
 PBVHTriBuf *BKE_pbvh_bmesh_get_tris(PBVH *pbvh, PBVHNode *node);
 void BKE_pbvh_bmesh_free_tris(PBVH *pbvh, PBVHNode *node);
 
+/*recalculates boundary flags for *all* vertices.  used by
+  symmetrize.*/
+void BKE_pbvh_recalc_bmesh_boundary(PBVH *pbvh);
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/source/blender/blenkernel/intern/pbvh_bmesh.c b/source/blender/blenkernel/intern/pbvh_bmesh.c
index c9204107d02..e8973030c89 100644
--- a/source/blender/blenkernel/intern/pbvh_bmesh.c
+++ b/source/blender/blenkernel/intern/pbvh_bmesh.c
@@ -3211,6 +3211,23 @@ static void pbvh_bmesh_create_nodes_fast_recursive(
 
 /***************************** Public API *****************************/
 
+/*Used by symmetrize to update boundary flags*/
+void BKE_pbvh_recalc_bmesh_boundary(PBVH *pbvh)
+{
+  BMVert *v;
+  BMIter iter;
+
+  BM_ITER_MESH (v, &iter, pbvh->bm, BM_VERTS_OF_MESH) {
+    MDynTopoVert *mv = BKE_PBVH_DYNVERT(pbvh->cd_dyn_vert, v);
+
+    if (BM_vert_is_boundary(v)) {
+      mv->flag |= DYNVERT_BOUNDARY;
+    } else {
+      mv->flag &= ~DYNVERT_BOUNDARY;
+    }
+  }
+}
+
 /* Build a PBVH from a BMesh */
 void BKE_pbvh_build_bmesh(PBVH *pbvh,
                           BMesh *bm,
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index 4d1d384661d..a407ad677cc 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -8990,6 +8990,8 @@ static int sculpt_symmetrize_exec(bContext *C, wmOperator *op)
 
       BM_mesh_toolflags_set(ss->bm, false);
 
+      BKE_pbvh_recalc_bmesh_boundary(ss->pbvh);
+
       /* Finish undo. */
       BM_log_all_added(ss->bm, ss->bm_log);
       SCULPT_undo_push_end();



More information about the Bf-blender-cvs mailing list