Following Willian's proposal,deleted the print function, which caused crashes.
The objects are now printed with the repr function.
This commit is contained in:
@@ -44,7 +44,7 @@ PyTypeObject Build_Type =
|
||||
0, /* tp_itemsize */
|
||||
/* methods */
|
||||
(destructor)BuildDeAlloc, /* tp_dealloc */
|
||||
(printfunc)BuildPrint, /* tp_print */
|
||||
0, /* tp_print */
|
||||
(getattrfunc)BuildGetAttr, /* tp_getattr */
|
||||
(setattrfunc)BuildSetAttr, /* tp_setattr */
|
||||
0, /* tp_compare */
|
||||
@@ -72,7 +72,6 @@ int type = EFF_BUILD;
|
||||
BPy_Effect *pyeffect;
|
||||
Effect *bleffect = 0;
|
||||
|
||||
printf ("In Effect_New()\n");
|
||||
|
||||
bleffect = add_effect(type);
|
||||
if (bleffect == NULL)
|
||||
@@ -104,7 +103,6 @@ PyObject *M_Build_Get(PyObject *self, PyObject *args)
|
||||
Effect *eff;
|
||||
BPy_Build *wanted_eff;
|
||||
int num,i;
|
||||
printf ("In Effect_Get()\n");
|
||||
if (!PyArg_ParseTuple(args, "si", &name, &num ))
|
||||
return(EXPP_ReturnPyObjError(PyExc_AttributeError,\
|
||||
"expected string int argument"));
|
||||
@@ -267,11 +265,12 @@ int BuildSetAttr (BPy_Build *self, char *name, PyObject *value)
|
||||
/* Description: This is a callback function for the BPy_Build type. It */
|
||||
/* builds a meaninful string to 'print' build objects. */
|
||||
/*****************************************************************************/
|
||||
/*
|
||||
int BuildPrint(BPy_Build *self, FILE *fp, int flags)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
*/
|
||||
/*****************************************************************************/
|
||||
/* Function: BuildRepr */
|
||||
/* Description: This is a callback function for the BPy_Build type. It */
|
||||
@@ -279,14 +278,13 @@ int BuildPrint(BPy_Build *self, FILE *fp, int flags)
|
||||
/*****************************************************************************/
|
||||
PyObject *BuildRepr (BPy_Build *self)
|
||||
{
|
||||
return 0;
|
||||
return PyString_FromString("Build effect");
|
||||
}
|
||||
|
||||
PyObject* BuildCreatePyObject (struct Effect *build)
|
||||
{
|
||||
BPy_Build * blen_object;
|
||||
|
||||
printf ("In BuildCreatePyObject\n");
|
||||
|
||||
blen_object = (BPy_Build*)PyObject_NEW (BPy_Build, &Build_Type);
|
||||
|
||||
|
@@ -111,7 +111,7 @@ static PyMethodDef BPy_Build_methods[] = {
|
||||
/* Python Build_Type callback function prototypes: */
|
||||
/*****************************************************************************/
|
||||
void BuildDeAlloc (BPy_Build *msh);
|
||||
int BuildPrint (BPy_Build *msh, FILE *fp, int flags);
|
||||
//int BuildPrint (BPy_Build *msh, FILE *fp, int flags);
|
||||
int BuildSetAttr (BPy_Build *msh, char *name, PyObject *v);
|
||||
PyObject *BuildGetAttr (BPy_Build *msh, char *name);
|
||||
PyObject *BuildRepr (BPy_Build *msh);
|
||||
|
@@ -271,6 +271,7 @@ int EffectSetAttr (BPy_Effect *self, char *name, PyObject *value)
|
||||
/* Description: This is a callback function for the BPy_Effect type. It */
|
||||
/* builds a meaninful string to 'print' effcte objects. */
|
||||
/*****************************************************************************/
|
||||
/*
|
||||
int EffectPrint(BPy_Effect *self, FILE *fp, int flags)
|
||||
{
|
||||
if (self->effect->type == EFF_BUILD)puts("Effect Build");
|
||||
@@ -279,12 +280,13 @@ if (self->effect->type == EFF_WAVE)puts("Effect Wave");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
*/
|
||||
/*****************************************************************************/
|
||||
/* Function: EffectRepr */
|
||||
/* Description: This is a callback function for the BPy_Effect type. It */
|
||||
/* builds a meaninful string to represent effcte objects. */
|
||||
/*****************************************************************************/
|
||||
|
||||
PyObject *EffectRepr (BPy_Effect *self)
|
||||
{
|
||||
char*str="";
|
||||
|
@@ -72,7 +72,7 @@ PyObject *M_Effect_Get (PyObject *self, PyObject *args);
|
||||
/* Python Effect_Type callback function prototypes: */
|
||||
/*****************************************************************************/
|
||||
void EffectDeAlloc (BPy_Effect *msh);
|
||||
int EffectPrint (BPy_Effect *msh, FILE *fp, int flags);
|
||||
//int EffectPrint (BPy_Effect *msh, FILE *fp, int flags);
|
||||
int EffectSetAttr (BPy_Effect *msh, char *name, PyObject *v);
|
||||
PyObject *EffectGetAttr (BPy_Effect *msh, char *name);
|
||||
PyObject *EffectRepr (BPy_Effect *msh);
|
||||
@@ -91,7 +91,7 @@ static PyTypeObject Effect_Type =
|
||||
0, /* tp_itemsize */
|
||||
/* methods */
|
||||
(destructor)EffectDeAlloc, /* tp_dealloc */
|
||||
(printfunc)EffectPrint, /* tp_print */
|
||||
0, /* tp_print */
|
||||
(getattrfunc)EffectGetAttr, /* tp_getattr */
|
||||
(setattrfunc)EffectSetAttr, /* tp_setattr */
|
||||
0, /* tp_compare */
|
||||
|
@@ -442,12 +442,13 @@ static int IpoSetAttr (C_Ipo *self, char *name, PyObject *value)
|
||||
/* Description: This is a callback function for the C_Ipo type. It */
|
||||
/* builds a meaninful string to 'print' ipo objects. */
|
||||
/*****************************************************************************/
|
||||
/*
|
||||
static int IpoPrint(C_Ipo *self, FILE *fp, int flags)
|
||||
{
|
||||
fprintf(fp, "[Ipo \"%s\"]", self->ipo->id.name+2);
|
||||
return 0;
|
||||
}
|
||||
|
||||
*/
|
||||
/*****************************************************************************/
|
||||
/* Function: IpoRepr */
|
||||
/* Description: This is a callback function for the C_Ipo type. It */
|
||||
@@ -455,7 +456,7 @@ static int IpoPrint(C_Ipo *self, FILE *fp, int flags)
|
||||
/*****************************************************************************/
|
||||
static PyObject *IpoRepr (C_Ipo *self)
|
||||
{
|
||||
return PyString_FromString(self->ipo->id.name+2);
|
||||
return PyString_FromFormat("[Ipo \"%s\"]", self->ipo->id.name+2);
|
||||
}
|
||||
|
||||
/* Three Python Ipo_Type helper functions needed by the Object module: */
|
||||
|
@@ -144,7 +144,7 @@ static PyMethodDef C_Ipo_methods[] = {
|
||||
/* Python Ipo_Type callback function prototypes: */
|
||||
/*****************************************************************************/
|
||||
static void IpoDeAlloc (C_Ipo *self);
|
||||
static int IpoPrint (C_Ipo *self, FILE *fp, int flags);
|
||||
//static int IpoPrint (C_Ipo *self, FILE *fp, int flags);
|
||||
static int IpoSetAttr (C_Ipo *self, char *name, PyObject *v);
|
||||
static PyObject *IpoGetAttr (C_Ipo *self, char *name);
|
||||
static PyObject *IpoRepr (C_Ipo *self);
|
||||
@@ -161,7 +161,7 @@ PyTypeObject Ipo_Type =
|
||||
0, /* tp_itemsize */
|
||||
/* methods */
|
||||
(destructor)IpoDeAlloc, /* tp_dealloc */
|
||||
(printfunc)IpoPrint, /* tp_print */
|
||||
0, /* tp_print */
|
||||
(getattrfunc)IpoGetAttr, /* tp_getattr */
|
||||
(setattrfunc)IpoSetAttr, /* tp_setattr */
|
||||
0, /* tp_compare */
|
||||
|
@@ -44,7 +44,7 @@ PyTypeObject Metaball_Type =
|
||||
0, /* tp_itemsize */
|
||||
/* methods */
|
||||
(destructor)MetaballDeAlloc, /* tp_dealloc */
|
||||
(printfunc)MetaballPrint, /* tp_print */
|
||||
0, /* tp_print */
|
||||
(getattrfunc)MetaballGetAttr, /* tp_getattr */
|
||||
(setattrfunc)MetaballSetAttr, /* tp_setattr */
|
||||
0, /* tp_compare */
|
||||
@@ -671,13 +671,14 @@ static void MetaballDeAlloc (BPy_Metaball *self)
|
||||
{
|
||||
PyObject_DEL (self);
|
||||
}
|
||||
|
||||
/*
|
||||
static int MetaballPrint (BPy_Metaball *self, FILE *fp, int flags)
|
||||
{
|
||||
fprintf(fp, "[MetaBall \"%s\"]", self->metaball->id.name+2);
|
||||
return 0;
|
||||
|
||||
}
|
||||
*/
|
||||
/*****************************************************************************/
|
||||
/* Function: MetaballGetAttr */
|
||||
/* Description: This is a callback function for the BPy_Metaball type. It is */
|
||||
@@ -739,6 +740,6 @@ static int MetaballSetAttr (BPy_Metaball *self, char *name, PyObject *value)
|
||||
/*****************************************************************************/
|
||||
static PyObject *MetaballRepr (BPy_Metaball *self)
|
||||
{
|
||||
return PyString_FromString(self->metaball->id.name+2);
|
||||
return PyString_FromFormat("[Metaball \"%s\"]", self->metaball->id.name+2);
|
||||
}
|
||||
|
||||
|
@@ -186,7 +186,7 @@ static PyMethodDef BPy_Metaball_methods[] = {
|
||||
/* Python Metaball_Type callback function prototypes: */
|
||||
/*****************************************************************************/
|
||||
static void MetaballDeAlloc (BPy_Metaball *self);
|
||||
static int MetaballPrint (BPy_Metaball *self, FILE *fp, int flags);
|
||||
//static int MetaballPrint (BPy_Metaball *self, FILE *fp, int flags);
|
||||
static int MetaballSetAttr (BPy_Metaball *self, char *name, PyObject *v);
|
||||
static PyObject *MetaballGetAttr (BPy_Metaball *self, char *name);
|
||||
static PyObject *MetaballRepr (BPy_Metaball *self);
|
||||
|
@@ -137,7 +137,7 @@ PyTypeObject Particle_Type =
|
||||
0,
|
||||
|
||||
(destructor)ParticleDeAlloc,
|
||||
(printfunc)ParticlePrint,
|
||||
0,
|
||||
(getattrfunc)ParticleGetAttr,
|
||||
(setattrfunc)ParticleSetAttr,
|
||||
0,
|
||||
@@ -573,8 +573,6 @@ PyObject *Particle_setForce(BPy_Particle *self,PyObject *args)
|
||||
val[0] = PyFloat_AsDouble(PyTuple_GetItem(args,0));
|
||||
val[1] = PyFloat_AsDouble(PyTuple_GetItem(args,1));
|
||||
val[2] = PyFloat_AsDouble(PyTuple_GetItem(args,2));
|
||||
printf("In Particle_setForce %f %f %f \n",val[0],val[1],val[2]);
|
||||
printf("%d %d \n",PyTuple_Check(args),PyTuple_Size(args));
|
||||
/*
|
||||
if (!PyArg_ParseTuple(args, "fff", val,val+1,val+2 ))
|
||||
return(EXPP_ReturnPyObjError(PyExc_AttributeError,\
|
||||
@@ -859,12 +857,13 @@ int ParticleSetAttr (BPy_Particle *self, char *name, PyObject *value)
|
||||
/* Description: This is a callback function for the BPy_Particle type. It */
|
||||
/* particles a meaninful string to 'print' particle objects. */
|
||||
/*****************************************************************************/
|
||||
/*
|
||||
int ParticlePrint(BPy_Particle *self, FILE *fp, int flags)
|
||||
{
|
||||
printf("Hi, I'm a particle!");
|
||||
return 0;
|
||||
}
|
||||
|
||||
*/
|
||||
/*****************************************************************************/
|
||||
/* Function: ParticleRepr */
|
||||
/* Description: This is a callback function for the BPy_Particle type. It */
|
||||
|
@@ -107,7 +107,7 @@ PyObject *Particle_setDefvec(BPy_Particle *self,PyObject*a);
|
||||
/* Python Particle_Type callback function prototypes: */
|
||||
/*****************************************************************************/
|
||||
void ParticleDeAlloc (BPy_Particle *msh);
|
||||
int ParticlePrint (BPy_Particle *msh, FILE *fp, int flags);
|
||||
//int ParticlePrint (BPy_Particle *msh, FILE *fp, int flags);
|
||||
int ParticleSetAttr (BPy_Particle *msh, char *name, PyObject *v);
|
||||
PyObject *ParticleGetAttr (BPy_Particle *msh, char *name);
|
||||
PyObject *ParticleRepr (BPy_Particle *msh);
|
||||
|
@@ -73,7 +73,7 @@ PyTypeObject World_Type =
|
||||
0, /* tp_itemsize */
|
||||
/* methods */
|
||||
(destructor)World_DeAlloc, /* tp_dealloc */
|
||||
(printfunc)World_Print, /* tp_print */
|
||||
0, /* tp_print */
|
||||
(getattrfunc)World_GetAttr, /* tp_getattr */
|
||||
(setattrfunc)World_SetAttr, /* tp_setattr */
|
||||
(cmpfunc)World_Compare, /* tp_compare */
|
||||
@@ -838,11 +838,13 @@ static int World_Compare (BPy_World *a, BPy_World *b)
|
||||
* World. It builds a string with the name of the wrapped Blender World.
|
||||
*/
|
||||
|
||||
/*
|
||||
static int World_Print(BPy_World *self, FILE *fp, int flags)
|
||||
{
|
||||
fprintf(fp, "[World \"%s\"]", self->world->id.name+2);
|
||||
return 0;
|
||||
}
|
||||
*/
|
||||
|
||||
/**
|
||||
* \brief The World PyType repr callback
|
||||
@@ -853,7 +855,7 @@ static int World_Print(BPy_World *self, FILE *fp, int flags)
|
||||
|
||||
static PyObject *World_Repr (BPy_World *self)
|
||||
{
|
||||
return PyString_FromString(self->world->id.name+2);
|
||||
return PyString_FromFormat("[World \"%s\"]", self->world->id.name+2);
|
||||
}
|
||||
|
||||
/*@}*/
|
||||
|
Reference in New Issue
Block a user