diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2007-12-08 18:44:47 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2007-12-08 18:44:47 +0300 |
commit | 85ee6302dddc150f3dfa250dbb1ac79427a84308 (patch) | |
tree | 35b85ceb22d4374f1a9e024ffed5d79831704a0e /source/blender/src/transform_conversions.c | |
parent | 48b6e01cc27a129bd27864a2f52ff608313efb18 (diff) |
Bone Transform
==============
When pressing the g key on a bone that can't be translated, rotation
is automatically activated. However, with multiple bone selected, it
did this even if some bones can be translated. Now it only switches
to rotation if no bones can translated.
Diffstat (limited to 'source/blender/src/transform_conversions.c')
-rw-r--r-- | source/blender/src/transform_conversions.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/source/blender/src/transform_conversions.c b/source/blender/src/transform_conversions.c index 8c8894affbd..65a3329b2ed 100644 --- a/source/blender/src/transform_conversions.c +++ b/source/blender/src/transform_conversions.c @@ -641,6 +641,7 @@ static void set_pose_transflags(TransInfo *t, Object *ob) bArmature *arm= ob->data; bPoseChannel *pchan; Bone *bone; + int hastranslation; t->total= 0; @@ -666,23 +667,32 @@ static void set_pose_transflags(TransInfo *t, Object *ob) } } /* now count, and check if we have autoIK or have to switch from translate to rotate */ + hastranslation= 0; + for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) { bone= pchan->bone; if(bone->flag & BONE_TRANSFORM) { + t->total++; if(t->mode==TFM_TRANSLATION) { if( has_targetless_ik(pchan)==NULL ) { if(pchan->parent && (pchan->bone->flag & BONE_CONNECTED)) { - if(!(pchan->bone->flag & BONE_HINGE_CHILD_TRANSFORM)) - t->mode= TFM_ROTATION; + if(pchan->bone->flag & BONE_HINGE_CHILD_TRANSFORM) + hastranslation= 1; } - else if((pchan->protectflag & OB_LOCK_LOC)==OB_LOCK_LOC) - t->mode= TFM_ROTATION; + else if((pchan->protectflag & OB_LOCK_LOC)!=OB_LOCK_LOC) + hastranslation= 1; } + else + hastranslation= 1; } } } + + /* if there are no translatable bones, do rotation */ + if(t->mode==TFM_TRANSLATION && !hastranslation) + t->mode= TFM_ROTATION; } /* frees temporal IKs */ |