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/Lattice.c
parentaaaae785276e287d9a30a005d14af61524845d72 (diff)
added comparison function to many python types so you can do == and =!
Diffstat (limited to 'source/blender/python/api2_2x/Lattice.c')
-rw-r--r--source/blender/python/api2_2x/Lattice.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/source/blender/python/api2_2x/Lattice.c b/source/blender/python/api2_2x/Lattice.c
index cceb536efd7..8ff6634ae57 100644
--- a/source/blender/python/api2_2x/Lattice.c
+++ b/source/blender/python/api2_2x/Lattice.c
@@ -193,6 +193,7 @@ static void Lattice_dealloc( BPy_Lattice * self );
static int Lattice_setAttr( BPy_Lattice * self, char *name, PyObject * v );
static PyObject *Lattice_getAttr( BPy_Lattice * self, char *name );
static PyObject *Lattice_repr( BPy_Lattice * self );
+static int Lattice_compare( BPy_Lattice * a, BPy_Lattice * b );
/*****************************************************************************/
/* Python Lattice_Type structure definition: */
@@ -208,7 +209,7 @@ PyTypeObject Lattice_Type = {
0, /* tp_print */
( getattrfunc ) Lattice_getAttr, /* tp_getattr */
( setattrfunc ) Lattice_setAttr, /* tp_setattr */
- 0, /* tp_compare */
+ ( cmpfunc ) Lattice_compare, /* tp_compare */
( reprfunc ) Lattice_repr, /* tp_repr */
0, /* tp_as_number */
0, /* tp_as_sequence */
@@ -927,6 +928,13 @@ static int Lattice_setAttr( BPy_Lattice * self, char *name, PyObject * value )
return 0; // normal exit
}
+
+static int Lattice_compare( BPy_Lattice * a, BPy_Lattice * b )
+{
+ return ( a->Lattice == b->Lattice ) ? 0 : -1;
+}
+
+
//***************************************************************************
// Function: Lattice_repr
// Description: This is a callback function for the BPy_Lattice type. It