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

@@ -181,6 +181,7 @@ static PyMappingMethods Constraint_as_mapping = {
/*****************************************************************************/
static void Constraint_dealloc( 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: */
@@ -199,7 +200,7 @@ PyTypeObject Constraint_Type = {
NULL, /* printfunc tp_print; */
NULL, /* getattrfunc tp_getattr; */
NULL, /* setattrfunc tp_setattr; */
NULL, /* cmpfunc tp_compare; */
( cmpfunc ) Constraint_compare, /* cmpfunc tp_compare; */
( reprfunc ) Constraint_repr, /* reprfunc tp_repr; */
/* Method suites for standard classes */
@@ -1276,6 +1277,16 @@ static void Constraint_dealloc( BPy_Constraint * 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 */
/* Description: This is a callback function for the BPy_Constraint type. It */