diff options
author | Willian Padovani Germano <wpgermano@gmail.com> | 2003-05-21 23:58:31 +0400 |
---|---|---|
committer | Willian Padovani Germano <wpgermano@gmail.com> | 2003-05-21 23:58:31 +0400 |
commit | 89e9090c861839e7f4289c13f26ab12d4b503610 (patch) | |
tree | d9127dc65337136f6f2fc39da0ad44dc046e99dc /source/blender/python/api2_2x/Lamp.c | |
parent | 000f92e204b54d117789209b00fee88f279be6e1 (diff) |
Implemented the compare callback for Camera, Image, Lamp and Text types:
Following a suggestion made by Jordi Rovira i Bonet, the comparison
now is made via the pointers to the Blender objects, not their py wrappers.
Diffstat (limited to 'source/blender/python/api2_2x/Lamp.c')
-rw-r--r-- | source/blender/python/api2_2x/Lamp.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/source/blender/python/api2_2x/Lamp.c b/source/blender/python/api2_2x/Lamp.c index 111d01266cf..6d5da492fe4 100644 --- a/source/blender/python/api2_2x/Lamp.c +++ b/source/blender/python/api2_2x/Lamp.c @@ -172,9 +172,9 @@ PyObject *M_Lamp_Init (void) /* Three Python Lamp_Type helper functions needed by the Object module: */ /*****************************************************************************/ -/* Function: Lamp_createPyObject */ -/* Description: This function will create a new C_Lamp from an existing */ -/* Blender camera structure. */ +/* Function: Lamp_createPyObject */ +/* Description: This function will create a new C_Lamp from an existing */ +/* Blender lamp structure. */ /*****************************************************************************/ PyObject *Lamp_createPyObject (Lamp *lamp) { @@ -936,6 +936,20 @@ static int LampSetAttr (C_Lamp *self, char *name, PyObject *value) } /*****************************************************************************/ +/* Function: LampCompare */ +/* Description: This is a callback function for the C_Lamp type. It */ +/* compares two Lamp_Type objects. Only the "==" and "!=" */ +/* comparisons are meaninful. Returns 0 for equality and -1 if */ +/* they don't point to the same Blender Lamp struct. */ +/* In Python it becomes 1 if they are equal, 0 otherwise. */ +/*****************************************************************************/ +static int LampCompare (C_Lamp *a, C_Lamp *b) +{ + Lamp *pa = a->lamp, *pb = b->lamp; + return (pa == pb) ? 0:-1; +} + +/*****************************************************************************/ /* Function: LampPrint */ /* Description: This is a callback function for the C_Lamp type. It */ /* builds a meaninful string to 'print' lamp objects. */ |