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

@@ -241,6 +241,7 @@ static void CurveDeAlloc( BPy_Curve * msh );
/* static int CurvePrint (BPy_Curve *msh, FILE *fp, int flags); */
static int CurveSetAttr( BPy_Curve * msh, char *name, PyObject * v );
static PyObject *CurveGetAttr( BPy_Curve * msh, char *name );
static int CurveCopmpare( BPy_Curve * a, BPy_Curve * b );
static PyObject *CurveRepr( BPy_Curve * msh );
static PySequenceMethods Curve_as_sequence = {
@@ -271,7 +272,7 @@ PyTypeObject Curve_Type = {
0, /* tp_print */
( getattrfunc ) CurveGetAttr, /* tp_getattr */
( setattrfunc ) CurveSetAttr, /* tp_setattr */
0, /* tp_compare */
( cmpfunc ) CurveCopmpare, /* tp_compare */
( reprfunc ) CurveRepr, /* tp_repr */
/* methods for standard classes */
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 */
/* Description: This is a callback function for the BPy_Curve type. It */