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 */
|
0, /* tp_itemsize */
|
||||||
/* methods */
|
/* methods */
|
||||||
(destructor)BuildDeAlloc, /* tp_dealloc */
|
(destructor)BuildDeAlloc, /* tp_dealloc */
|
||||||
(printfunc)BuildPrint, /* tp_print */
|
0, /* tp_print */
|
||||||
(getattrfunc)BuildGetAttr, /* tp_getattr */
|
(getattrfunc)BuildGetAttr, /* tp_getattr */
|
||||||
(setattrfunc)BuildSetAttr, /* tp_setattr */
|
(setattrfunc)BuildSetAttr, /* tp_setattr */
|
||||||
0, /* tp_compare */
|
0, /* tp_compare */
|
||||||
@@ -72,7 +72,6 @@ int type = EFF_BUILD;
|
|||||||
BPy_Effect *pyeffect;
|
BPy_Effect *pyeffect;
|
||||||
Effect *bleffect = 0;
|
Effect *bleffect = 0;
|
||||||
|
|
||||||
printf ("In Effect_New()\n");
|
|
||||||
|
|
||||||
bleffect = add_effect(type);
|
bleffect = add_effect(type);
|
||||||
if (bleffect == NULL)
|
if (bleffect == NULL)
|
||||||
@@ -104,7 +103,6 @@ PyObject *M_Build_Get(PyObject *self, PyObject *args)
|
|||||||
Effect *eff;
|
Effect *eff;
|
||||||
BPy_Build *wanted_eff;
|
BPy_Build *wanted_eff;
|
||||||
int num,i;
|
int num,i;
|
||||||
printf ("In Effect_Get()\n");
|
|
||||||
if (!PyArg_ParseTuple(args, "si", &name, &num ))
|
if (!PyArg_ParseTuple(args, "si", &name, &num ))
|
||||||
return(EXPP_ReturnPyObjError(PyExc_AttributeError,\
|
return(EXPP_ReturnPyObjError(PyExc_AttributeError,\
|
||||||
"expected string int argument"));
|
"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 */
|
/* Description: This is a callback function for the BPy_Build type. It */
|
||||||
/* builds a meaninful string to 'print' build objects. */
|
/* builds a meaninful string to 'print' build objects. */
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
/*
|
||||||
int BuildPrint(BPy_Build *self, FILE *fp, int flags)
|
int BuildPrint(BPy_Build *self, FILE *fp, int flags)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/* Function: BuildRepr */
|
/* Function: BuildRepr */
|
||||||
/* Description: This is a callback function for the BPy_Build type. It */
|
/* 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)
|
PyObject *BuildRepr (BPy_Build *self)
|
||||||
{
|
{
|
||||||
return 0;
|
return PyString_FromString("Build effect");
|
||||||
}
|
}
|
||||||
|
|
||||||
PyObject* BuildCreatePyObject (struct Effect *build)
|
PyObject* BuildCreatePyObject (struct Effect *build)
|
||||||
{
|
{
|
||||||
BPy_Build * blen_object;
|
BPy_Build * blen_object;
|
||||||
|
|
||||||
printf ("In BuildCreatePyObject\n");
|
|
||||||
|
|
||||||
blen_object = (BPy_Build*)PyObject_NEW (BPy_Build, &Build_Type);
|
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: */
|
/* Python Build_Type callback function prototypes: */
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void BuildDeAlloc (BPy_Build *msh);
|
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);
|
int BuildSetAttr (BPy_Build *msh, char *name, PyObject *v);
|
||||||
PyObject *BuildGetAttr (BPy_Build *msh, char *name);
|
PyObject *BuildGetAttr (BPy_Build *msh, char *name);
|
||||||
PyObject *BuildRepr (BPy_Build *msh);
|
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 */
|
/* Description: This is a callback function for the BPy_Effect type. It */
|
||||||
/* builds a meaninful string to 'print' effcte objects. */
|
/* builds a meaninful string to 'print' effcte objects. */
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
/*
|
||||||
int EffectPrint(BPy_Effect *self, FILE *fp, int flags)
|
int EffectPrint(BPy_Effect *self, FILE *fp, int flags)
|
||||||
{
|
{
|
||||||
if (self->effect->type == EFF_BUILD)puts("Effect Build");
|
if (self->effect->type == EFF_BUILD)puts("Effect Build");
|
||||||
@@ -279,12 +280,13 @@ if (self->effect->type == EFF_WAVE)puts("Effect Wave");
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/* Function: EffectRepr */
|
/* Function: EffectRepr */
|
||||||
/* Description: This is a callback function for the BPy_Effect type. It */
|
/* Description: This is a callback function for the BPy_Effect type. It */
|
||||||
/* builds a meaninful string to represent effcte objects. */
|
/* builds a meaninful string to represent effcte objects. */
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
PyObject *EffectRepr (BPy_Effect *self)
|
PyObject *EffectRepr (BPy_Effect *self)
|
||||||
{
|
{
|
||||||
char*str="";
|
char*str="";
|
||||||
|
@@ -72,7 +72,7 @@ PyObject *M_Effect_Get (PyObject *self, PyObject *args);
|
|||||||
/* Python Effect_Type callback function prototypes: */
|
/* Python Effect_Type callback function prototypes: */
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void EffectDeAlloc (BPy_Effect *msh);
|
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);
|
int EffectSetAttr (BPy_Effect *msh, char *name, PyObject *v);
|
||||||
PyObject *EffectGetAttr (BPy_Effect *msh, char *name);
|
PyObject *EffectGetAttr (BPy_Effect *msh, char *name);
|
||||||
PyObject *EffectRepr (BPy_Effect *msh);
|
PyObject *EffectRepr (BPy_Effect *msh);
|
||||||
@@ -91,7 +91,7 @@ static PyTypeObject Effect_Type =
|
|||||||
0, /* tp_itemsize */
|
0, /* tp_itemsize */
|
||||||
/* methods */
|
/* methods */
|
||||||
(destructor)EffectDeAlloc, /* tp_dealloc */
|
(destructor)EffectDeAlloc, /* tp_dealloc */
|
||||||
(printfunc)EffectPrint, /* tp_print */
|
0, /* tp_print */
|
||||||
(getattrfunc)EffectGetAttr, /* tp_getattr */
|
(getattrfunc)EffectGetAttr, /* tp_getattr */
|
||||||
(setattrfunc)EffectSetAttr, /* tp_setattr */
|
(setattrfunc)EffectSetAttr, /* tp_setattr */
|
||||||
0, /* tp_compare */
|
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 */
|
/* Description: This is a callback function for the C_Ipo type. It */
|
||||||
/* builds a meaninful string to 'print' ipo objects. */
|
/* builds a meaninful string to 'print' ipo objects. */
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
/*
|
||||||
static int IpoPrint(C_Ipo *self, FILE *fp, int flags)
|
static int IpoPrint(C_Ipo *self, FILE *fp, int flags)
|
||||||
{
|
{
|
||||||
fprintf(fp, "[Ipo \"%s\"]", self->ipo->id.name+2);
|
fprintf(fp, "[Ipo \"%s\"]", self->ipo->id.name+2);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/* Function: IpoRepr */
|
/* Function: IpoRepr */
|
||||||
/* Description: This is a callback function for the C_Ipo type. It */
|
/* 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)
|
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: */
|
/* 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: */
|
/* Python Ipo_Type callback function prototypes: */
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
static void IpoDeAlloc (C_Ipo *self);
|
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 int IpoSetAttr (C_Ipo *self, char *name, PyObject *v);
|
||||||
static PyObject *IpoGetAttr (C_Ipo *self, char *name);
|
static PyObject *IpoGetAttr (C_Ipo *self, char *name);
|
||||||
static PyObject *IpoRepr (C_Ipo *self);
|
static PyObject *IpoRepr (C_Ipo *self);
|
||||||
@@ -161,7 +161,7 @@ PyTypeObject Ipo_Type =
|
|||||||
0, /* tp_itemsize */
|
0, /* tp_itemsize */
|
||||||
/* methods */
|
/* methods */
|
||||||
(destructor)IpoDeAlloc, /* tp_dealloc */
|
(destructor)IpoDeAlloc, /* tp_dealloc */
|
||||||
(printfunc)IpoPrint, /* tp_print */
|
0, /* tp_print */
|
||||||
(getattrfunc)IpoGetAttr, /* tp_getattr */
|
(getattrfunc)IpoGetAttr, /* tp_getattr */
|
||||||
(setattrfunc)IpoSetAttr, /* tp_setattr */
|
(setattrfunc)IpoSetAttr, /* tp_setattr */
|
||||||
0, /* tp_compare */
|
0, /* tp_compare */
|
||||||
|
@@ -44,7 +44,7 @@ PyTypeObject Metaball_Type =
|
|||||||
0, /* tp_itemsize */
|
0, /* tp_itemsize */
|
||||||
/* methods */
|
/* methods */
|
||||||
(destructor)MetaballDeAlloc, /* tp_dealloc */
|
(destructor)MetaballDeAlloc, /* tp_dealloc */
|
||||||
(printfunc)MetaballPrint, /* tp_print */
|
0, /* tp_print */
|
||||||
(getattrfunc)MetaballGetAttr, /* tp_getattr */
|
(getattrfunc)MetaballGetAttr, /* tp_getattr */
|
||||||
(setattrfunc)MetaballSetAttr, /* tp_setattr */
|
(setattrfunc)MetaballSetAttr, /* tp_setattr */
|
||||||
0, /* tp_compare */
|
0, /* tp_compare */
|
||||||
@@ -671,13 +671,14 @@ static void MetaballDeAlloc (BPy_Metaball *self)
|
|||||||
{
|
{
|
||||||
PyObject_DEL (self);
|
PyObject_DEL (self);
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
static int MetaballPrint (BPy_Metaball *self, FILE *fp, int flags)
|
static int MetaballPrint (BPy_Metaball *self, FILE *fp, int flags)
|
||||||
{
|
{
|
||||||
fprintf(fp, "[MetaBall \"%s\"]", self->metaball->id.name+2);
|
fprintf(fp, "[MetaBall \"%s\"]", self->metaball->id.name+2);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/* Function: MetaballGetAttr */
|
/* Function: MetaballGetAttr */
|
||||||
/* Description: This is a callback function for the BPy_Metaball type. It is */
|
/* 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)
|
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: */
|
/* Python Metaball_Type callback function prototypes: */
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
static void MetaballDeAlloc (BPy_Metaball *self);
|
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 int MetaballSetAttr (BPy_Metaball *self, char *name, PyObject *v);
|
||||||
static PyObject *MetaballGetAttr (BPy_Metaball *self, char *name);
|
static PyObject *MetaballGetAttr (BPy_Metaball *self, char *name);
|
||||||
static PyObject *MetaballRepr (BPy_Metaball *self);
|
static PyObject *MetaballRepr (BPy_Metaball *self);
|
||||||
|
@@ -137,7 +137,7 @@ PyTypeObject Particle_Type =
|
|||||||
0,
|
0,
|
||||||
|
|
||||||
(destructor)ParticleDeAlloc,
|
(destructor)ParticleDeAlloc,
|
||||||
(printfunc)ParticlePrint,
|
0,
|
||||||
(getattrfunc)ParticleGetAttr,
|
(getattrfunc)ParticleGetAttr,
|
||||||
(setattrfunc)ParticleSetAttr,
|
(setattrfunc)ParticleSetAttr,
|
||||||
0,
|
0,
|
||||||
@@ -573,8 +573,6 @@ PyObject *Particle_setForce(BPy_Particle *self,PyObject *args)
|
|||||||
val[0] = PyFloat_AsDouble(PyTuple_GetItem(args,0));
|
val[0] = PyFloat_AsDouble(PyTuple_GetItem(args,0));
|
||||||
val[1] = PyFloat_AsDouble(PyTuple_GetItem(args,1));
|
val[1] = PyFloat_AsDouble(PyTuple_GetItem(args,1));
|
||||||
val[2] = PyFloat_AsDouble(PyTuple_GetItem(args,2));
|
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 ))
|
if (!PyArg_ParseTuple(args, "fff", val,val+1,val+2 ))
|
||||||
return(EXPP_ReturnPyObjError(PyExc_AttributeError,\
|
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 */
|
/* Description: This is a callback function for the BPy_Particle type. It */
|
||||||
/* particles a meaninful string to 'print' particle objects. */
|
/* particles a meaninful string to 'print' particle objects. */
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
/*
|
||||||
int ParticlePrint(BPy_Particle *self, FILE *fp, int flags)
|
int ParticlePrint(BPy_Particle *self, FILE *fp, int flags)
|
||||||
{
|
{
|
||||||
printf("Hi, I'm a particle!");
|
printf("Hi, I'm a particle!");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/* Function: ParticleRepr */
|
/* Function: ParticleRepr */
|
||||||
/* Description: This is a callback function for the BPy_Particle type. It */
|
/* 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: */
|
/* Python Particle_Type callback function prototypes: */
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void ParticleDeAlloc (BPy_Particle *msh);
|
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);
|
int ParticleSetAttr (BPy_Particle *msh, char *name, PyObject *v);
|
||||||
PyObject *ParticleGetAttr (BPy_Particle *msh, char *name);
|
PyObject *ParticleGetAttr (BPy_Particle *msh, char *name);
|
||||||
PyObject *ParticleRepr (BPy_Particle *msh);
|
PyObject *ParticleRepr (BPy_Particle *msh);
|
||||||
|
@@ -73,7 +73,7 @@ PyTypeObject World_Type =
|
|||||||
0, /* tp_itemsize */
|
0, /* tp_itemsize */
|
||||||
/* methods */
|
/* methods */
|
||||||
(destructor)World_DeAlloc, /* tp_dealloc */
|
(destructor)World_DeAlloc, /* tp_dealloc */
|
||||||
(printfunc)World_Print, /* tp_print */
|
0, /* tp_print */
|
||||||
(getattrfunc)World_GetAttr, /* tp_getattr */
|
(getattrfunc)World_GetAttr, /* tp_getattr */
|
||||||
(setattrfunc)World_SetAttr, /* tp_setattr */
|
(setattrfunc)World_SetAttr, /* tp_setattr */
|
||||||
(cmpfunc)World_Compare, /* tp_compare */
|
(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.
|
* World. It builds a string with the name of the wrapped Blender World.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
static int World_Print(BPy_World *self, FILE *fp, int flags)
|
static int World_Print(BPy_World *self, FILE *fp, int flags)
|
||||||
{
|
{
|
||||||
fprintf(fp, "[World \"%s\"]", self->world->id.name+2);
|
fprintf(fp, "[World \"%s\"]", self->world->id.name+2);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief The World PyType repr callback
|
* \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)
|
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