diff options
author | Daniel Dunbar <daniel@zuster.org> | 2004-03-21 01:06:01 +0300 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2004-03-21 01:06:01 +0300 |
commit | 0d4300eb49eabec898828656d1553ec70cda935d (patch) | |
tree | 397b7547f12b0b351e319ea21bf255b78eb00dfe | |
parent | 60955da36d5f731b0e30552442bee255e3d66a23 (diff) |
- added object_apply_deform, removed lt_applyflag global
-rw-r--r-- | source/blender/blenkernel/BKE_lattice.h | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/lattice.c | 23 | ||||
-rw-r--r-- | source/blender/src/editlattice.c | 5 |
3 files changed, 18 insertions, 12 deletions
diff --git a/source/blender/blenkernel/BKE_lattice.h b/source/blender/blenkernel/BKE_lattice.h index 98bc5a53537..a9a3ee2d6f9 100644 --- a/source/blender/blenkernel/BKE_lattice.h +++ b/source/blender/blenkernel/BKE_lattice.h @@ -39,7 +39,6 @@ struct Object; struct BPoint; extern struct Lattice *editLatt; -extern int lt_applyflag; void resizelattice(struct Lattice *lt); @@ -52,6 +51,7 @@ void init_latt_deform(struct Object *oblatt, struct Object *ob); void calc_latt_deform(float *co); void end_latt_deform(void); int object_deform(struct Object *ob); +int object_apply_deform(struct Object *ob); struct BPoint *latt_bp(struct Lattice *lt, int u, int v, int w); void outside_lattice(struct Lattice *lt); diff --git a/source/blender/blenkernel/intern/lattice.c b/source/blender/blenkernel/intern/lattice.c index 0cf7747c14a..96d022ef1f1 100644 --- a/source/blender/blenkernel/intern/lattice.c +++ b/source/blender/blenkernel/intern/lattice.c @@ -71,7 +71,6 @@ Lattice *editLatt=0, *deformLatt=0; float *latticedata=0, latmat[4][4]; -int lt_applyflag= 0; void resizelattice(Lattice *lt) { @@ -383,7 +382,7 @@ void end_latt_deform() } -int object_deform(Object *ob) +static int _object_deform(Object *ob, int applyflag) { Mesh *me; Curve *cu; @@ -411,7 +410,7 @@ int object_deform(Object *ob) dl->verts= fp= MEM_mallocN(3*sizeof(float)*me->totvert, "deform1"); for(a=0; a<me->totvert; a++, mvert++, fp+=3) { - if(lt_applyflag) calc_latt_deform(mvert->co); + if(applyflag) calc_latt_deform(mvert->co); else { VECCOPY(fp, mvert->co); calc_latt_deform(fp); @@ -430,7 +429,7 @@ int object_deform(Object *ob) else if ELEM(ob->type, OB_CURVE, OB_SURF) { cu= ob->data; - if(lt_applyflag) { + if(applyflag) { Nurb *nu; BPoint *bp; @@ -489,7 +488,7 @@ int object_deform(Object *ob) dl->verts= fp= MEM_mallocN(3*sizeof(float)*me->totvert, "deform1"); for(a=0; a<me->totvert; a++, mvert++, fp+=3) { - if(lt_applyflag){ + if(applyflag){ calc_armature_deform(ob->parent, mvert->co, a); } else { @@ -528,7 +527,7 @@ int object_deform(Object *ob) dl->verts= fp= MEM_mallocN(3*sizeof(float)*me->totvert, "deform1"); for(a=0; a<me->totvert; a++, mvert++, fp+=3) { - if(lt_applyflag) calc_skel_deform(ika, mvert->co); + if(applyflag) calc_skel_deform(ika, mvert->co); else { VECCOPY(fp, mvert->co); calc_skel_deform(ika, fp); @@ -538,7 +537,7 @@ int object_deform(Object *ob) else if ELEM(ob->type, OB_CURVE, OB_SURF) { cu= ob->data; - if(lt_applyflag) { + if(applyflag) { Nurb *nu; BPoint *bp; @@ -579,6 +578,16 @@ int object_deform(Object *ob) } +int object_deform(Object *ob) +{ + return _object_deform(ob, 0); +} +int object_apply_deform(Object *ob) +{ + return _object_deform(ob, 1); +} + + BPoint *latt_bp(Lattice *lt, int u, int v, int w) { return lt->def+ u + v*lt->pntsu + w*lt->pntsu*lt->pntsv; diff --git a/source/blender/src/editlattice.c b/source/blender/src/editlattice.c index 4c5f660249e..634db966078 100644 --- a/source/blender/src/editlattice.c +++ b/source/blender/src/editlattice.c @@ -88,10 +88,7 @@ void apply_lattice(void) if TESTBASELIB(base) { if( (par= base->object->parent) ) { if(par->type==OB_LATTICE) { - - lt_applyflag= 1; - object_deform(base->object); - lt_applyflag= 0; + object_apply_deform(base->object); base->object->parent= 0; } |