diff options
author | Nicholas Bishop <nicholasbishop@gmail.com> | 2013-01-20 04:46:33 +0400 |
---|---|---|
committer | Nicholas Bishop <nicholasbishop@gmail.com> | 2013-01-20 04:46:33 +0400 |
commit | 4ca7bad74865bdb147cfca5851cac49b11f825c1 (patch) | |
tree | 597d84e22d54c3efd4ad77c40f8ca07cff19832f /source/blender/blenkernel | |
parent | 4256ad75666a119bdcea3726c3d524ff92870ae0 (diff) |
Delete loose edges left behind by sculpting with collapse-short-edges
After deleting a face, check for unused edges and delete them.
Fixes bug [#33891]
projects.blender.org/tracker/?func=detail&aid=33891&group_id=9&atid=498
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/intern/pbvh_bmesh.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/pbvh_bmesh.c b/source/blender/blenkernel/intern/pbvh_bmesh.c index f3ac22f0df7..c464de64c6a 100644 --- a/source/blender/blenkernel/intern/pbvh_bmesh.c +++ b/source/blender/blenkernel/intern/pbvh_bmesh.c @@ -817,10 +817,13 @@ static void pbvh_bmesh_collapse_edge(PBVH *bvh, BMEdge *e, BMVert *v1, for (i = 0; i < deleted_faces->count; i++) { BMFace *f_del = BLI_buffer_at(deleted_faces, BMFace *, i); BMVert *v_tri[3]; + BMEdge *e_tri[3]; int j; - // BM_iter_as_array(NULL, BM_VERTS_OF_FACE, f_del, (void **)v_tri, 3); + /* Get vertices and edges of face */ BM_face_as_array_vert_tri(f_del, v_tri); + for (j = 0; j < 3; j++) + e_tri[j] = BM_edge_exists(v_tri[j], v_tri[j == 2 ? 0 : j + 1]); /* Check if any of the face's vertices are now unused, if so * remove them from the PBVH */ @@ -838,6 +841,13 @@ static void pbvh_bmesh_collapse_edge(PBVH *bvh, BMEdge *e, BMVert *v1, pbvh_bmesh_face_remove(bvh, f_del); BM_face_kill(bvh->bm, f_del); + /* Check if any of the face's edges are now unused by any + * face, if so delete them */ + for (j = 0; j < 3; j++) { + if (BM_edge_face_count(e_tri[j]) == 0) + BM_edge_kill(bvh->bm, e_tri[j]); + } + /* Delete unused vertices */ for (j = 0; j < 3; j++) { if (v_tri[j]) { |