From 10e6566aebec1c1c623cd88c3887db7c113d5af9 Mon Sep 17 00:00:00 2001 From: Ton Roosendaal Date: Tue, 6 Jan 2009 12:30:44 +0000 Subject: 2.5 Bugfix: some old dangling globals still crash lattice. Editmode lattice has to be coded still, but now Mancandy loads again :) --- source/blender/blenkernel/intern/lattice.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'source/blender/blenkernel/intern/lattice.c') 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 #include #include @@ -72,13 +73,7 @@ //XXX #include "BIF_editdeform.h" -#ifdef HAVE_CONFIG_H -#include -#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; idef[i].vec); } -- cgit v1.2.3