diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-01-21 21:25:08 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-01-21 21:25:08 +0400 |
commit | 78405a89c84bb0e7a8617521152e28bc7db78c37 (patch) | |
tree | a7dacc93ff05291743ea95d938f59de0984db40b | |
parent | 8cde4e5182fd2bf2bab393db32c0fa460874f82b (diff) |
fix [#33937] Planar decimate + triangulate operator leaves non-triangle faces
triangulate operation will now always triangulate, even on degenerate faces.
-rw-r--r-- | source/blender/bmesh/intern/bmesh_polygon.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/source/blender/bmesh/intern/bmesh_polygon.c b/source/blender/bmesh/intern/bmesh_polygon.c index f7dc143104c..62bd2649cd4 100644 --- a/source/blender/bmesh/intern/bmesh_polygon.c +++ b/source/blender/bmesh/intern/bmesh_polygon.c @@ -883,7 +883,13 @@ void BM_face_triangulate(BMesh *bm, BMFace *f, float (*projectverts)[3], const s while (!done && f->len > 3) { done = true; l_iter = find_ear(f, projectverts, use_beauty, abscoss); - if (l_iter) { + + /* force triangulation - if we can't find an ear the face is degenerate */ + if (l_iter == NULL) { + l_iter = BM_FACE_FIRST_LOOP(f); + } + + { done = false; /* printf("Subdividing face...\n");*/ f = BM_face_split(bm, l_iter->f, l_iter->prev->v, l_iter->next->v, &newl, NULL, true); @@ -914,6 +920,8 @@ void BM_face_triangulate(BMesh *bm, BMFace *f, float (*projectverts)[3], const s } } + BLI_assert(f->len == 3); + #if 0 /* XXX find_ear should now always return a corner, so no more need for this piece of code... */ if (f->len > 3) { l_iter = BM_FACE_FIRST_LOOP(f); |