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!
This commit is contained in:
parent
b278e8742b
commit
7967da2515
Notes:
blender-bot
2023-02-14 19:53:07 +01:00
Referenced by issue blender/blender-addons#46263, bpy api - assigning to object.matrix_basis with AXIS_ANGLE rotation mode does not work correctly
|
@ -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 */
|
||||
|
|
Loading…
Reference in New Issue