diff options
author | Geoffrey Bantle <hairbat@yahoo.com> | 2008-02-24 09:23:20 +0300 |
---|---|---|
committer | Geoffrey Bantle <hairbat@yahoo.com> | 2008-02-24 09:23:20 +0300 |
commit | c8569c934ad83d41053ffcf7347cb4d3e4a7948a (patch) | |
tree | e14de2e5fbe1e0d21aa644ec22a061080838550e /source/blender/blenkernel/intern/BME_tools.c | |
parent | cac62dfc1cc2b5421a726100f0fd9216a9c2144d (diff) |
-> Bevel Crash Fix
Bevel code was making incorrect usage of the BME_loop_reverse euler.
Restructured the code in order to correct the problem.
Diffstat (limited to 'source/blender/blenkernel/intern/BME_tools.c')
-rw-r--r-- | source/blender/blenkernel/intern/BME_tools.c | 77 |
1 files changed, 43 insertions, 34 deletions
diff --git a/source/blender/blenkernel/intern/BME_tools.c b/source/blender/blenkernel/intern/BME_tools.c index 441a8f52692..2b3ff3812e4 100644 --- a/source/blender/blenkernel/intern/BME_tools.c +++ b/source/blender/blenkernel/intern/BME_tools.c @@ -1151,11 +1151,11 @@ BME_Mesh *BME_bevel_reinitialize(BME_Mesh *bm) { * A BME_Mesh pointer to the BMesh passed as a parameter. */ BME_Mesh *BME_bevel_mesh(BME_Mesh *bm, float value, int res, int options, int defgrp_index, BME_TransData_Head *td) { - BME_Vert *v, *nv; - BME_Edge *e, *oe; + BME_Vert *v, *nv, *kv; + BME_Edge *e, *oe, *ne; BME_Loop *l, *l2; - BME_Poly *f; - unsigned int i, len; + BME_Poly *f, *nf; + unsigned int i, len, done; for (f=bm->polys.first; f; f=f->next) { if(f->tflag1 & BME_BEVEL_ORIG) { @@ -1212,42 +1212,51 @@ BME_Mesh *BME_bevel_mesh(BME_Mesh *bm, float value, int res, int options, int de } } - l = v->edge->loop; - if (len > 2) { - f = l->f; - while(f->len <= len) { - if (l->radial.next->data != l) { - e = l->e; - l = l->radial.next->data; - } - else { - e = NULL; + done = 0; + while(!done){ + done = 1; + e = v->edge; + do{ + f = NULL; + len = BME_cycle_length(&(e->loop->radial)); + if(len == 2){ + f = BME_JFKE_safe(bm,e->loop->f, ((BME_Loop*)(e->loop->radial.next->data))->f, e); } - if (l->v == v) l = l->prev; - else l = l->next; - if (e) { - f = BME_JFKE_safe(bm,e->loop->f,((BME_Loop*)e->loop->radial.next->data)->f,e); + if(f){ + done = 0; + break; } - } - } - if (l->v == v) l = l->prev; - l = l->prev; - if (l->next->radial.next->data == l->next) { /* was part of the open end of a mesh */ - BME_JEKV(bm,l->next->e,v); - if (len == 2) { - f = BME_JFKE_safe(bm,l->f,((BME_Loop*)l->radial.next->data)->f,l->e); - } - } - else { - BME_JEKV(bm,l->next->e,v); - f = BME_JFKE_safe(bm,l->f,((BME_Loop*)l->next->radial.next->data)->f,l->next->e); - if (f->len == 2) { - f = BME_JFKE_safe(bm,f,((BME_Loop*)f->loopbase->radial.next->data)->f,f->loopbase->e); - } + e = BME_disk_nextedge(e,v); + }while(e != v->edge); } + BME_JEKV(bm,e,v); } v = nv; } + + /*clean up two edged faces here*/ + for(f=bm->polys.first; f;){ + nf = f->next; + if(f->len == 2){ + e = NULL; + l = f->loopbase; + do{ + if(BME_cycle_length(&l->radial) == 2){ + e = l->e; + break; + } + l = l->next; + }while(l!=f->loopbase); + + if(e) BME_JFKE_safe(bm,f, ((BME_Loop*)(e->loop->radial.next->data))->f, e); + else{ + /*We are still leaving a stray edge? This shouldnt even be possible!*/ + BME_KF(bm, f); + } + } + f = nf; + } + return bm; } |