use armature active bone as a pointer rather then a flag for each bone that needs...
[blender.git] / source / blender / editors / transform / transform_manipulator.c
index 0f4848d91208775feb8b9ab0f066daa5460b893e..86e83715da428cd52f910b072f5c47420cddf937 100644 (file)
@@ -55,6 +55,7 @@
 
 #include "RNA_access.h"
 
+#include "BKE_action.h"
 #include "BKE_armature.h"
 #include "BKE_context.h"
 #include "BKE_global.h"
@@ -185,18 +186,9 @@ void gimbal_axis(Object *ob, float gmat[][3])
 {
        if(ob->mode & OB_MODE_POSE)
        {
-               bPoseChannel *pchan= NULL;
+               bPoseChannel *pchan= get_active_posechannel(ob);
 
-               /* use channels to get stats */
-               for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
-                       if (pchan->bone && pchan->bone->flag & BONE_ACTIVE) {
-                               if(test_rotmode_euler(pchan->rotmode)) {
-                                       break;
-                               }
-                       }
-               }
-
-               if(pchan) {
+               if(pchan && test_rotmode_euler(pchan->rotmode)) {
                        float mat[3][3], tmat[3][3], obmat[3][3];
 
                        EulToGimbalAxis(mat, pchan->eul, pchan->rotmode);