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/Material.c
parentaaaae785276e287d9a30a005d14af61524845d72 (diff)
added comparison function to many python types so you can do == and =!
Diffstat (limited to 'source/blender/python/api2_2x/Material.c')
-rw-r--r--source/blender/python/api2_2x/Material.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/source/blender/python/api2_2x/Material.c b/source/blender/python/api2_2x/Material.c
index 663a3cd45b5..0d4405483f2 100644
--- a/source/blender/python/api2_2x/Material.c
+++ b/source/blender/python/api2_2x/Material.c
@@ -1081,6 +1081,7 @@ static PyGetSetDef BPy_Material_getseters[] = {
/* Python Material_Type callback function prototypes: */
/*****************************************************************************/
static void Material_dealloc( BPy_Material * self );
+static int Material_compare( BPy_Material * a, BPy_Material * b);
static PyObject *Material_repr( BPy_Material * self );
/*****************************************************************************/
@@ -1100,7 +1101,7 @@ PyTypeObject Material_Type = {
NULL, /* printfunc tp_print; */
NULL, /* getattrfunc tp_getattr; */
NULL, /* setattrfunc tp_setattr; */
- NULL, /* cmpfunc tp_compare; */
+ ( cmpfunc ) Material_compare,/* cmpfunc tp_compare; */
( reprfunc ) Material_repr, /* reprfunc tp_repr; */
/* Method suites for standard classes */
@@ -2501,6 +2502,12 @@ static PyObject *Material_copy( BPy_Material * self )
return ( PyObject * ) pymat;
}
+/* mat_a==mat_b or mat_a!=mat_b*/
+static int Material_compare( BPy_Material * a, BPy_Material * b )
+{
+ return ( a->material == b->material) ? 0 : -1;
+}
+
/*****************************************************************************/
/* Function: Material_repr */
/* Description: This is a callback function for the BPy_Material type. It */