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.
This commit is contained in:
2003-05-21 19:58:31 +00:00
parent 000f92e204
commit 89e9090c86
9 changed files with 108 additions and 47 deletions

View File

@@ -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)
{
@@ -935,6 +935,20 @@ static int LampSetAttr (C_Lamp *self, char *name, PyObject *value)
return 0; /* normal exit */
}
/*****************************************************************************/
/* 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 */