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>2007-08-14 10:38:44 +0400
committerCampbell Barton <ideasman42@gmail.com>2007-08-14 10:38:44 +0400
commit61f4d6ae4d23de0a668ab03fb0670a49435dde00 (patch)
tree7f738e7b0bb4ed68f9406dae0e1939607661f805 /source/blender/python/api2_2x/Bone.c
parent03d4cd12407114fb335783f4a928962fa374d570 (diff)
added bone comparison for the python api
Diffstat (limited to 'source/blender/python/api2_2x/Bone.c')
-rw-r--r--source/blender/python/api2_2x/Bone.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/source/blender/python/api2_2x/Bone.c b/source/blender/python/api2_2x/Bone.c
index ad589615b7d..733b8251215 100644
--- a/source/blender/python/api2_2x/Bone.c
+++ b/source/blender/python/api2_2x/Bone.c
@@ -762,6 +762,14 @@ static PyObject *EditBone_repr(BPy_EditBone *self)
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 @@ PyTypeObject EditBone_Type = {
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 @@ static PyObject *Bone_repr(BPy_Bone *self)
{
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 @@ static char BPy_Bone_doc[] = "This object wraps a Blender Boneobject.\n\
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