diff options
author | Joshua Leung <aligorith@gmail.com> | 2009-09-12 09:06:28 +0400 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2009-09-12 09:06:28 +0400 |
commit | 83074d0b3758c1b2d2811974726d4dd33f3034da (patch) | |
tree | 6ef4208631de9435d71cdd29637ee9ca329f6e68 /source/blender/editors/armature/poseobject.c | |
parent | f0eb02a36b5a04d18a1a587b1e36419daa6a6f23 (diff) |
2.5 - More work on Axis-Angle Rotations
* Added a few new methods for axis-angle conversions, and used these instead of manually performing those steps elsewhere
* Axis-angles to other representations now get their axes normalised to make sure that odd scaling doesn't occur.
* Made a few more tools work with axis-angles properly
Diffstat (limited to 'source/blender/editors/armature/poseobject.c')
-rw-r--r-- | source/blender/editors/armature/poseobject.c | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/source/blender/editors/armature/poseobject.c b/source/blender/editors/armature/poseobject.c index 9a404e24e12..b473b9ee226 100644 --- a/source/blender/editors/armature/poseobject.c +++ b/source/blender/editors/armature/poseobject.c @@ -1009,12 +1009,25 @@ static int pose_paste_exec (bContext *C, wmOperator *op) } } else if (pchan->rotmode > 0) { - /* quat to euler */ - QuatToEulO(chan->quat, pchan->eul, pchan->rotmode); + /* quat/axis-angle to euler */ + if (chan->rotmode == PCHAN_ROT_AXISANGLE) + AxisAngleToEulO(&chan->quat[1], chan->quat[0], pchan->eul, pchan->rotmode); + else + QuatToEulO(chan->quat, pchan->eul, pchan->rotmode); + } + else if (pchan->rotmode == PCHAN_ROT_AXISANGLE) { + /* quat/euler to axis angle */ + if (chan->rotmode > 0) + EulOToAxisAngle(chan->eul, chan->rotmode, &pchan->quat[1], &pchan->quat[0]); + else + QuatToAxisAngle(chan->quat, &pchan->quat[1], &pchan->quat[0]); } else { - /* euler to quat */ - EulOToQuat(chan->eul, chan->rotmode, pchan->quat); + /* euler/axis-angle to quat */ + if (chan->rotmode > 0) + EulOToQuat(chan->eul, chan->rotmode, pchan->quat); + else + AxisAngleToQuat(pchan->quat, &chan->quat[1], chan->quat[0]); } /* paste flipped pose? */ @@ -1026,6 +1039,14 @@ static int pose_paste_exec (bContext *C, wmOperator *op) pchan->eul[1] *= -1; pchan->eul[2] *= -1; } + else if (pchan->rotmode == PCHAN_ROT_AXISANGLE) { + float eul[3]; + + AxisAngleToEulO(&pchan->quat[1], pchan->quat[0], eul, EULER_ORDER_DEFAULT); + eul[1]*= -1; + eul[2]*= -1; + EulOToAxisAngle(eul, EULER_ORDER_DEFAULT, &pchan->quat[1], &pchan->quat[0]); + } else { float eul[3]; |