Bugfix: some old dangling globals still crash lattice.
Editmode lattice has to be coded still, but now Mancandy
loads again :)
This commit is contained in:
Ton Roosendaal
2009-01-06 12:30:44 +00:00
parent fbd3eb99f2
commit 10e6566aeb

View File

@@ -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);
}