[Bf-blender-cvs] [4b56c182907] master: Fix T84426: Limit dissolve ignores selection with custom normals

Campbell Barton noreply at git.blender.org
Wed Jan 6 09:06:46 CET 2021


Commit: 4b56c1829073d85a9c9dedd5e6cd7bd8b584debd
Author: Campbell Barton
Date:   Wed Jan 6 18:45:35 2021 +1100
Branches: master
https://developer.blender.org/rB4b56c1829073d85a9c9dedd5e6cd7bd8b584debd

Fix T84426: Limit dissolve ignores selection with custom normals

Regression in 9969c2dd165c7d8ffe607a5a050a80aa59ac50be.

Add note that custom normal calculation functions write into to tags.

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

M	source/blender/bmesh/intern/bmesh_mesh.c
M	source/blender/editors/mesh/editmesh_tools.c

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

diff --git a/source/blender/bmesh/intern/bmesh_mesh.c b/source/blender/bmesh/intern/bmesh_mesh.c
index 634db9276a6..5e879d41d43 100644
--- a/source/blender/bmesh/intern/bmesh_mesh.c
+++ b/source/blender/bmesh/intern/bmesh_mesh.c
@@ -669,6 +669,9 @@ bool BM_loop_check_cyclic_smooth_fan(BMLoop *l_curr)
  * BMesh version of BKE_mesh_normals_loop_split() in mesh_evaluate.c
  * Will use first clnors_data array, and fallback to cd_loop_clnors_offset
  * (use NULL and -1 to not use clnors).
+ *
+ * \note This sets #BM_ELEM_TAG which is used in tool code (e.g. T84426).
+ * we could add a low-level API flag for this, see #BM_ELEM_API_FLAG_ENABLE and friends.
  */
 static void bm_mesh_loops_calc_normals(BMesh *bm,
                                        const float (*vcos)[3],
@@ -1555,6 +1558,10 @@ void BM_lnorspace_rebuild(BMesh *bm, bool preserve_clnor)
 #endif
 }
 
+/**
+ * \warning This function sets #BM_ELEM_TAG on loops & edges via #bm_mesh_loops_calc_normals,
+ * take care to run this before setting up tags.
+ */
 void BM_lnorspace_update(BMesh *bm)
 {
   if (bm->lnor_spacearr == NULL) {
@@ -1889,6 +1896,10 @@ void BM_loop_normal_editdata_array_free(BMLoopNorEditDataArray *lnors_ed_arr)
   MEM_freeN(lnors_ed_arr);
 }
 
+/**
+ * \warning This function sets #BM_ELEM_TAG on loops & edges via #bm_mesh_loops_calc_normals,
+ * take care to run this before setting up tags.
+ */
 bool BM_custom_loop_normals_to_vector_layer(BMesh *bm)
 {
   BMFace *f;
diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c
index 18b5713e736..26efcf88082 100644
--- a/source/blender/editors/mesh/editmesh_tools.c
+++ b/source/blender/editors/mesh/editmesh_tools.c
@@ -1790,6 +1790,8 @@ static bool edbm_edge_split_selected_verts(wmOperator *op, Object *obedit, BMEdi
     return false;
   }
 
+  BM_custom_loop_normals_to_vector_layer(em->bm);
+
   /* Flush from vertices to edges. */
   BMIter iter;
   BMEdge *eed;
@@ -1809,8 +1811,6 @@ static bool edbm_edge_split_selected_verts(wmOperator *op, Object *obedit, BMEdi
     }
   }
 
-  BM_custom_loop_normals_to_vector_layer(em->bm);
-
   if (!EDBM_op_callf(em,
                      op,
                      "split_edges edges=%he verts=%hv use_verts=%b",
@@ -5966,6 +5966,8 @@ static int edbm_dissolve_limited_exec(bContext *C, wmOperator *op)
       continue;
     }
 
+    BM_custom_loop_normals_to_vector_layer(em->bm);
+
     if (em->selectmode == SCE_SELECT_FACE) {
       /* flush selection to tags and untag edges/verts with partially selected faces */
       BMIter iter;
@@ -5997,8 +5999,6 @@ static int edbm_dissolve_limited_exec(bContext *C, wmOperator *op)
       dissolve_flag = BM_ELEM_SELECT;
     }
 
-    BM_custom_loop_normals_to_vector_layer(em->bm);
-
     EDBM_op_call_and_selectf(
         em,
         op,



More information about the Bf-blender-cvs mailing list