diff options
author | Ton Roosendaal <ton@blender.org> | 2009-01-06 15:30:44 +0300 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2009-01-06 15:30:44 +0300 |
commit | 10e6566aebec1c1c623cd88c3887db7c113d5af9 (patch) | |
tree | 68726857179162c9de8f5f7631ac5d671100ff2d /source/blender/blenkernel/intern/lattice.c | |
parent | fbd3eb99f220026d17f6ccd12fe19c3e78d1b64f (diff) |
2.5
Bugfix: some old dangling globals still crash lattice.
Editmode lattice has to be coded still, but now Mancandy
loads again :)
Diffstat (limited to 'source/blender/blenkernel/intern/lattice.c')
-rw-r--r-- | source/blender/blenkernel/intern/lattice.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/source/blender/blenkernel/intern/lattice.c b/source/blender/blenkernel/intern/lattice.c index 48e931229b6..85256045d49 100644 --- a/source/blender/blenkernel/intern/lattice.c +++ b/source/blender/blenkernel/intern/lattice.c @@ -30,6 +30,7 @@ * ***** END GPL LICENSE BLOCK ***** */ + #include <stdio.h> #include <string.h> #include <math.h> @@ -72,13 +73,7 @@ //XXX #include "BIF_editdeform.h" -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - Lattice *editLatt=0; -static Lattice *deformLatt=0; - static float *latticedata=0, latmat[4][4]; void calc_lat_fudu(int flag, int res, float *fu, float *du) @@ -308,7 +303,7 @@ void init_latt_deform(Object *oblatt, Object *ob) if(lt->editlatt) lt= lt->editlatt; bp = lt->def; - fp= latticedata= MEM_mallocN(sizeof(float)*3*deformLatt->pntsu*deformLatt->pntsv*deformLatt->pntsw, "latticedata"); + fp= latticedata= MEM_mallocN(sizeof(float)*3*lt->pntsu*lt->pntsv*lt->pntsw, "latticedata"); /* for example with a particle system: ob==0 */ if(ob==0) { @@ -355,8 +350,6 @@ void calc_latt_deform(float *co, float weight) if(latticedata==0) return; - lt= deformLatt; /* just for shorter notation! */ - /* co is in local coords, treat with latmat */ VECCOPY(vec, co); @@ -873,11 +866,13 @@ float (*lattice_getVertexCos(struct Object *ob, int *numVerts_r))[3] { Lattice *lt = ob->data; int i, numVerts; - float (*vertexCos)[3] = MEM_mallocN(sizeof(*vertexCos)*numVerts,"lt_vcos"); + float (*vertexCos)[3]; if(lt->editlatt) lt= lt->editlatt; numVerts = *numVerts_r = lt->pntsu*lt->pntsv*lt->pntsw; + vertexCos = MEM_mallocN(sizeof(*vertexCos)*numVerts,"lt_vcos"); + for (i=0; i<numVerts; i++) { VECCOPY(vertexCos[i], lt->def[i].vec); } |