diff -rup /home/compile/bl249/blender2/source/blender/python/api2_2x/Armature.c /home/compile/bl249/blender/source/blender/python/api2_2x/Armature.c --- /home/compile/bl249/blender2/source/blender/python/api2_2x/Armature.c 2009-08-01 13:11:50.000000000 +0000 +++ /home/compile/bl249/blender/source/blender/python/api2_2x/Armature.c 2009-08-09 11:38:07.000000000 +0000 @@ -506,6 +506,45 @@ static PyObject *Armature_copy(BPy_Armat return py_armature; } +//------------------------Armature.deselectbones() +void deselect_boneChildren(Bone *bone) +{ + Bone *child; + + if (bone) { + + child=bone->childbase.first; + if (child){ + while (child){ + //printf("current %s\n", child->name); + child->flag &= ~BONE_SELECTED; + child->flag &= ~BONE_ACTIVE; + deselect_boneChildren(child); + child=child->next; + } + } + } +} + +static PyObject *Armature_deselectbones(BPy_Armature *self) +{ + Bone* firstbone = self->armature->bonebase.first; + + while(firstbone->prev ) + firstbone= firstbone->prev; + + if (firstbone){ + while (firstbone){ + deselect_boneChildren(firstbone); + firstbone->flag &= ~BONE_SELECTED; + firstbone->flag &= ~BONE_ACTIVE; + firstbone=firstbone->next; + } + } + + Py_RETURN_NONE; +} + //------------------ATTRIBUTE IMPLEMENTATION--------------------------- //------------------------Armature.autoIK (getter) static PyObject *Armature_getAutoIK(BPy_Armature *self, void *closure) @@ -968,6 +1007,8 @@ static PyMethodDef BPy_Armature_methods[ "() - Return a copy of the armature."}, {"copy", (PyCFunction) Armature_copy, METH_NOARGS, "() - Return a copy of the armature."}, + {"deselectbones", (PyCFunction) Armature_deselectbones, METH_NOARGS, + "Deselect all bones of the armature"}, {NULL, NULL, 0, NULL} }; //------------------------tp_getset diff -rup /home/compile/bl249/blender2/source/blender/python/api2_2x/Bone.c /home/compile/bl249/blender/source/blender/python/api2_2x/Bone.c --- /home/compile/bl249/blender2/source/blender/python/api2_2x/Bone.c 2009-08-09 06:49:56.000000000 +0000 +++ /home/compile/bl249/blender/source/blender/python/api2_2x/Bone.c 2009-08-09 11:38:27.000000000 +0000 @@ -1294,6 +1294,16 @@ static PyObject *Bone_activate(BPy_Bone } +//-------------------------Bone.select() +static PyObject *Bone_select(BPy_Bone *self) + +{ + self->bone->flag |= BONE_SELECTED; + + Py_RETURN_NONE; +} + + //------------------TYPE_OBECT IMPLEMENTATION-------------------------- //------------------------tp_methods //This contains a list of all methods the object contains @@ -1306,6 +1316,8 @@ static PyMethodDef BPy_Bone_methods[] = "() - All the children for this bone - including children's children"}, {"activate", (PyCFunction) Bone_activate, METH_NOARGS, "Display curves in the IPO editor"}, + {"select", (PyCFunction) Bone_select, METH_NOARGS, + "Select bone"}, {NULL, NULL, 0, NULL} }; //------------------------tp_getset