diff options
author | Campbell Barton <ideasman42@gmail.com> | 2020-10-26 13:57:51 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2020-10-26 14:02:31 +0300 |
commit | 9969c2dd165c7d8ffe607a5a050a80aa59ac50be (patch) | |
tree | f6a2aee51ada00f47e566c99448dd44c9d2da160 /source | |
parent | 25c3a2e42dadc737d076d4b97b7ea778929ecf40 (diff) |
Fix custom-normal support for mesh editing operations
Account for custom normals for edit-mesh tools:
- Limited Dissolve
- Split
- Split (Edges/Vertices)
- Triangulate
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/mesh/editmesh_tools.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index 47836d2e529..85cc19e7471 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -1765,11 +1765,16 @@ static bool edbm_edge_split_selected_edges(wmOperator *op, Object *obedit, BMEdi if (bm->totedgesel == 0) { return false; } + + BM_custom_loop_normals_to_vector_layer(em->bm); + if (!EDBM_op_call_and_selectf( em, op, "edges.out", false, "split_edges edges=%he", BM_ELEM_SELECT)) { return false; } + BM_custom_loop_normals_from_vector_layer(em->bm, false); + EDBM_select_flush(em); EDBM_update_generic(obedit->data, true, true); @@ -1805,6 +1810,8 @@ 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", @@ -1836,6 +1843,8 @@ static bool edbm_edge_split_selected_verts(wmOperator *op, Object *obedit, BMEdi } } + BM_custom_loop_normals_from_vector_layer(em->bm, false); + EDBM_select_flush(em); EDBM_update_generic(obedit->data, true, true); @@ -5284,6 +5293,8 @@ static int edbm_quads_convert_to_tris_exec(bContext *C, wmOperator *op) BMOIter oiter; BMFace *f; + BM_custom_loop_normals_to_vector_layer(em->bm); + EDBM_op_init(em, &bmop, op, @@ -5308,6 +5319,8 @@ static int edbm_quads_convert_to_tris_exec(bContext *C, wmOperator *op) continue; } + BM_custom_loop_normals_from_vector_layer(em->bm, false); + EDBM_update_generic(obedit->data, true, true); } @@ -5997,6 +6010,8 @@ 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, @@ -6009,6 +6024,8 @@ static int edbm_dissolve_limited_exec(bContext *C, wmOperator *op) use_dissolve_boundaries, delimit); + BM_custom_loop_normals_from_vector_layer(em->bm, false); + EDBM_update_generic(obedit->data, true, true); } MEM_freeN(objects); @@ -6233,6 +6250,8 @@ static int edbm_split_exec(bContext *C, wmOperator *op) if ((em->bm->totvertsel == 0) && (em->bm->totedgesel == 0) && (em->bm->totfacesel == 0)) { continue; } + BM_custom_loop_normals_to_vector_layer(em->bm); + BMOperator bmop; EDBM_op_init(em, &bmop, op, "split geom=%hvef use_only_faces=%b", BM_ELEM_SELECT, false); BMO_op_exec(em->bm, &bmop); @@ -6240,6 +6259,8 @@ static int edbm_split_exec(bContext *C, wmOperator *op) BMO_slot_buffer_hflag_enable( em->bm, bmop.slots_out, "geom.out", BM_ALL_NOLOOP, BM_ELEM_SELECT, true); + BM_custom_loop_normals_from_vector_layer(em->bm, false); + if (!EDBM_op_finish(em, &bmop, op, true)) { continue; } |