diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-08-07 02:11:33 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-08-07 02:11:33 +0400 |
commit | 85d75077a6f21e175689ae0317d5847e321a43c4 (patch) | |
tree | 2acb0531fc44151561cc8288a29e763f492fb2a0 | |
parent | d608d3358393ad682567026fc9dfc5632a567511 (diff) |
[#19035] New Python command to set the active flag of Armature Bones
from Ivo Grigull (loolarge)
Removed redraw calls from the python function, added epydocs.
-rw-r--r-- | source/blender/python/api2_2x/Bone.c | 22 | ||||
-rw-r--r-- | source/blender/python/api2_2x/doc/Armature.py | 5 |
2 files changed, 27 insertions, 0 deletions
diff --git a/source/blender/python/api2_2x/Bone.c b/source/blender/python/api2_2x/Bone.c index cacb3584344..f042176ec59 100644 --- a/source/blender/python/api2_2x/Bone.c +++ b/source/blender/python/api2_2x/Bone.c @@ -1273,6 +1273,26 @@ static int Bone_setLayerMask(BPy_Bone *self, PyObject *value) return 0; } +//-------------------------Bone.activate() +static PyObject *Bone_activate(BPy_Bone *self) + +{ + struct Bone *firstbone = self->bone; // unset all bone's active flag first + while(firstbone->prev ) + firstbone= firstbone->prev; + + while(firstbone->next) { + firstbone->flag &= ~BONE_ACTIVE; + firstbone= firstbone->next; + } + + self->bone->flag |= BONE_ACTIVE; // this makes the bones curves display in the IPO editor + + /* redraw will need to be called by python */ + + Py_RETURN_NONE; + +} //------------------TYPE_OBECT IMPLEMENTATION-------------------------- //------------------------tp_methods @@ -1284,6 +1304,8 @@ static PyMethodDef BPy_Bone_methods[] = { "() - True/False - Bone has 1 or more children"}, {"getAllChildren", (PyCFunction) Bone_getAllChildren, METH_NOARGS, "() - All the children for this bone - including children's children"}, + {"activate", (PyCFunction) Bone_activate, METH_NOARGS, + "Display curves in the IPO editor"}, {NULL, NULL, 0, NULL} }; //------------------------tp_getset diff --git a/source/blender/python/api2_2x/doc/Armature.py b/source/blender/python/api2_2x/doc/Armature.py index 9aceb0105e3..78b9214f121 100644 --- a/source/blender/python/api2_2x/doc/Armature.py +++ b/source/blender/python/api2_2x/doc/Armature.py @@ -307,6 +307,11 @@ class Bone: @type layerMask: Int """ + def activate(): + """ + Sets this bone as active, de-activating all others. + """ + def hasParent(): """ Whether or not this bone has a parent |