[Bf-blender-cvs] [7967da2] master: Fix T46263: bpy api - assigning to object.matrix_basis with AXIS_ANGLE rotation mode does not work correctly.
Bastien Montagne
noreply at git.blender.org
Fri Sep 25 09:04:24 CEST 2015
Commit: 7967da2515e6ffd49d925dffa430e2d50e978bac
Author: Bastien Montagne
Date: Fri Sep 25 09:03:30 2015 +0200
Branches: master
https://developer.blender.org/rB7967da2515e6ffd49d925dffa430e2d50e978bac
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!
===================================================================
M source/blender/blenkernel/intern/object.c
===================================================================
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index 526a71b..0c9239e 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 */
More information about the Bf-blender-cvs
mailing list