diff options
Diffstat (limited to 'source/blender/draw/intern/draw_view.c')
-rw-r--r-- | source/blender/draw/intern/draw_view.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/source/blender/draw/intern/draw_view.c b/source/blender/draw/intern/draw_view.c index 2426e98ec84..9bc4e7e8470 100644 --- a/source/blender/draw/intern/draw_view.c +++ b/source/blender/draw/intern/draw_view.c @@ -201,12 +201,18 @@ void DRW_draw_cursor(void) if (is_cursor_visible(draw_ctx, scene, view_layer)) { int co[2]; + + /* Get cursor data into quaternion form */ const View3DCursor *cursor = &scene->cursor; + if (ED_view3d_project_int_global( ar, cursor->location, co, V3D_PROJ_TEST_NOP | V3D_PROJ_TEST_CLIP_NEAR) == V3D_PROJ_RET_OK) { RegionView3D *rv3d = ar->regiondata; + float cursor_quat[4]; + BKE_scene_cursor_rot_to_quat(cursor, cursor_quat); + /* Draw nice Anti Aliased cursor. */ GPU_line_width(1.0f); glEnable(GL_BLEND); @@ -214,7 +220,12 @@ void DRW_draw_cursor(void) float eps = 1e-5f; rv3d->viewquat[0] = -rv3d->viewquat[0]; - const bool is_aligned = compare_v4v4(cursor->rotation, rv3d->viewquat, eps); + bool is_aligned = compare_v4v4(cursor_quat, rv3d->viewquat, eps); + if (is_aligned == false) { + float tquat[4]; + rotation_between_quats_to_quat(tquat, rv3d->viewquat, cursor_quat); + is_aligned = tquat[0] - eps < -1.0f; + } rv3d->viewquat[0] = -rv3d->viewquat[0]; /* Draw lines */ @@ -241,7 +252,7 @@ void DRW_draw_cursor(void) for (int axis = 0; axis < 3; axis++) { float axis_vec[3] = {0}; axis_vec[axis] = scale; - mul_qt_v3(cursor->rotation, axis_vec); + mul_qt_v3(cursor_quat, axis_vec); CURSOR_EDGE(axis_vec, axis, +); CURSOR_EDGE(axis_vec, axis, -); } |