Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2006-10-06 20:48:28 +0400
committerCampbell Barton <ideasman42@gmail.com>2006-10-06 20:48:28 +0400
commitdda63a9dde8600f85e43bc4d654cbe80d07cab6e (patch)
tree76010b4123957872bba0dbcd399da90e590ddfff /source/blender/python/api2_2x/Ipo.c
parentaaaae785276e287d9a30a005d14af61524845d72 (diff)
added comparison function to many python types so you can do == and =!
Diffstat (limited to 'source/blender/python/api2_2x/Ipo.c')
-rw-r--r--source/blender/python/api2_2x/Ipo.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/source/blender/python/api2_2x/Ipo.c b/source/blender/python/api2_2x/Ipo.c
index 1ad9f45ee0e..0ed1a84ed01 100644
--- a/source/blender/python/api2_2x/Ipo.c
+++ b/source/blender/python/api2_2x/Ipo.c
@@ -228,6 +228,7 @@ static PySequenceMethods Ipo_as_sequence = {
/*****************************************************************************/
static void Ipo_dealloc( BPy_Ipo * self );
//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_getIter( BPy_Ipo * self );
static PyObject *Ipo_nextIter( BPy_Ipo * self );
@@ -365,7 +366,7 @@ PyTypeObject Ipo_Type = {
NULL, /* printfunc tp_print; */
NULL, /* getattrfunc tp_getattr; */
NULL, /* setattrfunc tp_setattr; */
- NULL, /* cmpfunc tp_compare; */
+ ( reprfunc ) Ipo_compare, /* cmpfunc tp_compare; */
( reprfunc ) Ipo_repr, /* reprfunc tp_repr; */
/* Method suites for standard classes */
@@ -1303,6 +1304,15 @@ static void Ipo_dealloc( BPy_Ipo * 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 */
/* Description: This is a callback function for the BPy_Ipo type. It */
/* builds a meaningful string to represent ipo objects. */