[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [11583] branches/2-44-stable/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:39:07 CEST 2007
Revision: 11583
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=11583
Author: campbellbarton
Date: 2007-08-14 08:39:07 +0200 (Tue, 14 Aug 2007)
Log Message:
-----------
added bone comparison for the python API
Modified Paths:
--------------
branches/2-44-stable/blender/source/blender/python/api2_2x/Bone.c
Modified: branches/2-44-stable/blender/source/blender/python/api2_2x/Bone.c
===================================================================
--- branches/2-44-stable/blender/source/blender/python/api2_2x/Bone.c 2007-08-14 06:38:44 UTC (rev 11582)
+++ branches/2-44-stable/blender/source/blender/python/api2_2x/Bone.c 2007-08-14 06:39:07 UTC (rev 11583)
@@ -761,6 +761,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\
@@ -828,8 +836,8 @@
0, //tp_print
0, //tp_getattr
0, //tp_setattr
- 0, //tp_compare
- (reprfunc)EditBone_repr, //tp_repr
+ (cmpfunc)EditBone_compare, //tp_compare
+ (reprfunc)EditBone_repr, //tp_repr
0, //tp_as_number
0, //tp_as_sequence
0, //tp_as_mapping
@@ -1224,6 +1232,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)
@@ -1247,8 +1259,8 @@
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