diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-08-23 15:10:46 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-08-23 15:10:46 +0400 |
commit | 98bb2197a270b2b74a038010f34100373d38bb7b (patch) | |
tree | bac147b1892f5de324f9b9050cf155ccb4d1dd39 /source/blender/bmesh/operators/bmo_triangulate.c | |
parent | 59b082dc272feb6567a73a45b9eb9a742e4131d7 (diff) |
add dissolve option to triangle fill operator, running dissolve after scanfill isn't so simple because of errors if one edge can't merge.
Diffstat (limited to 'source/blender/bmesh/operators/bmo_triangulate.c')
-rw-r--r-- | source/blender/bmesh/operators/bmo_triangulate.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/source/blender/bmesh/operators/bmo_triangulate.c b/source/blender/bmesh/operators/bmo_triangulate.c index 46a8295dfd4..a8179330261 100644 --- a/source/blender/bmesh/operators/bmo_triangulate.c +++ b/source/blender/bmesh/operators/bmo_triangulate.c @@ -59,6 +59,7 @@ void bmo_triangulate_exec(BMesh *bm, BMOperator *op) void bmo_triangle_fill_exec(BMesh *bm, BMOperator *op) { const bool use_beauty = BMO_slot_bool_get(op->slots_in, "use_beauty"); + const bool use_dissolve = BMO_slot_bool_get(op->slots_in, "use_dissolve"); BMOIter siter; BMEdge *e; ScanFillContext sf_ctx; @@ -133,4 +134,22 @@ void bmo_triangle_fill_exec(BMesh *bm, BMOperator *op) } BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "geom.out", BM_EDGE | BM_FACE, ELE_NEW); + + if (use_dissolve) { + BMO_ITER (e, &siter, op->slots_out, "geom.out", BM_EDGE) { + BMFace *f_new; + f_new = BM_faces_join_pair(bm, e->l->f, + e->l->radial_next->f, e, + false); /* join faces */ + if (f_new) { + BMO_elem_flag_enable(bm, f_new, ELE_NEW); + BM_edge_kill(bm, e); + } + else { + BMO_error_clear(bm); + } + } + + BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "geom.out", BM_EDGE | BM_FACE, ELE_NEW); + } } |