diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-05-16 06:38:33 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-05-16 06:50:00 +0300 |
commit | c9c23a3e44c0648d37396bbb19236e881d33e2cc (patch) | |
tree | 12b7b7f2dc205d1ad373f78396841d5290abcf31 /source/blender/blenkernel/intern/scene.c | |
parent | f2144cf298aab7fd173025e490fa9e98b7661a88 (diff) |
RNA: add 3D cursor matrix attribute
Avoids having to check rotation modes to get the orientation.
Diffstat (limited to 'source/blender/blenkernel/intern/scene.c')
-rw-r--r-- | source/blender/blenkernel/intern/scene.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index 714261ce4ab..a1e6aa6c4d6 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -2386,4 +2386,20 @@ void BKE_scene_cursor_quat_to_rot(View3DCursor *cursor, const float quat[4], boo } } +void BKE_scene_cursor_to_mat4(const View3DCursor *cursor, float mat[4][4]) +{ + float mat3[3][3]; + BKE_scene_cursor_rot_to_mat3(cursor, mat3); + copy_m4_m3(mat, mat3); + copy_v3_v3(mat[3], cursor->location); +} + +void BKE_scene_cursor_from_mat4(View3DCursor *cursor, const float mat[4][4], bool use_compat) +{ + float mat3[3][3]; + copy_m3_m4(mat3, mat); + BKE_scene_cursor_mat3_to_rot(cursor, mat3, use_compat); + copy_v3_v3(cursor->location, mat[3]); +} + /** \} */ |