added comparison function to many python types so you can do == and =!
This commit is contained in:
@@ -1060,13 +1060,21 @@ AttributeError:
|
|||||||
return EXPP_intError(PyExc_AttributeError, "%s%s%s",
|
return EXPP_intError(PyExc_AttributeError, "%s%s%s",
|
||||||
sArmatureBadArgs, " __init__: ", "Expects string(name)");
|
sArmatureBadArgs, " __init__: ", "Expects string(name)");
|
||||||
}
|
}
|
||||||
//------------------------tp_richcompare
|
|
||||||
//This method allows the object to use comparison operators
|
|
||||||
//TODO: We need some armature comparisons
|
/*****************************************************************************/
|
||||||
static PyObject *Armature_richcmpr(BPy_Armature *self, PyObject *v, int op)
|
/* Function: Armature_compare */
|
||||||
|
/* Description: This is a callback function for the BPy_Armature type. It */
|
||||||
|
/* compares two Armature_Type objects. Only the "==" and "!=" */
|
||||||
|
/* comparisons are meaninful. Returns 0 for equality and -1 if */
|
||||||
|
/* they don't point to the same Blender Object struct. */
|
||||||
|
/* In Python it becomes 1 if they are equal, 0 otherwise. */
|
||||||
|
/*****************************************************************************/
|
||||||
|
static int Armature_compare( BPy_Armature * a, BPy_Armature * b )
|
||||||
{
|
{
|
||||||
return EXPP_incr_ret(Py_None);
|
return ( a->armature == b->armature ) ? 0 : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------tp_repr
|
//------------------------tp_repr
|
||||||
//This is the string representation of the object
|
//This is the string representation of the object
|
||||||
static PyObject *Armature_repr(BPy_Armature *self)
|
static PyObject *Armature_repr(BPy_Armature *self)
|
||||||
@@ -1093,7 +1101,7 @@ PyTypeObject Armature_Type = {
|
|||||||
0, //tp_print
|
0, //tp_print
|
||||||
0, //tp_getattr
|
0, //tp_getattr
|
||||||
0, //tp_setattr
|
0, //tp_setattr
|
||||||
0, //tp_compare
|
(cmpfunc) Armature_compare, //tp_compare
|
||||||
(reprfunc) Armature_repr, //tp_repr
|
(reprfunc) Armature_repr, //tp_repr
|
||||||
0, //tp_as_number
|
0, //tp_as_number
|
||||||
0, //tp_as_sequence
|
0, //tp_as_sequence
|
||||||
@@ -1108,7 +1116,7 @@ PyTypeObject Armature_Type = {
|
|||||||
BPy_Armature_doc, //tp_doc
|
BPy_Armature_doc, //tp_doc
|
||||||
0, //tp_traverse
|
0, //tp_traverse
|
||||||
0, //tp_clear
|
0, //tp_clear
|
||||||
(richcmpfunc)Armature_richcmpr, //tp_richcompare
|
0, //tp_richcompare
|
||||||
0, //tp_weaklistoffset
|
0, //tp_weaklistoffset
|
||||||
0, //tp_iter
|
0, //tp_iter
|
||||||
0, //tp_iternext
|
0, //tp_iternext
|
||||||
|
|||||||
@@ -181,6 +181,7 @@ static PyMappingMethods Constraint_as_mapping = {
|
|||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
static void Constraint_dealloc( BPy_Constraint * self );
|
static void Constraint_dealloc( BPy_Constraint * self );
|
||||||
static PyObject *Constraint_repr( BPy_Constraint * self );
|
static PyObject *Constraint_repr( BPy_Constraint * self );
|
||||||
|
static int Constraint_compare( BPy_Constraint * a, BPy_Constraint * b );
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/* Python Constraint_Type structure definition: */
|
/* Python Constraint_Type structure definition: */
|
||||||
@@ -199,7 +200,7 @@ PyTypeObject Constraint_Type = {
|
|||||||
NULL, /* printfunc tp_print; */
|
NULL, /* printfunc tp_print; */
|
||||||
NULL, /* getattrfunc tp_getattr; */
|
NULL, /* getattrfunc tp_getattr; */
|
||||||
NULL, /* setattrfunc tp_setattr; */
|
NULL, /* setattrfunc tp_setattr; */
|
||||||
NULL, /* cmpfunc tp_compare; */
|
( cmpfunc ) Constraint_compare, /* cmpfunc tp_compare; */
|
||||||
( reprfunc ) Constraint_repr, /* reprfunc tp_repr; */
|
( reprfunc ) Constraint_repr, /* reprfunc tp_repr; */
|
||||||
|
|
||||||
/* Method suites for standard classes */
|
/* Method suites for standard classes */
|
||||||
@@ -1276,6 +1277,16 @@ static void Constraint_dealloc( BPy_Constraint * self )
|
|||||||
PyObject_DEL( self );
|
PyObject_DEL( self );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/* Function: Constraint_compare */
|
||||||
|
/* Description: This compares 2 constraint python types, == or != only. */
|
||||||
|
/*****************************************************************************/
|
||||||
|
static int Constraint_compare( BPy_Constraint * a, BPy_Constraint * b )
|
||||||
|
{
|
||||||
|
return ( a->con == b->con ) ? 0 : -1;
|
||||||
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/* Function: Constraint_repr */
|
/* Function: Constraint_repr */
|
||||||
/* Description: This is a callback function for the BPy_Constraint type. It */
|
/* Description: This is a callback function for the BPy_Constraint type. It */
|
||||||
|
|||||||
@@ -241,6 +241,7 @@ static void CurveDeAlloc( BPy_Curve * msh );
|
|||||||
/* static int CurvePrint (BPy_Curve *msh, FILE *fp, int flags); */
|
/* static int CurvePrint (BPy_Curve *msh, FILE *fp, int flags); */
|
||||||
static int CurveSetAttr( BPy_Curve * msh, char *name, PyObject * v );
|
static int CurveSetAttr( BPy_Curve * msh, char *name, PyObject * v );
|
||||||
static PyObject *CurveGetAttr( BPy_Curve * msh, char *name );
|
static PyObject *CurveGetAttr( BPy_Curve * msh, char *name );
|
||||||
|
static int CurveCopmpare( BPy_Curve * a, BPy_Curve * b );
|
||||||
static PyObject *CurveRepr( BPy_Curve * msh );
|
static PyObject *CurveRepr( BPy_Curve * msh );
|
||||||
|
|
||||||
static PySequenceMethods Curve_as_sequence = {
|
static PySequenceMethods Curve_as_sequence = {
|
||||||
@@ -271,7 +272,7 @@ PyTypeObject Curve_Type = {
|
|||||||
0, /* tp_print */
|
0, /* tp_print */
|
||||||
( getattrfunc ) CurveGetAttr, /* tp_getattr */
|
( getattrfunc ) CurveGetAttr, /* tp_getattr */
|
||||||
( setattrfunc ) CurveSetAttr, /* tp_setattr */
|
( setattrfunc ) CurveSetAttr, /* tp_setattr */
|
||||||
0, /* tp_compare */
|
( cmpfunc ) CurveCopmpare, /* tp_compare */
|
||||||
( reprfunc ) CurveRepr, /* tp_repr */
|
( reprfunc ) CurveRepr, /* tp_repr */
|
||||||
/* methods for standard classes */
|
/* methods for standard classes */
|
||||||
0, /* tp_as_number */
|
0, /* tp_as_number */
|
||||||
@@ -1662,6 +1663,16 @@ static int CurveSetAttr( BPy_Curve * self, char *name, PyObject * value )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/* Function: CurveCopmpare */
|
||||||
|
/* Description: This compares 2 curve python types, == or != only. */
|
||||||
|
/*****************************************************************************/
|
||||||
|
static int CurveCopmpare( BPy_Curve * a, BPy_Curve * b )
|
||||||
|
{
|
||||||
|
return ( a->curve == b->curve ) ? 0 : -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/* Function: CurveRepr */
|
/* Function: CurveRepr */
|
||||||
/* Description: This is a callback function for the BPy_Curve type. It */
|
/* Description: This is a callback function for the BPy_Curve type. It */
|
||||||
|
|||||||
@@ -435,8 +435,7 @@ static PyObject *Font_repr( BPy_Font * self )
|
|||||||
/*--------------- compare------------------------------------------*/
|
/*--------------- compare------------------------------------------*/
|
||||||
static int Font_compare( BPy_Font * a, BPy_Font * b )
|
static int Font_compare( BPy_Font * a, BPy_Font * b )
|
||||||
{
|
{
|
||||||
VFont *pa = a->font, *pb = b->font;
|
return ( a->font == b->font ) ? 0 : -1;
|
||||||
return ( pa == pb ) ? 0 : -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*--------------- Font_CreatePyObject---------------------------------*/
|
/*--------------- Font_CreatePyObject---------------------------------*/
|
||||||
|
|||||||
@@ -491,8 +491,7 @@ PyObject *M_Group_Unlink( PyObject * self, PyObject * args )
|
|||||||
unlink_group(group);
|
unlink_group(group);
|
||||||
group->id.us= 0;
|
group->id.us= 0;
|
||||||
free_libblock( &G.main->group, group );
|
free_libblock( &G.main->group, group );
|
||||||
Py_INCREF( Py_None );
|
Py_RETURN_NONE;
|
||||||
return Py_None;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -527,7 +526,7 @@ PyObject *Group_CreatePyObject( struct Group * grp )
|
|||||||
BPy_Group *pygrp;
|
BPy_Group *pygrp;
|
||||||
|
|
||||||
if( !grp )
|
if( !grp )
|
||||||
return EXPP_incr_ret( Py_None );
|
Py_RETURN_NONE;
|
||||||
|
|
||||||
pygrp =
|
pygrp =
|
||||||
( BPy_Group * ) PyObject_NEW( BPy_Group, &Group_Type );
|
( BPy_Group * ) PyObject_NEW( BPy_Group, &Group_Type );
|
||||||
@@ -746,7 +745,7 @@ static PyObject *GroupObSeq_add( BPy_GroupObSeq * self, PyObject *args )
|
|||||||
|
|
||||||
add_to_group_wraper(self->bpygroup->group, blen_ob); /* this checks so as not to add the object into the group twice*/
|
add_to_group_wraper(self->bpygroup->group, blen_ob); /* this checks so as not to add the object into the group twice*/
|
||||||
|
|
||||||
return EXPP_incr_ret( Py_None );
|
Py_RETURN_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -776,7 +775,7 @@ static PyObject *GroupObSeq_remove( BPy_GroupObSeq * self, PyObject *args )
|
|||||||
if (base)
|
if (base)
|
||||||
base->flag &= ~OB_FROMGROUP;
|
base->flag &= ~OB_FROMGROUP;
|
||||||
}
|
}
|
||||||
return EXPP_incr_ret( Py_None );
|
Py_RETURN_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -70,7 +70,6 @@ current image frame, some images change frame if they are a sequence */
|
|||||||
static PyObject *M_Image_New( PyObject * self, PyObject * args );
|
static PyObject *M_Image_New( PyObject * self, PyObject * args );
|
||||||
static PyObject *M_Image_Get( PyObject * self, PyObject * args );
|
static PyObject *M_Image_Get( PyObject * self, PyObject * args );
|
||||||
static PyObject *M_Image_GetCurrent( PyObject * self );
|
static PyObject *M_Image_GetCurrent( PyObject * self );
|
||||||
static PyObject *M_Image_SetCurrent( PyObject * self, PyObject * args );
|
|
||||||
static PyObject *M_Image_Load( PyObject * self, PyObject * args );
|
static PyObject *M_Image_Load( PyObject * self, PyObject * args );
|
||||||
|
|
||||||
|
|
||||||
@@ -1261,8 +1260,7 @@ static int Image_setAttr( BPy_Image * self, char *name, PyObject * value )
|
|||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
static int Image_compare( BPy_Image * a, BPy_Image * b )
|
static int Image_compare( BPy_Image * a, BPy_Image * b )
|
||||||
{
|
{
|
||||||
Image *pa = a->image, *pb = b->image;
|
return ( a->image == b->image ) ? 0 : -1;
|
||||||
return ( pa == pb ) ? 0 : -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|||||||
@@ -228,6 +228,7 @@ static PySequenceMethods Ipo_as_sequence = {
|
|||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
static void Ipo_dealloc( BPy_Ipo * self );
|
static void Ipo_dealloc( BPy_Ipo * self );
|
||||||
//static int IpoPrint (BPy_Ipo *self, FILE *fp, int flags);
|
//static int IpoPrint (BPy_Ipo *self, FILE *fp, int flags);
|
||||||
|
static int Ipo_compare( BPy_Ipo * a, BPy_Ipo * b );
|
||||||
static PyObject *Ipo_repr( BPy_Ipo * self );
|
static PyObject *Ipo_repr( BPy_Ipo * self );
|
||||||
static PyObject *Ipo_getIter( BPy_Ipo * self );
|
static PyObject *Ipo_getIter( BPy_Ipo * self );
|
||||||
static PyObject *Ipo_nextIter( BPy_Ipo * self );
|
static PyObject *Ipo_nextIter( BPy_Ipo * self );
|
||||||
@@ -365,7 +366,7 @@ PyTypeObject Ipo_Type = {
|
|||||||
NULL, /* printfunc tp_print; */
|
NULL, /* printfunc tp_print; */
|
||||||
NULL, /* getattrfunc tp_getattr; */
|
NULL, /* getattrfunc tp_getattr; */
|
||||||
NULL, /* setattrfunc tp_setattr; */
|
NULL, /* setattrfunc tp_setattr; */
|
||||||
NULL, /* cmpfunc tp_compare; */
|
( reprfunc ) Ipo_compare, /* cmpfunc tp_compare; */
|
||||||
( reprfunc ) Ipo_repr, /* reprfunc tp_repr; */
|
( reprfunc ) Ipo_repr, /* reprfunc tp_repr; */
|
||||||
|
|
||||||
/* Method suites for standard classes */
|
/* Method suites for standard classes */
|
||||||
@@ -1302,6 +1303,15 @@ static void Ipo_dealloc( BPy_Ipo * self )
|
|||||||
PyObject_DEL( self );
|
PyObject_DEL( self );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/* Function: Ipo_compare */
|
||||||
|
/* Description: This compares 2 ipo python types, == or != only. */
|
||||||
|
/*****************************************************************************/
|
||||||
|
static int Ipo_compare( BPy_Ipo * a, BPy_Ipo * b )
|
||||||
|
{
|
||||||
|
return ( a->ipo == b->ipo ) ? 0 : -1;
|
||||||
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/* Function: Ipo_repr */
|
/* Function: Ipo_repr */
|
||||||
/* Description: This is a callback function for the BPy_Ipo type. It */
|
/* Description: This is a callback function for the BPy_Ipo type. It */
|
||||||
|
|||||||
@@ -175,6 +175,7 @@ static PyMappingMethods IpoCurve_as_mapping = {
|
|||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/* Python IpoCurve_Type callback function prototypes: */
|
/* Python IpoCurve_Type callback function prototypes: */
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
static int IpoCurve_compare( C_IpoCurve * a, C_IpoCurve * b );
|
||||||
static PyObject *IpoCurve_repr( C_IpoCurve * self );
|
static PyObject *IpoCurve_repr( C_IpoCurve * self );
|
||||||
static void IpoCurve_dealloc( C_IpoCurve * self );
|
static void IpoCurve_dealloc( C_IpoCurve * self );
|
||||||
|
|
||||||
@@ -192,7 +193,7 @@ PyTypeObject IpoCurve_Type = {
|
|||||||
0, /* tp_print */
|
0, /* tp_print */
|
||||||
( getattrfunc ) NULL, /* tp_getattr */
|
( getattrfunc ) NULL, /* tp_getattr */
|
||||||
( setattrfunc ) NULL, /* tp_setattr */
|
( setattrfunc ) NULL, /* tp_setattr */
|
||||||
0, /* tp_compare */
|
( cmpfunc ) IpoCurve_compare, /* tp_compare */
|
||||||
( reprfunc ) IpoCurve_repr, /* tp_repr */
|
( reprfunc ) IpoCurve_repr, /* tp_repr */
|
||||||
/* Method suites for standard classes */
|
/* Method suites for standard classes */
|
||||||
|
|
||||||
@@ -646,6 +647,15 @@ static void IpoCurve_dealloc( C_IpoCurve * self )
|
|||||||
PyObject_DEL( self );
|
PyObject_DEL( self );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/* Function: IpoCurve_compare */
|
||||||
|
/* Description: This compares 2 python types, == or != only. */
|
||||||
|
/*****************************************************************************/
|
||||||
|
static int IpoCurve_compare( C_IpoCurve * a, C_IpoCurve * b )
|
||||||
|
{
|
||||||
|
return ( a->ipocurve == b->ipocurve ) ? 0 : -1;
|
||||||
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/* Function: IpoCurve_repr */
|
/* Function: IpoCurve_repr */
|
||||||
/* Description: This is a callback function for the C_IpoCurve type. It */
|
/* Description: This is a callback function for the C_IpoCurve type. It */
|
||||||
|
|||||||
@@ -61,6 +61,7 @@
|
|||||||
|
|
||||||
static void Key_dealloc( PyObject * self );
|
static void Key_dealloc( PyObject * self );
|
||||||
static void KeyBlock_dealloc( PyObject * self );
|
static void KeyBlock_dealloc( PyObject * self );
|
||||||
|
static int Key_compare( BPy_Key * a, BPy_Key * b );
|
||||||
static PyObject *Key_repr( BPy_Key * self );
|
static PyObject *Key_repr( BPy_Key * self );
|
||||||
|
|
||||||
static PyObject *Key_getBlocks( PyObject * self );
|
static PyObject *Key_getBlocks( PyObject * self );
|
||||||
@@ -138,7 +139,7 @@ PyTypeObject Key_Type = {
|
|||||||
( printfunc ) 0, /*tp_print */
|
( printfunc ) 0, /*tp_print */
|
||||||
( getattrfunc ) 0, /*tp_getattr */
|
( getattrfunc ) 0, /*tp_getattr */
|
||||||
( setattrfunc ) 0, /*tp_setattr */
|
( setattrfunc ) 0, /*tp_setattr */
|
||||||
0, /*tp_compare*/
|
( cmpfunc) Key_compare, /*tp_compare*/
|
||||||
( reprfunc ) Key_repr, /* tp_repr */
|
( reprfunc ) Key_repr, /* tp_repr */
|
||||||
/* Method suites for standard classes */
|
/* Method suites for standard classes */
|
||||||
|
|
||||||
@@ -306,6 +307,12 @@ PyObject *Key_CreatePyObject( Key * k )
|
|||||||
return ( PyObject * ) key;
|
return ( PyObject * ) key;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int Key_compare( BPy_Key * a, BPy_Key * b )
|
||||||
|
{
|
||||||
|
return ( a->key == b->key ) ? 0 : -1;
|
||||||
|
}
|
||||||
|
|
||||||
static PyObject *Key_repr( BPy_Key * self )
|
static PyObject *Key_repr( BPy_Key * self )
|
||||||
{
|
{
|
||||||
return PyString_FromFormat( "[Key \"%s\"]", self->key->id.name + 2 );
|
return PyString_FromFormat( "[Key \"%s\"]", self->key->id.name + 2 );
|
||||||
|
|||||||
@@ -1431,8 +1431,7 @@ static void Lamp_dealloc( BPy_Lamp * self )
|
|||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
static int Lamp_compare( BPy_Lamp * a, BPy_Lamp * b )
|
static int Lamp_compare( BPy_Lamp * a, BPy_Lamp * b )
|
||||||
{
|
{
|
||||||
Lamp *pa = a->lamp, *pb = b->lamp;
|
return ( a->lamp == b->lamp ) ? 0 : -1;
|
||||||
return ( pa == pb ) ? 0 : -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|||||||
@@ -193,6 +193,7 @@ static void Lattice_dealloc( BPy_Lattice * self );
|
|||||||
static int Lattice_setAttr( BPy_Lattice * self, char *name, PyObject * v );
|
static int Lattice_setAttr( BPy_Lattice * self, char *name, PyObject * v );
|
||||||
static PyObject *Lattice_getAttr( BPy_Lattice * self, char *name );
|
static PyObject *Lattice_getAttr( BPy_Lattice * self, char *name );
|
||||||
static PyObject *Lattice_repr( BPy_Lattice * self );
|
static PyObject *Lattice_repr( BPy_Lattice * self );
|
||||||
|
static int Lattice_compare( BPy_Lattice * a, BPy_Lattice * b );
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/* Python Lattice_Type structure definition: */
|
/* Python Lattice_Type structure definition: */
|
||||||
@@ -208,7 +209,7 @@ PyTypeObject Lattice_Type = {
|
|||||||
0, /* tp_print */
|
0, /* tp_print */
|
||||||
( getattrfunc ) Lattice_getAttr, /* tp_getattr */
|
( getattrfunc ) Lattice_getAttr, /* tp_getattr */
|
||||||
( setattrfunc ) Lattice_setAttr, /* tp_setattr */
|
( setattrfunc ) Lattice_setAttr, /* tp_setattr */
|
||||||
0, /* tp_compare */
|
( cmpfunc ) Lattice_compare, /* tp_compare */
|
||||||
( reprfunc ) Lattice_repr, /* tp_repr */
|
( reprfunc ) Lattice_repr, /* tp_repr */
|
||||||
0, /* tp_as_number */
|
0, /* tp_as_number */
|
||||||
0, /* tp_as_sequence */
|
0, /* tp_as_sequence */
|
||||||
@@ -927,6 +928,13 @@ static int Lattice_setAttr( BPy_Lattice * self, char *name, PyObject * value )
|
|||||||
return 0; // normal exit
|
return 0; // normal exit
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int Lattice_compare( BPy_Lattice * a, BPy_Lattice * b )
|
||||||
|
{
|
||||||
|
return ( a->Lattice == b->Lattice ) ? 0 : -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//***************************************************************************
|
//***************************************************************************
|
||||||
// Function: Lattice_repr
|
// Function: Lattice_repr
|
||||||
// Description: This is a callback function for the BPy_Lattice type. It
|
// Description: This is a callback function for the BPy_Lattice type. It
|
||||||
|
|||||||
@@ -1081,6 +1081,7 @@ static PyGetSetDef BPy_Material_getseters[] = {
|
|||||||
/* Python Material_Type callback function prototypes: */
|
/* Python Material_Type callback function prototypes: */
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
static void Material_dealloc( BPy_Material * self );
|
static void Material_dealloc( BPy_Material * self );
|
||||||
|
static int Material_compare( BPy_Material * a, BPy_Material * b);
|
||||||
static PyObject *Material_repr( BPy_Material * self );
|
static PyObject *Material_repr( BPy_Material * self );
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
@@ -1100,7 +1101,7 @@ PyTypeObject Material_Type = {
|
|||||||
NULL, /* printfunc tp_print; */
|
NULL, /* printfunc tp_print; */
|
||||||
NULL, /* getattrfunc tp_getattr; */
|
NULL, /* getattrfunc tp_getattr; */
|
||||||
NULL, /* setattrfunc tp_setattr; */
|
NULL, /* setattrfunc tp_setattr; */
|
||||||
NULL, /* cmpfunc tp_compare; */
|
( cmpfunc ) Material_compare,/* cmpfunc tp_compare; */
|
||||||
( reprfunc ) Material_repr, /* reprfunc tp_repr; */
|
( reprfunc ) Material_repr, /* reprfunc tp_repr; */
|
||||||
|
|
||||||
/* Method suites for standard classes */
|
/* Method suites for standard classes */
|
||||||
@@ -2501,6 +2502,12 @@ static PyObject *Material_copy( BPy_Material * self )
|
|||||||
return ( PyObject * ) pymat;
|
return ( PyObject * ) pymat;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* mat_a==mat_b or mat_a!=mat_b*/
|
||||||
|
static int Material_compare( BPy_Material * a, BPy_Material * b )
|
||||||
|
{
|
||||||
|
return ( a->material == b->material) ? 0 : -1;
|
||||||
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/* Function: Material_repr */
|
/* Function: Material_repr */
|
||||||
/* Description: This is a callback function for the BPy_Material type. It */
|
/* Description: This is a callback function for the BPy_Material type. It */
|
||||||
|
|||||||
@@ -7361,6 +7361,11 @@ static void Mesh_dealloc( BPy_Mesh * self )
|
|||||||
PyObject_DEL( self );
|
PyObject_DEL( self );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int Mesh_compare( BPy_Mesh * a, BPy_Mesh * b )
|
||||||
|
{
|
||||||
|
return ( a->mesh == b->mesh ) ? 0 : -1;
|
||||||
|
}
|
||||||
|
|
||||||
static PyObject *Mesh_repr( BPy_Mesh * self )
|
static PyObject *Mesh_repr( BPy_Mesh * self )
|
||||||
{
|
{
|
||||||
return PyString_FromFormat( "[Mesh \"%s\"]",
|
return PyString_FromFormat( "[Mesh \"%s\"]",
|
||||||
@@ -7472,7 +7477,7 @@ PyTypeObject Mesh_Type = {
|
|||||||
NULL, /* printfunc tp_print; */
|
NULL, /* printfunc tp_print; */
|
||||||
NULL, /* getattrfunc tp_getattr; */
|
NULL, /* getattrfunc tp_getattr; */
|
||||||
NULL, /* setattrfunc tp_setattr; */
|
NULL, /* setattrfunc tp_setattr; */
|
||||||
NULL, /* cmpfunc tp_compare; */
|
( cmpfunc ) Mesh_compare, /* cmpfunc tp_compare; */
|
||||||
( reprfunc ) Mesh_repr, /* reprfunc tp_repr; */
|
( reprfunc ) Mesh_repr, /* reprfunc tp_repr; */
|
||||||
|
|
||||||
/* Method suites for standard classes */
|
/* Method suites for standard classes */
|
||||||
|
|||||||
@@ -124,8 +124,10 @@ static PyMethodDef BPy_Action_methods[] = {
|
|||||||
static void Action_dealloc( BPy_Action * bone );
|
static void Action_dealloc( BPy_Action * bone );
|
||||||
static PyObject *Action_getAttr( BPy_Action * bone, char *name );
|
static PyObject *Action_getAttr( BPy_Action * bone, char *name );
|
||||||
static int Action_setAttr( BPy_Action * bone, char *name, PyObject * v );
|
static int Action_setAttr( BPy_Action * bone, char *name, PyObject * v );
|
||||||
|
static int Action_compare( BPy_Action * a, BPy_Action * b );
|
||||||
static PyObject *Action_repr( BPy_Action * bone );
|
static PyObject *Action_repr( BPy_Action * bone );
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/* Python TypeAction structure definition: */
|
/* Python TypeAction structure definition: */
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
@@ -140,7 +142,7 @@ PyTypeObject Action_Type = {
|
|||||||
0, /* tp_print */
|
0, /* tp_print */
|
||||||
( getattrfunc ) Action_getAttr, /* tp_getattr */
|
( getattrfunc ) Action_getAttr, /* tp_getattr */
|
||||||
( setattrfunc ) Action_setAttr, /* tp_setattr */
|
( setattrfunc ) Action_setAttr, /* tp_setattr */
|
||||||
0, /* tp_compare */
|
( cmpfunc ) Action_compare, /* tp_compare */
|
||||||
( reprfunc ) Action_repr, /* tp_repr */
|
( reprfunc ) Action_repr, /* tp_repr */
|
||||||
0, /* tp_as_number */
|
0, /* tp_as_number */
|
||||||
0, /* tp_as_sequence */
|
0, /* tp_as_sequence */
|
||||||
@@ -495,6 +497,13 @@ static int Action_setAttr( BPy_Action * self, char *name, PyObject * value )
|
|||||||
return 0; /* normal exit */
|
return 0; /* normal exit */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------*/
|
||||||
|
static int Action_compare( BPy_Action * a, BPy_Action * b )
|
||||||
|
{
|
||||||
|
return ( a->action == b->action ) ? 0 : -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*----------------------------------------------------------------------*/
|
/*----------------------------------------------------------------------*/
|
||||||
static PyObject *Action_repr( BPy_Action * self )
|
static PyObject *Action_repr( BPy_Action * self )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3061,8 +3061,7 @@ static void Object_dealloc( BPy_Object * obj )
|
|||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
static int Object_compare( BPy_Object * a, BPy_Object * b )
|
static int Object_compare( BPy_Object * a, BPy_Object * b )
|
||||||
{
|
{
|
||||||
Object *pa = a->object, *pb = b->object;
|
return ( a->object == b->object ) ? 0 : -1;
|
||||||
return ( pa == pb ) ? 0 : -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|||||||
@@ -332,6 +332,12 @@ static void Pose_dealloc(BPy_Pose *self)
|
|||||||
Pose_Type.tp_free(self);
|
Pose_Type.tp_free(self);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
//------------------------tp_cmp
|
||||||
|
//This compares 2 pose types
|
||||||
|
static int Pose_compare(BPy_Pose *a, BPy_Pose *b )
|
||||||
|
{
|
||||||
|
return ( a->pose== b->pose ) ? 0 : -1;
|
||||||
|
}
|
||||||
//------------------------tp_repr
|
//------------------------tp_repr
|
||||||
//This is the string representation of the object
|
//This is the string representation of the object
|
||||||
static PyObject *Pose_repr(BPy_Pose *self)
|
static PyObject *Pose_repr(BPy_Pose *self)
|
||||||
|
|||||||
@@ -356,8 +356,7 @@ static int Scene_setAttr( BPy_Scene * self, char *name, PyObject * value )
|
|||||||
/*-----------------------compare----------------------------------------*/
|
/*-----------------------compare----------------------------------------*/
|
||||||
static int Scene_compare( BPy_Scene * a, BPy_Scene * b )
|
static int Scene_compare( BPy_Scene * a, BPy_Scene * b )
|
||||||
{
|
{
|
||||||
Scene *pa = a->scene, *pb = b->scene;
|
return ( a->scene == b->scene ) ? 0 : -1;
|
||||||
return ( pa == pb ) ? 0 : -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*----------------------repr--------------------------------------------*/
|
/*----------------------repr--------------------------------------------*/
|
||||||
@@ -1548,8 +1547,7 @@ static void SceneObSeq_dealloc( BPy_SceneObSeq * self )
|
|||||||
|
|
||||||
static int SceneObSeq_compare( BPy_SceneObSeq * a, BPy_SceneObSeq * b )
|
static int SceneObSeq_compare( BPy_SceneObSeq * a, BPy_SceneObSeq * b )
|
||||||
{
|
{
|
||||||
Scene *pa = a->bpyscene->scene, *pb = b->bpyscene->scene;
|
return ( a->bpyscene->scene == b->bpyscene->scene && a->mode == b->mode) ? 0 : -1;
|
||||||
return ( pa == pb && a->mode == b->mode) ? 0 : -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -632,8 +632,7 @@ static int Sound_setAttr( BPy_Sound * self, char *name, PyObject * value )
|
|||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
static int Sound_compare( BPy_Sound * a, BPy_Sound * b )
|
static int Sound_compare( BPy_Sound * a, BPy_Sound * b )
|
||||||
{
|
{
|
||||||
bSound *pa = a->sound, *pb = b->sound;
|
return ( a->sound == b->sound ) ? 0 : -1;
|
||||||
return ( pa == pb ) ? 0 : -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|||||||
@@ -638,8 +638,7 @@ static int Text_setAttr( BPy_Text * self, char *name, PyObject * value )
|
|||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
static int Text_compare( BPy_Text * a, BPy_Text * b )
|
static int Text_compare( BPy_Text * a, BPy_Text * b )
|
||||||
{
|
{
|
||||||
Text *pa = a->text, *pb = b->text;
|
return ( a->text == b->text ) ? 0 : -1;
|
||||||
return ( pa == pb ) ? 0 : -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|||||||
@@ -1033,8 +1033,7 @@ static int World_SetAttr( BPy_World * self, char *name, PyObject * value )
|
|||||||
|
|
||||||
static int World_Compare( BPy_World * a, BPy_World * b )
|
static int World_Compare( BPy_World * a, BPy_World * b )
|
||||||
{
|
{
|
||||||
World *pa = a->world, *pb = b->world;
|
return ( a->world == b->world ) ? 0 : -1;
|
||||||
return ( pa == pb ) ? 0 : -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -465,7 +465,7 @@ class Object:
|
|||||||
@type drawType: int
|
@type drawType: int
|
||||||
@ivar parentType: The object's parent type. Read-only.
|
@ivar parentType: The object's parent type. Read-only.
|
||||||
See L{ParentTypes} constant dict for values.
|
See L{ParentTypes} constant dict for values.
|
||||||
@type drawType: int
|
@type parentType: int
|
||||||
@ivar axis: Enable display of active object's center and axis.
|
@ivar axis: Enable display of active object's center and axis.
|
||||||
Also see B{AXIS} bit in L{drawMode} attribute.
|
Also see B{AXIS} bit in L{drawMode} attribute.
|
||||||
@type axis: boolean
|
@type axis: boolean
|
||||||
|
|||||||
Reference in New Issue
Block a user