diff options
author | Howard Trickey <howard.trickey@gmail.com> | 2012-03-17 19:47:48 +0400 |
---|---|---|
committer | Howard Trickey <howard.trickey@gmail.com> | 2012-03-17 19:47:48 +0400 |
commit | 8d3e79ddc96a45ee6741de488a8d643e016948e9 (patch) | |
tree | 6719750bcbfd0ed10596e36bc41fe2361c53c511 | |
parent | 7bc693d1075a72b2f6c7abb1239432b4c442a92f (diff) |
Fix 30562: bevel was infinite looping when adjacent faces had incompatible normals
The fix is to check for cases where BME_Bevel_Dissolve_Disk was trying
to join faces with opposite normals and reverse one. This isn't a great
fix, and the example blend has strange corners at the top after beveling,
but at least it stops the infinite loops.
-rw-r--r-- | source/blender/bmesh/tools/BME_bevel.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/source/blender/bmesh/tools/BME_bevel.c b/source/blender/bmesh/tools/BME_bevel.c index 5386ed549c6..8a83cc8a928 100644 --- a/source/blender/bmesh/tools/BME_bevel.c +++ b/source/blender/bmesh/tools/BME_bevel.c @@ -166,7 +166,18 @@ static int BME_Bevel_Dissolve_Disk(BMesh *bm, BMVert *v) e = v->e; l1 = e->l; l2 = l1->radial_next; - bmesh_jfke(bm, l1->f, l2->f, e); + if (l1->v == l2->v) { + /* faces have incompatible directions; need to reverse one */ + if (!bmesh_loop_reverse(bm, l2->f)) { + BLI_assert(!"bevel dissolve disk cannot reverse loop"); + return 0; + } + l2 = l1->radial_next; + } + if (!bmesh_jfke(bm, l1->f, l2->f, e)) { + BLI_assert(!"bevel dissolve disk cannot join faces"); + return 0; + } } e = v->e; @@ -178,6 +189,14 @@ static int BME_Bevel_Dissolve_Disk(BMesh *bm, BMVert *v) l1 = elast->l; l2 = l1->radial_next; + if (l1->v == l2->v) { + /* faces have incompatible directions */ + if (!bmesh_loop_reverse(bm, l2->f)) { + BLI_assert(!"bevel dissolve disk cannot reverse loop"); + return 0; + } + l2 = l1->radial_next; + } bmesh_jfke(bm, l1->f, l2->f, elast); } |