removed duplicate functionality, macro's and functions existed to check a PyObjects type, now only use macro's

This commit is contained in:
2007-03-15 01:09:14 +00:00
parent a567e43628
commit ee5dc4d0bf
66 changed files with 54 additions and 319 deletions

View File

@@ -1341,13 +1341,6 @@ struct bArmature *PyArmature_AsArmature(BPy_Armature *py_armature)
return (py_armature->armature);
}
// This function returns true when the given PyObject
// is of the type Sound. Otherwise it will return false
int Armature_CheckPyObject( PyObject * pyobj )
{
return ( pyobj->ob_type == &Armature_Type);
}
struct bArmature *Armature_FromPyObject( PyObject * py_obj )
{
return PyArmature_AsArmature((BPy_Armature*)py_obj);

View File

@@ -35,8 +35,8 @@
#include "DNA_armature_types.h"
//-------------------TYPE CHECKS---------------------------------
#define ArmatureObject_Check(v) ((v)->ob_type == &Armature_Type)
#define BonesDictObject_Check(v) ((v)->ob_type == &BonesDict_Type)
#define BPy_Armature_Check(v) ((v)->ob_type == &Armature_Type)
#define BPy_BonesDict_Check(v) ((v)->ob_type == &BonesDict_Type)
//-------------------MODULE INIT---------------------------------
PyObject *Armature_Init( void );
//-------------------TYPEOBJECT----------------------------------
@@ -65,7 +65,6 @@ struct bArmature *PyArmature_AsArmature(BPy_Armature *py_armature);
PyObject * Armature_RebuildEditbones(PyObject *pyarmature);
PyObject *Armature_RebuildBones(PyObject *pyarmature);
int Armature_CheckPyObject( PyObject * pyobj );
struct bArmature *Armature_FromPyObject( PyObject * py_obj );
#endif

View File

@@ -645,16 +645,6 @@ PyObject *BezTriple_CreatePyObject( BezTriple * bzt )
}
/*****************************************************************************/
/* Function: BezTriple_CheckPyObject */
/* Description: This function returns true when the given PyObject is of the */
/* type BezTriple. Otherwise it will return false. */
/*****************************************************************************/
int BezTriple_CheckPyObject( PyObject * pyobj )
{
return ( pyobj->ob_type == &BezTriple_Type );
}
/*****************************************************************************/
/* Function: BezTriple_FromPyObject */
/* Description: This function returns the Blender beztriple from the given */

View File

@@ -57,7 +57,6 @@ typedef struct {
*/
PyObject *BezTriple_CreatePyObject( BezTriple * bzt );
int BezTriple_CheckPyObject( PyObject * pyobj );
BezTriple *BezTriple_FromPyObject( PyObject * pyobj );
PyObject *newBezTriple( float *args );
PyObject *BezTriple_Init( void );

View File

@@ -350,11 +350,6 @@ PyObject *Camera_CreatePyObject( Camera * cam )
return ( PyObject * ) pycam;
}
int Camera_CheckPyObject( PyObject * pyobj )
{
return ( pyobj->ob_type == &Camera_Type );
}
Camera *Camera_FromPyObject( PyObject * pyobj )
{
return ( ( BPy_Camera * ) pyobj )->camera;

View File

@@ -77,7 +77,6 @@ typedef struct {
PyObject *Camera_Init( void );
PyObject *Camera_CreatePyObject( Camera * cam );
int Camera_CheckPyObject( PyObject * pyobj );
Camera *Camera_FromPyObject( PyObject * pyobj );
#endif /* EXPP_CAMERA_H */

View File

@@ -531,7 +531,7 @@ static int action_setter( BPy_Constraint *self, int type, PyObject *value )
}
case EXPP_CONSTR_ACTION: {
bAction *act = (( BPy_Action * )value)->action;
if( !Action_CheckPyObject( value ) )
if( !BPy_Action_Check( value ) )
return EXPP_ReturnIntError( PyExc_TypeError,
"expected BPy action argument" );
con->act = act;
@@ -1481,16 +1481,6 @@ PyObject *Constraint_CreatePyObject( bPoseChannel *pchan, Object *obj,
return ( PyObject * ) pycon;
}
/*****************************************************************************/
/* Function: Constraint_CheckPyObject */
/* Description: This function returns true when the given PyObject is of the */
/* type Constraint. Otherwise it will return false. */
/*****************************************************************************/
int Constraint_CheckPyObject( PyObject * pyobj )
{
return ( pyobj->ob_type == &Constraint_Type );
}
/*****************************************************************************/
/* Function: Constraint_FromPyObject */
/* Description: This function returns the Blender constraint from the given */

View File

@@ -69,7 +69,6 @@ PyObject *Constraint_Init( void );
PyObject *Constraint_CreatePyObject( bPoseChannel *pchan, Object *obj,
bConstraint *con );
bConstraint *Constraint_FromPyObject( BPy_Constraint * obj );
int Constraint_CheckPyObject( PyObject * py_obj );
PyObject *PoseConstraintSeq_CreatePyObject( bPoseChannel *pchan );
PyObject *ObConstraintSeq_CreatePyObject( Object *obj );

View File

@@ -475,7 +475,7 @@ PyObject *CurNurb_appendPointToNurb( Nurb * nurb, PyObject * args )
/* if curve is empty, adjust type depending on input type */
if (nurb->bezt==NULL && nurb->bp==NULL) {
if (BezTriple_CheckPyObject( pyOb ))
if (BPy_BezTriple_Check( pyOb ))
nurb->type |= CU_BEZIER;
else if (PySequence_Check( pyOb ))
nurb->type |= CU_NURBS;
@@ -489,7 +489,7 @@ PyObject *CurNurb_appendPointToNurb( Nurb * nurb, PyObject * args )
if ((nurb->type & 7)==CU_BEZIER) {
BezTriple *tmp;
if( !BezTriple_CheckPyObject( pyOb ) )
if( !BPy_BezTriple_Check( pyOb ) )
return( EXPP_ReturnPyObjError( PyExc_TypeError,
"Expected a BezTriple\n" ) );
@@ -810,7 +810,7 @@ static int CurNurb_length( PyInstanceObject * inst )
Nurb *nurb;
int len;
if( CurNurb_CheckPyObject( ( PyObject * ) inst ) ) {
if( BPy_CurNurb_Check( ( PyObject * ) inst ) ) {
nurb = ( ( BPy_CurNurb * ) inst )->nurb;
len = nurb->pntsu;
return len;
@@ -880,7 +880,7 @@ static int CurNurb_setPoint( BPy_CurNurb * self, int index, PyObject * pyOb )
/* branch by curve type */
if ((nurb->type & 7)==CU_BEZIER) { /* BEZIER */
/* check parameter type */
if( !BezTriple_CheckPyObject( pyOb ) )
if( !BPy_BezTriple_Check( pyOb ) )
return EXPP_ReturnIntError( PyExc_TypeError,
"expected a BezTriple" );
@@ -1064,11 +1064,6 @@ PyObject *CurNurb_switchDirection( BPy_CurNurb * self )
Py_RETURN_NONE;
}
int CurNurb_CheckPyObject( PyObject * py_obj )
{
return ( py_obj->ob_type == &CurNurb_Type );
}
PyObject *CurNurb_Init( void )
{
if( PyType_Ready( &CurNurb_Type ) < 0)

View File

@@ -60,7 +60,6 @@ typedef struct {
PyObject *CurNurb_Init( void );
PyObject *CurNurb_CreatePyObject( Nurb * bzt );
int CurNurb_CheckPyObject( PyObject * pyobj );
Nurb *CurNurb_FromPyObject( PyObject * pyobj );
PyObject *CurNurb_getPoint( BPy_CurNurb * self, int index );

View File

@@ -1039,7 +1039,7 @@ static PyObject *Curve_getBevOb( BPy_Curve * self)
static int Curve_newsetBevOb( BPy_Curve * self, PyObject * args )
{
if (Object_CheckPyObject( args ) && ((BPy_Object *)args)->object->data == self->curve )
if (BPy_Object_Check( args ) && ((BPy_Object *)args)->object->data == self->curve )
return EXPP_ReturnIntError( PyExc_ValueError,
"Can't bevel an object to itself" );
@@ -1066,7 +1066,7 @@ static PyObject *Curve_getTaperOb( BPy_Curve * self)
static int Curve_newsetTaperOb( BPy_Curve * self, PyObject * args )
{
if (Object_CheckPyObject( args ) && ((BPy_Object *)args)->object->data == self->curve )
if (BPy_Object_Check( args ) && ((BPy_Object *)args)->object->data == self->curve )
return EXPP_ReturnIntError( PyExc_ValueError,
"Can't taper an object to itself" );
@@ -1160,7 +1160,7 @@ static PyObject *Curve_iterNext( BPy_Curve * self )
static int Curve_length( PyInstanceObject * inst )
{
if( Curve_CheckPyObject( ( PyObject * ) inst ) )
if( BPy_Curve_Check( ( PyObject * ) inst ) )
return ( ( int ) PyInt_AsLong
( Curve_getNumCurves( ( BPy_Curve * ) inst ) ) );
@@ -1663,12 +1663,6 @@ PyObject *Curve_CreatePyObject( struct Curve * curve )
}
int Curve_CheckPyObject( PyObject * py_obj )
{
return ( py_obj->ob_type == &Curve_Type );
}
struct Curve *Curve_FromPyObject( PyObject * py_obj )
{
BPy_Curve *blen_obj;

View File

@@ -55,7 +55,6 @@ typedef struct {
PyObject *Curve_Init( void );
PyObject *Curve_CreatePyObject( struct Curve * curve );
int Curve_CheckPyObject( PyObject * py_obj );
struct Curve *Curve_FromPyObject( PyObject * py_obj );
PyObject *Curve_update( BPy_Curve * self );

View File

@@ -1709,7 +1709,7 @@ static PyObject *Method_Image( PyObject * self, PyObject * args )
"expected a Blender.Image and 2 floats, and " \
"optionally 2 floats and 4 ints as arguments" );
/* check that the first PyObject is actually a Blender.Image */
if( !Image_CheckPyObject( pyObjImage ) )
if( !BPy_Image_Check( pyObjImage ) )
return EXPP_ReturnPyObjError( PyExc_TypeError,
"expected a Blender.Image and 2 floats, and " \
"optionally 2 floats and 4 ints as arguments" );

View File

@@ -402,12 +402,6 @@ PyObject *Font_CreatePyObject( struct VFont * font )
return ( ( PyObject * ) blen_font );
}
/*--------------- Font_CheckPyObject--------------------------------*/
int Font_CheckPyObject( PyObject * py_obj )
{
return ( py_obj->ob_type == &Font_Type );
}
/*--------------- Font_FromPyObject---------------------------------*/
struct VFont *Font_FromPyObject( PyObject * py_obj )
{

View File

@@ -45,7 +45,6 @@ typedef struct {
/*------------------------------visible prototypes----------------------*/
PyObject *Font_CreatePyObject( struct VFont * font );
int Font_CheckPyObject( PyObject * py_obj );
struct VFont *Font_FromPyObject( PyObject * py_obj );
PyObject *Font_Init( void );

View File

@@ -514,16 +514,6 @@ PyObject *Group_CreatePyObject( struct Group * grp )
return ( ( PyObject * ) pygrp );
}
/*****************************************************************************/
/* Function: Group_CheckPyObject */
/* Description: This function returns true when the given PyObject is of the */
/* type Group. Otherwise it will return false. */
/*****************************************************************************/
int Group_CheckPyObject( PyObject * py_grp)
{
return ( py_grp->ob_type == &Group_Type );
}
/*****************************************************************************/
/* Function: Group_FromPyObject */
/* Description: This function returns the Blender group from the given */

View File

@@ -62,6 +62,5 @@ typedef struct {
PyObject *Group_Init( void );
PyObject *Group_CreatePyObject( struct Group *group );
Group *Group_FromPyObject( PyObject * py_obj );
int Group_CheckPyObject( PyObject * py_obj );
#endif /* EXPP_GROUP_H */

View File

@@ -781,16 +781,6 @@ PyObject *Image_CreatePyObject( Image * image )
return ( PyObject * ) py_img;
}
/*****************************************************************************/
/* Function: Image_CheckPyObject */
/* Description: This function returns true when the given PyObject is of the */
/* type Image. Otherwise it will return false. */
/*****************************************************************************/
int Image_CheckPyObject( PyObject * pyobj )
{
return ( pyobj->ob_type == &Image_Type );
}
/*****************************************************************************/
/* Function: Image_FromPyObject */
/* Description: Returns the Blender Image associated with this object */

View File

@@ -55,7 +55,6 @@ extern PyTypeObject Image_Type; /* The Image PyType Object */
/*****************************************************************************/
PyObject *Image_Init( void );
PyObject *Image_CreatePyObject( Image * image );
int Image_CheckPyObject( PyObject * pyobj );
Image *Image_FromPyObject( PyObject * pyobj );
#endif /* EXPP_IMAGE_H */

View File

@@ -1350,16 +1350,6 @@ PyObject *Ipo_CreatePyObject( Ipo * ipo )
return ( PyObject * ) pyipo;
}
/*****************************************************************************/
/* Function: Ipo_CheckPyObject */
/* Description: This function returns true when the given PyObject is of the */
/* type Ipo. Otherwise it will return false. */
/*****************************************************************************/
int Ipo_CheckPyObject( PyObject * pyobj )
{
return ( pyobj->ob_type == &Ipo_Type );
}
/*****************************************************************************/
/* Function: Ipo_FromPyObject */
/* Description: This function returns the Blender ipo from the given */

View File

@@ -58,7 +58,6 @@ extern PyTypeObject Ipo_Type;
PyObject *Ipo_Init( void );
PyObject *Ipo_CreatePyObject( struct Ipo *ipo );
Ipo *Ipo_FromPyObject( PyObject * py_obj );
int Ipo_CheckPyObject( PyObject * py_obj );
#endif /* EXPP_IPO_H */

View File

@@ -704,16 +704,6 @@ PyObject *IpoCurve_CreatePyObject( IpoCurve * icu )
return ( PyObject * ) pyipo;
}
/*****************************************************************************/
/* Function: IpoCurve_CheckPyObject */
/* Description: This function returns true when the given PyObject is of the */
/* type IpoCurve. Otherwise it will return false. */
/*****************************************************************************/
int IpoCurve_CheckPyObject( PyObject * pyobj )
{
return ( pyobj->ob_type == &IpoCurve_Type );
}
/*****************************************************************************/
/* Function: IpoCurve_FromPyObject */
/* Description: This function returns the Blender ipo from the given */

View File

@@ -49,7 +49,6 @@ extern PyTypeObject IpoCurve_Type;
PyObject *IpoCurve_Init( void );
PyObject *IpoCurve_CreatePyObject( IpoCurve * ipo );
int IpoCurve_CheckPyObject( PyObject * pyobj );
IpoCurve *IpoCurve_FromPyObject( PyObject * pyobj );
char *getIpoCurveName( IpoCurve * icu );

View File

@@ -837,16 +837,6 @@ PyObject *Lamp_CreatePyObject( Lamp * lamp )
return ( PyObject * ) pylamp;
}
/*****************************************************************************/
/* Function: Lamp_CheckPyObject */
/* Description: This function returns true when the given PyObject is of the */
/* type Lamp. Otherwise it will return false. */
/*****************************************************************************/
int Lamp_CheckPyObject( PyObject * pyobj )
{
return ( pyobj->ob_type == &Lamp_Type );
}
/*****************************************************************************/
/* Function: Lamp_FromPyObject */
/* Description: This function returns the Blender lamp from the given */

View File

@@ -57,6 +57,5 @@ typedef struct {
PyObject *Lamp_Init( void );
PyObject *Lamp_CreatePyObject( struct Lamp *lamp );
Lamp *Lamp_FromPyObject( PyObject * pyobj );
int Lamp_CheckPyObject( PyObject * pyobj );
#endif /* EXPP_LAMP_H */

View File

@@ -151,14 +151,6 @@ Lattice *Lattice_FromPyObject( PyObject * pyobj )
return ( ( BPy_Lattice * ) pyobj )->lattice;
}
//***************************************************************************
// Function: Lattice_CheckPyObject
//***************************************************************************
int Lattice_CheckPyObject( PyObject * pyobj )
{
return ( pyobj->ob_type == &Lattice_Type );
}
//***************************************************************************
// Function: M_Lattice_New
// Python equivalent: Blender.Lattice.New

View File

@@ -39,6 +39,8 @@
/* The Group PyTypeObject defined in Lattice.c */
extern PyTypeObject Lattice_Type;
#define BPy_Lattice_Check(v) ((v)->ob_type == &Lattice_Type)
/*****************************************************************************/
/* Python BPy_Lattice structure definition: */
/*****************************************************************************/
@@ -54,6 +56,5 @@ typedef struct {
PyObject *Lattice_Init( void );
PyObject *Lattice_CreatePyObject( Lattice * lt );
Lattice *Lattice_FromPyObject( PyObject * pyobj );
int Lattice_CheckPyObject( PyObject * pyobj );
#endif /* EXPP_LATTICE_H */

View File

@@ -271,13 +271,6 @@ MTex *MTex_FromPyObject( PyObject * pyobj )
return ( ( BPy_MTex * ) pyobj )->mtex;
}
int MTex_CheckPyObject( PyObject * pyobj )
{
return ( pyobj->ob_type == &MTex_Type );
}
/*****************************************************************************/
/* Python BPy_MTex methods: */
/*****************************************************************************/

View File

@@ -57,7 +57,6 @@ extern PyTypeObject MTex_Type;
PyObject *MTex_Init( void );
PyObject *MTex_CreatePyObject( struct MTex *obj );
int MTex_CheckPyObject( PyObject * py_obj );
MTex *MTex_FromPyObject( PyObject * py_obj );

View File

@@ -281,7 +281,7 @@ static int MainSeq_setActive(BPy_MainSeq *self, PyObject *value)
{
switch (self->type) {
case ID_SCE:
if (!Scene_CheckPyObject(value)) {
if (!BPy_Scene_Check(value)) {
return EXPP_ReturnIntError(PyExc_TypeError,
"Must be a scene" );
} else {
@@ -303,7 +303,7 @@ static int MainSeq_setActive(BPy_MainSeq *self, PyObject *value)
return 0;
case ID_IM:
if (!Image_CheckPyObject(value)) {
if (!BPy_Image_Check(value)) {
return EXPP_ReturnIntError(PyExc_TypeError,
"Must be a scene" );
} else {

View File

@@ -1216,16 +1216,6 @@ PyObject *Material_CreatePyObject( struct Material *mat )
return ( PyObject * ) pymat;
}
/*****************************************************************************/
/* Function: Material_CheckPyObject */
/* Description: This function returns true when the given PyObject is of the */
/* type Material. Otherwise it will return false. */
/*****************************************************************************/
int Material_CheckPyObject( PyObject * pyobj )
{
return ( pyobj->ob_type == &Material_Type );
}
/*****************************************************************************/
/* Function: Material_FromPyObject */
/* Description: This function returns the Blender material from the given */
@@ -2580,7 +2570,7 @@ Material **EXPP_newMaterialList_fromPyList( PyObject * list )
pymat = ( BPy_Material * ) PySequence_GetItem( list, i );
if( Material_CheckPyObject( ( PyObject * ) pymat ) ) {
if( BPy_Material_Check( ( PyObject * ) pymat ) ) {
mat = pymat->material;
matlist[i] = mat;
} else if( ( PyObject * ) pymat == Py_None ) {

View File

@@ -62,7 +62,6 @@ PyObject *M_Material_Init( void );
PyObject *Material_Init( void );
PyObject *Material_CreatePyObject( Material * mat );
Material *Material_FromPyObject( PyObject * pyobj );
int Material_CheckPyObject( PyObject * pyobj );
/* colorband tp_getseters */
PyObject *EXPP_PyList_fromColorband( ColorBand *coba );

View File

@@ -5654,7 +5654,7 @@ static PyObject *Mesh_getFromObject( BPy_Mesh * self, PyObject * args )
ob = ( Object * ) GetIdFromList( &( G.main->object ), name );
if( !ob )
return EXPP_ReturnPyObjError( PyExc_AttributeError, name );
} else if ( Object_CheckPyObject(object_arg) ) {
} else if ( BPy_Object_Check(object_arg) ) {
ob = (( BPy_Object * ) object_arg)->object;
} else {
return EXPP_ReturnPyObjError( PyExc_TypeError,
@@ -8181,10 +8181,6 @@ PyObject *Mesh_CreatePyObject( Mesh * me, Object *obj )
return ( PyObject * ) nmesh;
}
int Mesh_CheckPyObject( PyObject * pyobj )
{
return ( pyobj->ob_type == &Mesh_Type );
}
Mesh *Mesh_FromPyObject( PyObject * pyobj, Object *obj )
{

View File

@@ -122,7 +122,6 @@ typedef struct {
PyObject *Mesh_Init( void );
PyObject *Mesh_CreatePyObject( Mesh * me, Object *obj );
int Mesh_CheckPyObject( PyObject * pyobj );
Mesh *Mesh_FromPyObject( PyObject * pyobj, Object *obj );
#endif /* EXPP_MESH_H */

View File

@@ -544,14 +544,6 @@ PyObject *Metaball_Init( void )
return submodule;
}
int Metaball_CheckPyObject( PyObject * pyobj )
{
return ( pyobj->ob_type == &Metaball_Type );
}
MetaBall *Metaball_FromPyObject( PyObject * pyobj )
{
return ( ( BPy_Metaball * ) pyobj )->metaball;

View File

@@ -77,6 +77,5 @@ typedef struct {
PyObject *Metaball_Init( void );
PyObject *Metaball_CreatePyObject( MetaBall * mball );
MetaBall *Metaball_FromPyObject( PyObject * py_obj );
int Metaball_CheckPyObject( PyObject * py_obj );
#endif /* EXPP_METABALL_H */

View File

@@ -1020,16 +1020,6 @@ PyObject *Modifier_CreatePyObject( Object *ob, ModifierData * md )
return ( PyObject * ) pymod;
}
/*****************************************************************************/
/* Function: Modifier_CheckPyObject */
/* Description: This function returns true when the given PyObject is of the */
/* type Modifier. Otherwise it will return false. */
/*****************************************************************************/
int Modifier_CheckPyObject( PyObject * pyobj )
{
return ( pyobj->ob_type == &Modifier_Type );
}
/*****************************************************************************/
/* Function: Modifier_FromPyObject */
/* Description: This function returns the Blender modifier from the given */

View File

@@ -68,6 +68,5 @@ PyObject *Modifier_Init( void );
PyObject *ModSeq_CreatePyObject( Object *obj, ModifierData *iter );
PyObject *Modifier_CreatePyObject( Object *obj, ModifierData *md );
ModifierData *Modifier_FromPyObject( PyObject * py_obj );
int Modifier_CheckPyObject( PyObject * py_obj );
#endif /* EXPP_MODIFIER_H */

View File

@@ -405,12 +405,6 @@ PyObject *Action_CreatePyObject( struct bAction * act )
return ( ( PyObject * ) blen_action );
}
/*----------------------------------------------------------------------*/
int Action_CheckPyObject( PyObject * py_obj )
{
return ( py_obj->ob_type == &Action_Type );
}
/*----------------------------------------------------------------------*/
struct bAction *Action_FromPyObject( PyObject * py_obj )
{

View File

@@ -69,7 +69,6 @@ typedef struct {
#define BPy_ActionStrips_Check(v) ((v)->ob_type == &ActionStrips_Type)
PyObject *Action_CreatePyObject( struct bAction *action );
int Action_CheckPyObject( PyObject * py_obj );
bAction *Action_FromPyObject( PyObject * py_obj );
PyObject *ActionStrip_CreatePyObject( struct bActionStrip *strip );

View File

@@ -2807,7 +2807,7 @@ PyObject *NMesh_assignMaterials_toObject( BPy_NMesh * nmesh, Object * ob )
pymat = ( BPy_Material * ) PySequence_GetItem( nmesh->
materials, i );
if( Material_CheckPyObject( ( PyObject * ) pymat ) ) {
if( BPy_Material_Check( ( PyObject * ) pymat ) ) {
ma = pymat->material;
assign_material( ob, ma, i + 1 ); /*@ XXX don't use this function anymore */
} else {
@@ -3357,11 +3357,6 @@ PyObject *NMesh_CreatePyObject( Mesh * me, Object * ob )
return ( PyObject * ) nmesh;
}
int NMesh_CheckPyObject( PyObject * pyobj )
{
return ( pyobj->ob_type == &NMesh_Type );
}
Mesh *NMesh_FromPyObject( PyObject * pyobj, Object * ob )
{
if( pyobj->ob_type == &NMesh_Type ) {

View File

@@ -145,8 +145,6 @@ typedef struct {
PyObject *NMesh_Init( void );
PyObject *NMesh_CreatePyObject( Mesh * me, Object * ob );
Mesh *NMesh_FromPyObject( PyObject * pyobj, Object * ob );
int NMesh_CheckPyObject( PyObject * pyobj );
void mesh_update( Mesh * mesh , Object * ob );
PyObject *new_NMesh( Mesh * oldmesh );

View File

@@ -1587,25 +1587,25 @@ static PyObject *Object_link( BPy_Object * self, PyObject * args )
return EXPP_ReturnPyObjError( PyExc_TypeError,
"expected an object as argument" );
if( ArmatureObject_Check( py_data ) )
if( BPy_Armature_Check( py_data ) )
data = ( void * ) PyArmature_AsArmature((BPy_Armature*)py_data);
else if( Camera_CheckPyObject( py_data ) )
else if( BPy_Camera_Check( py_data ) )
data = ( void * ) Camera_FromPyObject( py_data );
else if( Lamp_CheckPyObject( py_data ) )
else if( BPy_Lamp_Check( py_data ) )
data = ( void * ) Lamp_FromPyObject( py_data );
else if( Curve_CheckPyObject( py_data ) )
else if( BPy_Curve_Check( py_data ) )
data = ( void * ) Curve_FromPyObject( py_data );
else if( NMesh_CheckPyObject( py_data ) ) {
else if( BPy_NMesh_Check( py_data ) ) {
data = ( void * ) NMesh_FromPyObject( py_data, self->object );
if( !data ) /* NULL means there is already an error */
return NULL;
} else if( Mesh_CheckPyObject( py_data ) )
} else if( BPy_Mesh_Check( py_data ) )
data = ( void * ) Mesh_FromPyObject( py_data, self->object );
else if( Lattice_CheckPyObject( py_data ) )
else if( BPy_Lattice_Check( py_data ) )
data = ( void * ) Lattice_FromPyObject( py_data );
else if( Metaball_CheckPyObject( py_data ) )
else if( BPy_Metaball_Check( py_data ) )
data = ( void * ) Metaball_FromPyObject( py_data );
else if( Text3d_CheckPyObject( py_data ) )
else if( BPy_Text3d_Check( py_data ) )
data = ( void * ) Text3d_FromPyObject( py_data );
/* have we set data to something good? */
@@ -1988,7 +1988,7 @@ static PyObject *Object_join( BPy_Object * self, PyObject * args )
/* Check if the PyObject passed in list is a Blender object. */
for( i = 0; i < list_length; i++ ) {
py_child = PySequence_GetItem( list, i );
if( !Object_CheckPyObject( py_child ) ) {
if( !BPy_Object_Check( py_child ) ) {
/* Cleanup */
free_libblock( &G.main->scene, temp_scene );
Py_DECREF( py_child );
@@ -2084,7 +2084,7 @@ static PyObject *internal_makeParent(Object *parent, PyObject *py_child,
{
Object *child = NULL;
if( Object_CheckPyObject( py_child ) )
if( BPy_Object_Check( py_child ) )
child = ( Object * ) Object_FromPyObject( py_child );
if( child == NULL )
@@ -2843,7 +2843,7 @@ static PyObject *Object_removeProperty( BPy_Object * self, PyObject * args )
/* we accept either a property stringname or actual object */
if( PyTuple_Size( args ) == 1 ) {
PyObject *prop = PyTuple_GET_ITEM( args, 0 );
if( Property_CheckPyObject( prop ) )
if( BPy_Property_Check( prop ) )
py_prop = (BPy_Property *)prop;
else
prop_name = PyString_AsString( prop );
@@ -3100,16 +3100,6 @@ PyObject *Object_CreatePyObject( struct Object * obj )
return ( ( PyObject * ) blen_object );
}
/*****************************************************************************/
/* Function: Object_CheckPyObject */
/* Description: This function returns true when the given PyObject is of the */
/* type Object. Otherwise it will return false. */
/*****************************************************************************/
int Object_CheckPyObject( PyObject * py_obj )
{
return ( py_obj->ob_type == &Object_Type );
}
/*****************************************************************************/
/* Function: Object_FromPyObject */
/* Description: This function returns the Blender object from the given */

View File

@@ -54,7 +54,6 @@ typedef struct {
PyObject *Object_Init( void );
PyObject *Object_CreatePyObject( struct Object *obj );
Object *Object_FromPyObject( PyObject * py_obj );
int Object_CheckPyObject( PyObject * py_obj );
void Object_updateDag( void *data );

View File

@@ -36,9 +36,9 @@
#include "DNA_object_types.h"
//-------------------TYPE CHECKS---------------------------------
#define PoseObject_Check(v) ((v)->ob_type == &Pose_Type)
#define PoseBoneObject_Check(v) ((v)->ob_type == &PoseBone_Type)
#define PoseBonesDictObject_Check(v) ((v)->ob_type == &PoseBonesDict_Type)
#define BPy_Pose_Check(v) ((v)->ob_type == &Pose_Type)
#define BPy_PoseBone_Check(v) ((v)->ob_type == &PoseBone_Type)
#define BPy_PoseBonesDict_Check(v) ((v)->ob_type == &PoseBonesDict_Type)
//-------------------TYPEOBJECT----------------------------------
extern PyTypeObject Pose_Type;
extern PyTypeObject PoseBone_Type;

View File

@@ -592,12 +592,6 @@ PyObject *Scene_CreatePyObject( Scene * scene )
return ( PyObject * ) pyscene;
}
/*-----------------------CheckPyObject----------------------------------*/
int Scene_CheckPyObject( PyObject * pyobj )
{
return ( pyobj->ob_type == &Scene_Type );
}
/*-----------------------FromPyObject-----------------------------------*/
Scene *Scene_FromPyObject( PyObject * pyobj )
{
@@ -1459,33 +1453,33 @@ static PyObject *SceneObSeq_new( BPy_SceneObSeq * self, PyObject *args )
return EXPP_ReturnPyObjError( PyExc_TypeError,
"scene.objects.new(obdata) - expected obdata to be\n\ta python obdata type or the string 'Empty'" );
if( Armature_CheckPyObject( py_data ) ) {
if( BPy_Armature_Check( py_data ) ) {
data = ( void * ) Armature_FromPyObject( py_data );
type = OB_ARMATURE;
} else if( Camera_CheckPyObject( py_data ) ) {
} else if( BPy_Camera_Check( py_data ) ) {
data = ( void * ) Camera_FromPyObject( py_data );
type = OB_CAMERA;
} else if( Lamp_CheckPyObject( py_data ) ) {
} else if( BPy_Lamp_Check( py_data ) ) {
data = ( void * ) Lamp_FromPyObject( py_data );
type = OB_LAMP;
} else if( Curve_CheckPyObject( py_data ) ) {
} else if( BPy_Curve_Check( py_data ) ) {
data = ( void * ) Curve_FromPyObject( py_data );
type = OB_CURVE;
} else if( NMesh_CheckPyObject( py_data ) ) {
} else if( BPy_NMesh_Check( py_data ) ) {
data = ( void * ) NMesh_FromPyObject( py_data, NULL );
type = OB_MESH;
if( !data ) /* NULL means there is already an error */
return NULL;
} else if( Mesh_CheckPyObject( py_data ) ) {
} else if( BPy_Mesh_Check( py_data ) ) {
data = ( void * ) Mesh_FromPyObject( py_data, NULL );
type = OB_MESH;
} else if( Lattice_CheckPyObject( py_data ) ) {
} else if( BPy_Lattice_Check( py_data ) ) {
data = ( void * ) Lattice_FromPyObject( py_data );
type = OB_LATTICE;
} else if( Metaball_CheckPyObject( py_data ) ) {
} else if( BPy_Metaball_Check( py_data ) ) {
data = ( void * ) Metaball_FromPyObject( py_data );
type = OB_MBALL;
} else if( Text3d_CheckPyObject( py_data ) ) {
} else if( BPy_Text3d_Check( py_data ) ) {
data = ( void * ) Text3d_FromPyObject( py_data );
type = OB_FONT;
} else if( ( desc = PyString_AsString( (PyObject *)py_data ) ) != NULL ) {

View File

@@ -66,6 +66,5 @@ typedef struct {
PyObject *Scene_Init( void );
PyObject *Scene_CreatePyObject( Scene * scene );
/*Scene *Scene_FromPyObject( PyObject * pyobj );*/ /* not used yet */
int Scene_CheckPyObject( PyObject * pyobj );
#endif /* EXPP_SCENE_H */

View File

@@ -349,16 +349,6 @@ PyObject *Sound_CreatePyObject( bSound * snd )
return ( PyObject * ) py_snd;
}
/*****************************************************************************/
/* Function: Sound_CheckPyObject */
/* Description: This function returns true when the given PyObject is of the */
/* type Sound. Otherwise it will return false. */
/*****************************************************************************/
int Sound_CheckPyObject( PyObject * pyobj )
{
return ( pyobj->ob_type == &Sound_Type );
}
/*****************************************************************************/
/* Function: Sound_FromPyObject */
/* Description: Returns the Blender Sound associated with this object */

View File

@@ -53,6 +53,5 @@ typedef struct {
PyObject *Sound_Init( void );
PyObject *Sound_CreatePyObject( bSound * sound );
bSound *Sound_FromPyObject( PyObject * pyobj );
int Sound_CheckPyObject( PyObject * pyobj );
#endif /* EXPP_SOUND_H */

View File

@@ -105,7 +105,7 @@ static PyObject *SurfNurb_appendPointToNurb( Nurb * nurb, PyObject * args )
/* if curve is empty, adjust type depending on input type */
if (nurb->bezt==NULL && nurb->bp==NULL) {
if (BezTriple_CheckPyObject( pyOb ))
if (BPy_BezTriple_Check( pyOb ))
nurb->type |= CU_BEZIER;
else if (PySequence_Check( pyOb ))
nurb->type |= CU_NURBS;
@@ -119,7 +119,7 @@ static PyObject *SurfNurb_appendPointToNurb( Nurb * nurb, PyObject * args )
if ((nurb->type & 7)==CU_BEZIER) {
BezTriple *tmp;
if( !BezTriple_CheckPyObject( pyOb ) )
if( !BPy_BezTriple_Check( pyOb ) )
return( EXPP_ReturnPyObjError( PyExc_TypeError,
"Expected a BezTriple\n" ) );
@@ -517,7 +517,7 @@ static int SurfNurb_length( PyInstanceObject * inst )
{
Nurb *nurb;
if( SurfNurb_CheckPyObject( ( PyObject * ) inst ) ) {
if( BPy_SurfNurb_Check( ( PyObject * ) inst ) ) {
nurb = ( ( BPy_SurfNurb * ) inst )->nurb;
return (int)(nurb->pntsu * nurb->pntsu);
}
@@ -577,7 +577,7 @@ static int SurfNurb_setPoint( BPy_SurfNurb * self, int index, PyObject * pyOb )
#if 0
if ((nurb->type & 7)==CU_BEZIER) { /* BEZIER */
/* check parameter type */
if( !BezTriple_CheckPyObject( pyOb ) )
if( !BPy_BezTriple_Check( pyOb ) )
return EXPP_ReturnIntError( PyExc_TypeError,
"expected a BezTriple\n" );
@@ -666,14 +666,6 @@ PyObject *SurfNurb_pointAtIndex( Nurb * nurb, int index )
"non-NURB surface found" );
}
int SurfNurb_CheckPyObject( PyObject * py_obj )
{
return ( py_obj->ob_type == &SurfNurb_Type );
}
/*
* methods for SurfNurb as sequence
*/

View File

@@ -60,7 +60,6 @@ typedef struct {
PyObject *SurfNurb_Init( void );
PyObject *SurfNurb_CreatePyObject( Nurb * bzt );
int SurfNurb_CheckPyObject( PyObject * pyobj );
Nurb *SurfNurb_FromPyObject( PyObject * pyobj );
PyObject *SurfNurb_getPoint( BPy_SurfNurb * self, int index );

View File

@@ -630,12 +630,6 @@ static int Text3d_compare( BPy_Text3d * a, BPy_Text3d * b )
return ( a->curve == b->curve) ? 0 : -1;
}
int Text3d_CheckPyObject( PyObject * py_obj )
{
return ( py_obj->ob_type == &Text3d_Type );
}
struct Text3d *Text3d_FromPyObject( PyObject * py_obj )
{
BPy_Text3d *blen_obj;

View File

@@ -36,11 +36,12 @@
#include <Python.h>
#include "DNA_curve_types.h"
extern PyTypeObject Text3d_Type;
#define BPy_Text3d_Check(v) ((v)->ob_type==&Text3d_Type)
typedef Curve Text3d;
/*prototypes*/
int Text3d_CheckPyObject( PyObject * py_obj );
PyObject *Text3d_Init( void );
struct Text3d *Text3d_FromPyObject( PyObject * py_obj );
PyObject *Text3d_CreatePyObject( Text3d* text3d );

View File

@@ -1339,11 +1339,6 @@ Tex *Texture_FromPyObject( PyObject * pyobj )
return ( ( BPy_Texture * ) pyobj )->texture;
}
int Texture_CheckPyObject( PyObject * pyobj )
{
return ( pyobj->ob_type == &Texture_Type );
}
/*****************************************************************************/
/* Python BPy_Texture methods: */
/*****************************************************************************/
@@ -1966,7 +1961,7 @@ static int Texture_setIpo( BPy_Texture * self, PyObject * value )
/* if parameter is not None, check for valid Ipo */
if ( value != Py_None ) {
if ( !Ipo_CheckPyObject( value ) )
if ( !BPy_Ipo_Check( value ) )
return EXPP_ReturnIntError( PyExc_RuntimeError,
"expected an Ipo object" );

View File

@@ -58,7 +58,6 @@ extern PyTypeObject Texture_Type;
PyObject *Texture_Init( void );
PyObject *Texture_CreatePyObject( struct Tex *tex );
int Texture_CheckPyObject( PyObject * pyobj );
Tex *Texture_FromPyObject( PyObject * pyobj );

View File

@@ -985,12 +985,6 @@ PyObject *World_CreatePyObject( struct World * world )
return ( ( PyObject * ) blen_object );
}
int World_CheckPyObject( PyObject * py_obj )
{
return ( py_obj->ob_type == &World_Type );
}
World *World_FromPyObject( PyObject * py_obj )
{
BPy_World *blen_obj;

View File

@@ -54,6 +54,5 @@ extern PyTypeObject World_Type;
PyObject *World_Init( void );
PyObject *World_CreatePyObject( World * world );
World *World_FromPyObject( PyObject * pyobj );
int World_CheckPyObject( PyObject * pyobj );
#endif /* EXPP_WORLD_H */

View File

@@ -347,12 +347,6 @@ PyObject *Property_CreatePyObject( struct bProperty * Property )
return ( ( PyObject * ) py_property );
}
//--------------- Property_CheckPyObject----------------------------
int Property_CheckPyObject( PyObject * py_obj )
{
return ( py_obj->ob_type == &property_Type );
}
//--------------- Property_FromPyObject-----------------------------
struct bProperty *Property_FromPyObject( PyObject * py_obj )
{

View File

@@ -38,6 +38,8 @@
extern PyTypeObject property_Type;
#define BPy_Property_Check(v) ((v)->ob_type == &property_Type)
//--------------------------Python BPy_Property structure definition.----
typedef struct {
PyObject_HEAD
@@ -51,7 +53,6 @@ typedef struct {
//------------------------------visible prototypes-----------------------
PyObject *Property_CreatePyObject( struct bProperty *prop );
int Property_CheckPyObject( PyObject * py_obj );
bProperty *Property_FromPyObject( PyObject * py_obj );
PyObject *newPropertyObject( char *name, PyObject * data, int type );
int updatePyProperty( BPy_Property * self );

View File

@@ -704,11 +704,6 @@ PyObject *Radio_CreatePyObject( struct Scene * scene )
return ( ( PyObject * ) py_radio );
}
int Radio_CheckPyObject( PyObject * pyob )
{
return ( pyob->ob_type == &Radio_Type );
}
static PyObject *Radio_collectMeshes( BPy_Radio * self )
{
if( !EXPP_check_scene( self->scene ) )

View File

@@ -47,6 +47,5 @@ typedef struct {
PyObject *Radio_Init( void );
PyObject *Radio_CreatePyObject( struct Scene *scene );
int Radio_CheckPyObject( PyObject * py_obj );
#endif /* EXPP_SCENERADIO_H */

View File

@@ -2703,11 +2703,6 @@ PyObject *RenderData_CreatePyObject( struct Scene * scene )
return ( ( PyObject * ) py_renderdata );
}
int RenderData_CheckPyObject( PyObject * py_obj )
{
return ( py_obj->ob_type == &RenderData_Type );
}
/* #####DEPRECATED###### */
static PyObject *RenderData_SetRenderPath( BPy_RenderData *self,

View File

@@ -36,6 +36,8 @@
#include <Python.h>
#include "DNA_scene_types.h"
#define BPy_RenderData_Check(v) ((v)->ob_type == &RenderData_Type)
//------------------------------------Struct definitions-------
typedef struct {
PyObject_HEAD
@@ -46,6 +48,5 @@ typedef struct {
PyObject *Render_Init( void );
PyObject *RenderData_CreatePyObject( struct Scene *scene );
int RenderData_CheckPyObject( PyObject * py_obj );
#endif /* EXPP_SCENERENDER_H */

View File

@@ -462,7 +462,7 @@ static int Sequence_setIpo( BPy_Sequence * self, PyObject * value )
/* if parameter is not None, check for valid Ipo */
if ( value != Py_None ) {
if ( !Ipo_CheckPyObject( value ) )
if ( !BPy_Ipo_Check( value ) )
return EXPP_ReturnIntError( PyExc_TypeError,
"expected an Ipo object" );
@@ -1033,21 +1033,6 @@ PyObject *SceneSeq_CreatePyObject( struct Scene * scn, struct Sequence * iter)
return ( ( PyObject * ) pysceseq );
}
/*****************************************************************************/
/* Function: Sequence_CheckPyObject */
/* Description: This function returns true when the given PyObject is of the */
/* type Sequence. Otherwise it will return false. */
/*****************************************************************************/
int Sequence_CheckPyObject( PyObject * py_seq)
{
return ( py_seq->ob_type == &Sequence_Type );
}
int SceneSeq_CheckPyObject( PyObject * py_seq)
{
return ( py_seq->ob_type == &SceneSeq_Type );
}
/*****************************************************************************/
/* Function: Sequence_FromPyObject */
/* Description: This function returns the Blender sequence from the given */

View File

@@ -79,7 +79,5 @@ PyObject *Sequence_Init( void );
PyObject *Sequence_CreatePyObject( struct Sequence * seq, struct Sequence * iter, struct Scene * scn);
PyObject *SceneSeq_CreatePyObject( struct Scene * scn, struct Sequence * iter);
struct Sequence *Sequence_FromPyObject( PyObject * py_obj );
int Sequence_CheckPyObject( PyObject * py_obj );
int SceneSeq_CheckPyObject( PyObject * py_obj );
#endif /* EXPP_SEQUENCE_H */

View File

@@ -53,7 +53,6 @@ typedef struct {
PyObject *TimeLine_Init (void);
PyObject *TimeLine_CreatePyObject (BPy_TimeLine *tl);
BPy_TimeLine *TimeLine_FromPyObject (PyObject * pyobj);
int TimeLine_CheckPyObject (PyObject * pyobj);
#endif /* EXPP_TMARKER_H */