diff options
author | Ton Roosendaal <ton@blender.org> | 2008-02-05 21:11:16 +0300 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2008-02-05 21:11:16 +0300 |
commit | 217b3647b1a1d56390b0795a59c7f82bc6e1d93a (patch) | |
tree | ad9d22abe10816c85f4ab49c8bee275d556e7bbf /source/blender/src/poseobject.c | |
parent | e04d7128cdbcaf05bb3e0b6127eb142e525ac377 (diff) |
When iserting rotations in poses, the quaternion sometimes rotates exactly
the opposite way as you want. Or even worse, you can never really define
which way it rotates (officially it should do shortest path).
This hotkey flips the quaternion (which means it rotates to same position
exactly via the other way). Hotkey ALT+F (flip) in 3d window posemode.
Diffstat (limited to 'source/blender/src/poseobject.c')
-rw-r--r-- | source/blender/src/poseobject.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/source/blender/src/poseobject.c b/source/blender/src/poseobject.c index fab2dc9d20c..ffba3c8cb05 100644 --- a/source/blender/src/poseobject.c +++ b/source/blender/src/poseobject.c @@ -1496,3 +1496,27 @@ void pose_relax() DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA); BIF_undo_push("Relax Pose"); } + +/* for use in insertkey, ensure rotation goes other way around */ +void pose_flipquats(void) +{ + Object *ob = OBACT; + bArmature *arm= ob->data; + bPoseChannel *pchan; + + if(ob->pose==NULL) + return; + + /* find sel bones */ + for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) { + if(pchan->bone && (pchan->bone->flag & BONE_SELECTED) && (pchan->bone->layer & arm->layer)) { + /* quaternions have 720 degree range */ + pchan->quat[0]= -pchan->quat[0]; + pchan->quat[1]= -pchan->quat[1]; + pchan->quat[2]= -pchan->quat[2]; + pchan->quat[3]= -pchan->quat[3]; + } + } + +} + |