diff options
author | Campbell Barton <ideasman42@gmail.com> | 2006-10-06 20:48:28 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2006-10-06 20:48:28 +0400 |
commit | dda63a9dde8600f85e43bc4d654cbe80d07cab6e (patch) | |
tree | 76010b4123957872bba0dbcd399da90e590ddfff /source/blender/python/api2_2x/NLA.c | |
parent | aaaae785276e287d9a30a005d14af61524845d72 (diff) |
added comparison function to many python types so you can do == and =!
Diffstat (limited to 'source/blender/python/api2_2x/NLA.c')
-rw-r--r-- | source/blender/python/api2_2x/NLA.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/source/blender/python/api2_2x/NLA.c b/source/blender/python/api2_2x/NLA.c index e7503ce9912..f729d2cf99b 100644 --- a/source/blender/python/api2_2x/NLA.c +++ b/source/blender/python/api2_2x/NLA.c @@ -124,8 +124,10 @@ static PyMethodDef BPy_Action_methods[] = { static void Action_dealloc( BPy_Action * bone ); static PyObject *Action_getAttr( BPy_Action * bone, char *name ); static int Action_setAttr( BPy_Action * bone, char *name, PyObject * v ); +static int Action_compare( BPy_Action * a, BPy_Action * b ); static PyObject *Action_repr( BPy_Action * bone ); + /*****************************************************************************/ /* Python TypeAction structure definition: */ /*****************************************************************************/ @@ -140,7 +142,7 @@ PyTypeObject Action_Type = { 0, /* tp_print */ ( getattrfunc ) Action_getAttr, /* tp_getattr */ ( setattrfunc ) Action_setAttr, /* tp_setattr */ - 0, /* tp_compare */ + ( cmpfunc ) Action_compare, /* tp_compare */ ( reprfunc ) Action_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ @@ -496,6 +498,13 @@ static int Action_setAttr( BPy_Action * self, char *name, PyObject * value ) } /*----------------------------------------------------------------------*/ +static int Action_compare( BPy_Action * a, BPy_Action * b ) +{ + return ( a->action == b->action ) ? 0 : -1; +} + + +/*----------------------------------------------------------------------*/ static PyObject *Action_repr( BPy_Action * self ) { if( self->action ) |