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/Ipocurve.c | |
parent | aaaae785276e287d9a30a005d14af61524845d72 (diff) |
added comparison function to many python types so you can do == and =!
Diffstat (limited to 'source/blender/python/api2_2x/Ipocurve.c')
-rw-r--r-- | source/blender/python/api2_2x/Ipocurve.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/source/blender/python/api2_2x/Ipocurve.c b/source/blender/python/api2_2x/Ipocurve.c index 4a7fe47db29..96111d7012c 100644 --- a/source/blender/python/api2_2x/Ipocurve.c +++ b/source/blender/python/api2_2x/Ipocurve.c @@ -175,6 +175,7 @@ static PyMappingMethods IpoCurve_as_mapping = { /*****************************************************************************/ /* Python IpoCurve_Type callback function prototypes: */ /*****************************************************************************/ +static int IpoCurve_compare( C_IpoCurve * a, C_IpoCurve * b ); static PyObject *IpoCurve_repr( C_IpoCurve * self ); static void IpoCurve_dealloc( C_IpoCurve * self ); @@ -192,7 +193,7 @@ PyTypeObject IpoCurve_Type = { 0, /* tp_print */ ( getattrfunc ) NULL, /* tp_getattr */ ( setattrfunc ) NULL, /* tp_setattr */ - 0, /* tp_compare */ + ( cmpfunc ) IpoCurve_compare, /* tp_compare */ ( reprfunc ) IpoCurve_repr, /* tp_repr */ /* Method suites for standard classes */ @@ -647,6 +648,15 @@ static void IpoCurve_dealloc( C_IpoCurve * self ) } /*****************************************************************************/ +/* Function: IpoCurve_compare */ +/* Description: This compares 2 python types, == or != only. */ +/*****************************************************************************/ +static int IpoCurve_compare( C_IpoCurve * a, C_IpoCurve * b ) +{ + return ( a->ipocurve == b->ipocurve ) ? 0 : -1; +} + +/*****************************************************************************/ /* Function: IpoCurve_repr */ /* Description: This is a callback function for the C_IpoCurve type. It */ /* builds a meaningful string to represent ipocurve objects. */ |