From 7967da2515e6ffd49d925dffa430e2d50e978bac Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Fri, 25 Sep 2015 09:03:30 +0200 Subject: Fix T46263: bpy api - assigning to object.matrix_basis with AXIS_ANGLE rotation mode does not work correctly. Drot in axis angle does not make that much sense anyway (it's even disabled in UI), but let's apply it correctly at least! --- source/blender/blenkernel/intern/object.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'source/blender/blenkernel') diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 526a71b477d..0c9239e3ddf 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -1950,9 +1950,15 @@ void BKE_object_mat3_to_rot(Object *ob, float mat[3][3], bool use_compat) } case ROT_MODE_AXISANGLE: { - mat3_to_axis_angle(ob->rotAxis, &ob->rotAngle, mat); - sub_v3_v3(ob->rotAxis, ob->drotAxis); - ob->rotAngle -= ob->drotAngle; + float quat[4]; + float dquat[4]; + + /* without drot we could apply 'mat' directly */ + mat3_to_quat(quat, mat); + axis_angle_to_quat(dquat, ob->drotAxis, ob->drotAngle); + invert_qt(dquat); + mul_qt_qtqt(quat, dquat, quat); + quat_to_axis_angle(ob->rotAxis, &ob->rotAngle, quat); break; } default: /* euler */ -- cgit v1.2.3