diff options
author | Campbell Barton <campbell@blender.org> | 2022-08-25 05:38:04 +0300 |
---|---|---|
committer | Campbell Barton <campbell@blender.org> | 2022-08-25 05:38:04 +0300 |
commit | 9f1c05d5cbaaebcd6254d99cd59a78d3a2f99a04 (patch) | |
tree | 70d541b32ae540b8124a97956ca3552eaf192a95 /source/blender/editors/space_view3d/view3d_utils.c | |
parent | a604ed0068a0e23c133f3aad5cf0d697336192c1 (diff) |
Fix matrix/quaternion conversion with negative scaled cameras
Diffstat (limited to 'source/blender/editors/space_view3d/view3d_utils.c')
-rw-r--r-- | source/blender/editors/space_view3d/view3d_utils.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/source/blender/editors/space_view3d/view3d_utils.c b/source/blender/editors/space_view3d/view3d_utils.c index cb716391fb2..5154c2d4f52 100644 --- a/source/blender/editors/space_view3d/view3d_utils.c +++ b/source/blender/editors/space_view3d/view3d_utils.c @@ -1485,15 +1485,18 @@ void ED_view3d_from_m4(const float mat[4][4], float ofs[3], float quat[4], const negate_v3_v3(ofs, mat[3]); } + if (ofs && dist) { + madd_v3_v3fl(ofs, nmat[2], *dist); + } + /* Quat */ if (quat) { + if (is_negative_m3(nmat)) { + negate_m3(nmat); + } mat3_normalized_to_quat(quat, nmat); invert_qt_normalized(quat); } - - if (ofs && dist) { - madd_v3_v3fl(ofs, nmat[2], *dist); - } } void ED_view3d_to_m4(float mat[4][4], const float ofs[3], const float quat[4], const float dist) |