Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Leung <aligorith@gmail.com>2009-09-11 16:44:09 +0400
committerJoshua Leung <aligorith@gmail.com>2009-09-11 16:44:09 +0400
commitbaf12d3d1712235f94bf7db27aed21421d74efea (patch)
treea8b32f934c0ad05cdc278515433b41046105ad63 /source/blender/editors/armature
parentd5009eb1423c3c0359cbc85c7346412c597b8663 (diff)
2.5 - Rotation work (axis angle bugfixes + cleanups)
* Made transform work better with axis-angle * Corrected the rotation-type handling code in a few places
Diffstat (limited to 'source/blender/editors/armature')
-rw-r--r--source/blender/editors/armature/editarmature.c12
-rw-r--r--source/blender/editors/armature/poselib.c16
-rw-r--r--source/blender/editors/armature/poseobject.c14
3 files changed, 27 insertions, 15 deletions
diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c
index 4f5d8872384..3b6c9e9d13d 100644
--- a/source/blender/editors/armature/editarmature.c
+++ b/source/blender/editors/armature/editarmature.c
@@ -4856,9 +4856,13 @@ static int pose_clear_rot_exec(bContext *C, wmOperator *op)
QUATCOPY(quat1, pchan->quat);
QuatToEul(pchan->quat, oldeul);
}
+ else if (pchan->rotmode == PCHAN_ROT_AXISANGLE) {
+ continue; // XXX
+ }
else {
VECCOPY(oldeul, pchan->eul);
}
+
eul[0]= eul[1]= eul[2]= 0.0f;
if (pchan->protectflag & OB_LOCK_ROTX)
@@ -4875,6 +4879,9 @@ static int pose_clear_rot_exec(bContext *C, wmOperator *op)
QuatMulf(pchan->quat, -1.0f);
}
}
+ else if (pchan->rotmode == PCHAN_ROT_AXISANGLE) {
+ // TODO...
+ }
else {
VECCOPY(pchan->eul, eul);
}
@@ -4884,6 +4891,11 @@ static int pose_clear_rot_exec(bContext *C, wmOperator *op)
pchan->quat[1]=pchan->quat[2]=pchan->quat[3]= 0.0f;
pchan->quat[0]= 1.0f;
}
+ else if (pchan->rotmode == PCHAN_ROT_AXISANGLE) {
+ /* by default, make rotation of 0 radians around y-axis (roll) */
+ pchan->quat[0]=pchan->quat[1]=pchan->quat[3]= 0.0f;
+ pchan->quat[2]= 1.0f;
+ }
else {
pchan->eul[0]= pchan->eul[1]= pchan->eul[2]= 0.0f;
}
diff --git a/source/blender/editors/armature/poselib.c b/source/blender/editors/armature/poselib.c
index 56d714fd058..46d08afa656 100644
--- a/source/blender/editors/armature/poselib.c
+++ b/source/blender/editors/armature/poselib.c
@@ -278,8 +278,7 @@ void poselib_validate_act (bAction *act)
/* ************************************************************* */
/* Pointers to the builtin KeyingSets that we want to use */
-static KeyingSet *poselib_ks_locrotscale = NULL; /* quaternion rotations */
-static KeyingSet *poselib_ks_locrotscale2 = NULL; /* euler rotations */ // XXX FIXME...
+static KeyingSet *poselib_ks_locrotscale = NULL; /* the only keyingset we'll need*/
static short poselib_ks_need_init= 1; /* have the above been obtained yet? */
/* Make sure the builtin KeyingSets are initialised properly
@@ -290,13 +289,9 @@ static void poselib_get_builtin_keyingsets (void)
/* only if we haven't got these yet */
// FIXME: this assumes that we will always get the builtin sets...
if (poselib_ks_need_init) {
- /* LocRotScale (quaternions) */
+ /* LocRotScale (quaternions or eulers depending on context) */
poselib_ks_locrotscale= ANIM_builtin_keyingset_get_named(NULL, "LocRotScale");
- /* LocRotScale (euler) */
- //ks_locrotscale2= ANIM_builtin_keyingset_get_named(ks_locrotscale, "LocRotScale");
- poselib_ks_locrotscale2= poselib_ks_locrotscale; // FIXME: for now, just use the same one...
-
/* clear flag requesting init */
poselib_ks_need_init= 0;
}
@@ -410,11 +405,8 @@ static int poselib_add_exec (bContext *C, wmOperator *op)
/* init cks for this PoseChannel, then use the relative KeyingSets to keyframe it */
cks.pchan= pchan;
- /* KeyingSet to use depends on rotation mode */
- if (pchan->rotmode)
- modify_keyframes(C, &dsources, act, poselib_ks_locrotscale2, MODIFYKEY_MODE_INSERT, (float)frame);
- else
- modify_keyframes(C, &dsources, act, poselib_ks_locrotscale, MODIFYKEY_MODE_INSERT, (float)frame);
+ /* KeyingSet to use depends on rotation mode (but that's handled by the templates code) */
+ modify_keyframes(C, &dsources, act, poselib_ks_locrotscale, MODIFYKEY_MODE_INSERT, (float)frame);
}
}
}
diff --git a/source/blender/editors/armature/poseobject.c b/source/blender/editors/armature/poseobject.c
index 0ae92de4407..9a404e24e12 100644
--- a/source/blender/editors/armature/poseobject.c
+++ b/source/blender/editors/armature/poseobject.c
@@ -812,10 +812,17 @@ void pose_copy_menu(Scene *scene)
armature_mat_pose_to_bone(pchan, pchanact->pose_mat, delta_mat);
- if (pchan->rotmode > 0)
- Mat4ToEulO(delta_mat, pchan->eul, pchan->rotmode);
- else
+ if (pchan->rotmode == PCHAN_ROT_AXISANGLE) {
+ float tmp_quat[4];
+
+ /* need to convert to quat first (in temp var)... */
+ Mat4ToQuat(delta_mat, tmp_quat);
+ QuatToAxisAngle(tmp_quat, &pchan->quat[1], &pchan->quat[0]);
+ }
+ else if (pchan->rotmode == PCHAN_ROT_QUAT)
Mat4ToQuat(delta_mat, pchan->quat);
+ else
+ Mat4ToEulO(delta_mat, pchan->eul, pchan->rotmode);
}
break;
case 11: /* Visual Size */
@@ -991,6 +998,7 @@ static int pose_paste_exec (bContext *C, wmOperator *op)
pchan->flag= chan->flag;
/* check if rotation modes are compatible (i.e. do they need any conversions) */
+ // FIXME: add axis-angle here too...
if (pchan->rotmode == chan->rotmode) {
/* copy the type of rotation in use */
if (pchan->rotmode > 0) {