added comparison function to many python types so you can do == and =!

This commit is contained in:
2006-10-06 16:48:28 +00:00
parent aaaae78527
commit dda63a9dde
21 changed files with 122 additions and 41 deletions

View File

@@ -1081,6 +1081,7 @@ static PyGetSetDef BPy_Material_getseters[] = {
/* Python Material_Type callback function prototypes: */
/*****************************************************************************/
static void Material_dealloc( BPy_Material * self );
static int Material_compare( BPy_Material * a, BPy_Material * b);
static PyObject *Material_repr( BPy_Material * self );
/*****************************************************************************/
@@ -1100,7 +1101,7 @@ PyTypeObject Material_Type = {
NULL, /* printfunc tp_print; */
NULL, /* getattrfunc tp_getattr; */
NULL, /* setattrfunc tp_setattr; */
NULL, /* cmpfunc tp_compare; */
( cmpfunc ) Material_compare,/* cmpfunc tp_compare; */
( reprfunc ) Material_repr, /* reprfunc tp_repr; */
/* Method suites for standard classes */
@@ -2501,6 +2502,12 @@ static PyObject *Material_copy( BPy_Material * self )
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 */
/* Description: This is a callback function for the BPy_Material type. It */