[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [11582] trunk/blender/source/blender/ python/api2_2x/Bone.c: added bone comparison for the python api

Campbell Barton cbarton at metavr.com
Tue Aug 14 08:38:44 CEST 2007


Revision: 11582
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=11582
Author:   campbellbarton
Date:     2007-08-14 08:38:44 +0200 (Tue, 14 Aug 2007)

Log Message:
-----------
added bone comparison for the python api

Modified Paths:
--------------
    trunk/blender/source/blender/python/api2_2x/Bone.c

Modified: trunk/blender/source/blender/python/api2_2x/Bone.c
===================================================================
--- trunk/blender/source/blender/python/api2_2x/Bone.c	2007-08-14 05:01:39 UTC (rev 11581)
+++ trunk/blender/source/blender/python/api2_2x/Bone.c	2007-08-14 06:38:44 UTC (rev 11582)
@@ -762,6 +762,14 @@
 		return PyString_FromFormat( "[EditBone \"%s\"]", self->name ); 
 }
 
+static int EditBone_compare( BPy_EditBone * a, BPy_EditBone * b )
+{
+	/* if they are not wrapped, then they cant be the same */
+	if (a->editbone==NULL && b->editbone==NULL) return -1;
+	return ( a->editbone == b->editbone ) ? 0 : -1;
+}
+
+
 //------------------------tp_doc
 //The __doc__ string for this object
 static char BPy_EditBone_doc[] = "This is an internal subobject of armature\
@@ -829,7 +837,7 @@
 	0,											//tp_print
 	0,											//tp_getattr
 	0,											//tp_setattr
-	0,											//tp_compare
+	(cmpfunc)EditBone_compare,					//tp_compare
 	(reprfunc)EditBone_repr,			//tp_repr
 	0,											//tp_as_number
 	0,											//tp_as_sequence
@@ -1246,6 +1254,10 @@
 {
 	return PyString_FromFormat( "[Bone \"%s\"]", self->bone->name ); 
 }
+static int Bone_compare( BPy_Bone * a, BPy_Bone * b )
+{
+	return ( a->bone == b->bone ) ? 0 : -1;
+}
 //------------------------tp_dealloc
 //This tells how to 'tear-down' our object when ref count hits 0
 static void Bone_dealloc(BPy_Bone * self)
@@ -1262,15 +1274,15 @@
 PyTypeObject Bone_Type = {
 	PyObject_HEAD_INIT(NULL)   //tp_head
 	0,										//tp_internal
-	"Bone",								//tp_name
-	sizeof(BPy_Bone),					//tp_basicsize
+	"Bone",									//tp_name
+	sizeof(BPy_Bone),						//tp_basicsize
 	0,										//tp_itemsize
-	(destructor)Bone_dealloc,		//tp_dealloc
+	(destructor)Bone_dealloc,				//tp_dealloc
 	0,										//tp_print
 	0,										//tp_getattr
 	0,										//tp_setattr
-	0,										//tp_compare
-	(reprfunc) Bone_repr,			//tp_repr
+	(cmpfunc) Bone_compare,					//tp_compare
+	(reprfunc) Bone_repr,					//tp_repr
 	0,										//tp_as_number
 	0,										//tp_as_sequence
 	0,										//tp_as_mapping





More information about the Bf-blender-cvs mailing list