diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-04-04 19:10:20 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-04-04 19:10:20 +0400 |
commit | 4f2fb41fb658e710ce4f57057ebcee0977ade1f5 (patch) | |
tree | 477bb2051637cd544ee506f822a7961b602f8f74 /source/blender/bmesh/operators/bmo_dissolve.c | |
parent | 1635d8e873eff8d49e7871047ca8b5c026cdf214 (diff) |
fix [#30809] Limited dissolve leaves edges behind
Diffstat (limited to 'source/blender/bmesh/operators/bmo_dissolve.c')
-rw-r--r-- | source/blender/bmesh/operators/bmo_dissolve.c | 35 |
1 files changed, 25 insertions, 10 deletions
diff --git a/source/blender/bmesh/operators/bmo_dissolve.c b/source/blender/bmesh/operators/bmo_dissolve.c index 167556a158c..29a0aa743b7 100644 --- a/source/blender/bmesh/operators/bmo_dissolve.c +++ b/source/blender/bmesh/operators/bmo_dissolve.c @@ -505,14 +505,10 @@ void bmo_dissolve_limit_exec(BMesh *bm, BMOperator *op) const float angle = BM_edge_face_angle(e); if (angle < angle_limit) { - weight_elems[i].ele = (BMHeader *)e; - weight_elems[i].weight = angle; tot_found++; } - else { - weight_elems[i].ele = NULL; - weight_elems[i].weight = angle_max; - } + weight_elems[i].ele = (BMHeader *)e; + weight_elems[i].weight = angle; } if (tot_found != 0) { @@ -520,19 +516,38 @@ void bmo_dissolve_limit_exec(BMesh *bm, BMOperator *op) for (i = 0; i < tot_found; i++) { BMEdge *e = (BMEdge *)weight_elems[i].ele; - /* check twice because cumulative effect could dissolve over angle limit */ - if (BM_edge_face_angle(e) < angle_limit) { + + if (/* may have become non-manifold */ + BM_edge_is_manifold(e) && + /* check twice because cumulative effect could dissolve over angle limit */ + (BM_edge_face_angle(e) < angle_limit)) + { BMFace *nf = BM_faces_join_pair(bm, e->l->f, e->l->radial_next->f, e, - TRUE); /* join faces */ + FALSE); /* join faces */ /* there may be some errors, we don't mind, just move on */ - if (nf == NULL) { + if (nf) { + BM_face_normal_update(bm, nf); + } + else { BMO_error_clear(bm); } } } + + /* remove all edges/verts left behind from dissolving */ + for (i = 0; i < einput->len; i++) { + BMEdge *e = (BMEdge *)weight_elems[i].ele; + if (BM_edge_is_wire(e)) { + BMVert *v1 = e->v1; + BMVert *v2 = e->v2; + BM_edge_kill(bm, e); + if (v1->e == NULL) BM_vert_kill(bm, v1); + if (v2->e == NULL) BM_vert_kill(bm, v2); + } + } } /* --- second verts --- */ |