diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-04-06 07:57:43 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-04-06 08:00:07 +0300 |
commit | 986972701ea01667c97fe0831ac90a27ef15d881 (patch) | |
tree | 9775844e8354884a0b990bb3fca575a3d7e43afd /source/blender/editors/space_view3d | |
parent | 434087981aa26212b3b3b30f838f4ef87994b8df (diff) |
Fix T44249: Cursor depth offset
Diffstat (limited to 'source/blender/editors/space_view3d')
-rw-r--r-- | source/blender/editors/space_view3d/view3d_edit.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index 706cb517683..236fefc7088 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -4701,14 +4701,22 @@ bool ED_view3d_autodist(Scene *scene, ARegion *ar, View3D *v3d, bglMats mats; /* ZBuffer depth vars */ float depth_close; double cent[2], p[3]; + int margin_arr[] = {0, 2, 4}; + int i; + bool depth_ok = false; /* Get Z Depths, needed for perspective, nice for ortho */ bgl_get_mats(&mats); ED_view3d_draw_depth(scene, ar, v3d, alphaoverride); - depth_close = view_autodist_depth_margin(ar, mval, 4); + /* Attempt with low margin's first */ + i = 0; + do { + depth_close = view_autodist_depth_margin(ar, mval, margin_arr[i++] * U.pixelsize); + depth_ok = (depth_close != FLT_MAX); + } while ((depth_ok == false) && (i < ARRAY_SIZE(margin_arr))); - if (depth_close != FLT_MAX) { + if (depth_ok) { cent[0] = (double)mval[0] + 0.5; cent[1] = (double)mval[1] + 0.5; |