diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-05-08 18:01:38 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-05-08 18:01:38 +0400 |
commit | 7dbf6d513e785f2b3101b555c983a19245c94620 (patch) | |
tree | 72e92954e52a1186b709cd9057f4258b95f1448e /source/blender/bmesh | |
parent | 8193d83cd99a56709609e41f1f4eb28db8aa2d29 (diff) |
mesh dissolve vertices: option to split off corners of surrounding faces, makes the result more localized to the area around the vertex.
Diffstat (limited to 'source/blender/bmesh')
-rw-r--r-- | source/blender/bmesh/intern/bmesh_opdefines.c | 1 | ||||
-rw-r--r-- | source/blender/bmesh/operators/bmo_dissolve.c | 24 |
2 files changed, 24 insertions, 1 deletions
diff --git a/source/blender/bmesh/intern/bmesh_opdefines.c b/source/blender/bmesh/intern/bmesh_opdefines.c index 587696268b1..77e45648813 100644 --- a/source/blender/bmesh/intern/bmesh_opdefines.c +++ b/source/blender/bmesh/intern/bmesh_opdefines.c @@ -842,6 +842,7 @@ static BMOpDefine bmo_dissolve_verts_def = { "dissolve_verts", /* slots_in */ {{"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, + {"use_face_split", BMO_OP_SLOT_BOOL}, {{'\0'}}, }, {{{'\0'}}}, /* no output */ diff --git a/source/blender/bmesh/operators/bmo_dissolve.c b/source/blender/bmesh/operators/bmo_dissolve.c index e2a3cf025aa..3023071175a 100644 --- a/source/blender/bmesh/operators/bmo_dissolve.c +++ b/source/blender/bmesh/operators/bmo_dissolve.c @@ -359,10 +359,32 @@ void bmo_dissolve_verts_exec(BMesh *bm, BMOperator *op) BMIter iter, fiter; BMVert *v; BMFace *f; - /* int i; */ + + const bool use_face_split = BMO_slot_bool_get(op->slots_in, "use_face_split"); + BMO_slot_buffer_flag_enable(bm, op->slots_in, "verts", BM_VERT, VERT_MARK); + if (use_face_split) { + BMIter liter; + BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) { + if (BMO_elem_flag_test(bm, v, VERT_MARK)) { + if (BM_vert_edge_count(v) > 2) { + BMLoop *l; + BM_ITER_ELEM (l, &liter, v, BM_LOOPS_OF_VERT) { + if (l->f->len > 3) { + if (BMO_elem_flag_test(bm, l->next->v, VERT_MARK) == 0 && + BMO_elem_flag_test(bm, l->prev->v, VERT_MARK) == 0) + { + BM_face_split(bm, l->f, l->next->v, l->prev->v, NULL, NULL, true); + } + } + } + } + } + } + } + for (v = BM_iter_new(&iter, bm, BM_VERTS_OF_MESH, NULL); v; v = BM_iter_step(&iter)) { if (BMO_elem_flag_test(bm, v, VERT_MARK)) { /* check if it's a two-valence ver */ |