Fix T44249: Cursor depth offset
This commit is contained in:
parent
434087981a
commit
986972701e
Notes:
blender-bot
2023-02-14 09:17:51 +01:00
Referenced by issue #44249, Cursor picking offset
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in New Issue