Revision: 22280
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=22280
Author:   campbellbarton
Date:     2009-08-07 00:11:33 +0200 (Fri, 07 Aug 2009)

Log Message:
-----------
[#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.

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

Modified: trunk/blender/source/blender/python/api2_2x/Bone.c
===================================================================
--- trunk/blender/source/blender/python/api2_2x/Bone.c  2009-08-06 22:06:11 UTC 
(rev 22279)
+++ trunk/blender/source/blender/python/api2_2x/Bone.c  2009-08-06 22:11:33 UTC 
(rev 22280)
@@ -1273,7 +1273,27 @@
 
        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
 //This contains a list of all methods the object contains
@@ -1284,6 +1304,8 @@
                "() - 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

Modified: trunk/blender/source/blender/python/api2_2x/doc/Armature.py
===================================================================
--- trunk/blender/source/blender/python/api2_2x/doc/Armature.py 2009-08-06 
22:06:11 UTC (rev 22279)
+++ trunk/blender/source/blender/python/api2_2x/doc/Armature.py 2009-08-06 
22:11:33 UTC (rev 22280)
@@ -307,6 +307,11 @@
        @type layerMask: Int
        """
 
+       def activate():
+               """
+               Sets this bone as active, de-activating all others.
+               """
+
        def hasParent():
                """
                Whether or not this bone has a parent


_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to