- added object_apply_deform, removed lt_applyflag global
authorDaniel Dunbar <daniel@zuster.org>
Sat, 20 Mar 2004 22:06:01 +0000 (22:06 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Sat, 20 Mar 2004 22:06:01 +0000 (22:06 +0000)
source/blender/blenkernel/BKE_lattice.h
source/blender/blenkernel/intern/lattice.c
source/blender/src/editlattice.c

index 98bc5a53537b873ac533ac76d0ecc743317b159c..a9a3ee2d6f9ff8b76cb524de72659bed699144e8 100644 (file)
@@ -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);
 
index 0cf7747c14a3a18b5e464efa6166907098e350c0..96d022ef1f196bc40b67d8b35bb02184ae382afa 100644 (file)
@@ -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;
index 4c5f660249eea8fd7f6705bb13015ba433b3a546..634db96607856bc330db79271b19ca78f70e4f7c 100644 (file)
@@ -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;
                                }