diff options
author | Germano Cavalcante <germano.costa@ig.com.br> | 2021-04-05 16:48:28 +0300 |
---|---|---|
committer | Germano Cavalcante <germano.costa@ig.com.br> | 2021-04-05 16:48:37 +0300 |
commit | 44c76e4ce31052501706d9d10850f3d41a5b3fcc (patch) | |
tree | 76334c81e044c0604aee836ad99b2552b91f14a1 /source/blender/editors/object/object_transform.c | |
parent | 50782df42586a5a038cad11530714371edaa5cd4 (diff) |
3D View Utils: Add 'margin' parameter to 'ED_view3d_depth_read_cached'
Matches the alternative function ED_view3d_autodist_depth, but is more
efficient since it uses the cache.
No functional changes.
Diffstat (limited to 'source/blender/editors/object/object_transform.c')
-rw-r--r-- | source/blender/editors/object/object_transform.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/source/blender/editors/object/object_transform.c b/source/blender/editors/object/object_transform.c index 1d7cf61bc3a..a87b5054efa 100644 --- a/source/blender/editors/object/object_transform.c +++ b/source/blender/editors/object/object_transform.c @@ -1865,28 +1865,30 @@ static int object_transform_axis_target_modal(bContext *C, wmOperator *op, const if (event->type == MOUSEMOVE || is_translate_init) { const ViewDepths *depths = xfd->vc.rv3d->depths; if (depths && ((uint)event->mval[0] < depths->w) && ((uint)event->mval[1] < depths->h)) { - double depth = (double)ED_view3d_depth_read_cached(&xfd->vc, event->mval); + float depth_fl = 1.0f; + ED_view3d_depth_read_cached(depths, event->mval, 0, &depth_fl); float location_world[3]; - if (depth == 1.0f) { + if (depth_fl == 1.0f) { if (xfd->prev.is_depth_valid) { - depth = (double)xfd->prev.depth; + depth_fl = xfd->prev.depth; } } #ifdef USE_FAKE_DEPTH_INIT /* First time only. */ - if (depth == 1.0f) { + if (depth_fl == 1.0f) { if (xfd->prev.is_depth_valid == false) { object_transform_axis_target_calc_depth_init(xfd, event->mval); if (xfd->prev.is_depth_valid) { - depth = (double)xfd->prev.depth; + depth_fl = xfd->prev.depth; } } } #endif + double depth = (double)depth_fl; if ((depth > depths->depth_range[0]) && (depth < depths->depth_range[1])) { - xfd->prev.depth = depth; + xfd->prev.depth = depth_fl; xfd->prev.is_depth_valid = true; if (ED_view3d_depth_unproject(region, event->mval, depth, location_world)) { if (is_translate) { |