diff options
author | Campbell Barton <campbell@blender.org> | 2022-03-01 02:56:28 +0300 |
---|---|---|
committer | Campbell Barton <campbell@blender.org> | 2022-03-01 03:18:17 +0300 |
commit | eb0f8317e231c4a02940d0269125a96a47e94c7e (patch) | |
tree | 03c67854c72c5a4507f22f8c2321c14b2629fccd /source/blender/editors/space_view3d/view3d_navigate_zoom_border.c | |
parent | ae6400cfb4cae798667eab903d9c463fdec31298 (diff) |
Cleanup: ED_view3d_win_to_delta & ED_view3d_calc_zfac usage
- Rename ED_view3d_win_to_delta `mval` argument to `xy_delta` as it
as it was misleading since this is an screen-space offset not a region
relative cursor position (typical use of the name `mval`).
Also rename the variable passed to this function which also used the
term `mval` in many places.
- Re-order the output argument of ED_view3d_win_to_delta last.
use an r_ prefix for return arguments.
- Document how the `zfac` argument is intended to be used.
- Split ED_view3d_calc_zfac into two functions as the `r_flip` argument
was only used in some special cases.
Diffstat (limited to 'source/blender/editors/space_view3d/view3d_navigate_zoom_border.c')
-rw-r--r-- | source/blender/editors/space_view3d/view3d_navigate_zoom_border.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/source/blender/editors/space_view3d/view3d_navigate_zoom_border.c b/source/blender/editors/space_view3d/view3d_navigate_zoom_border.c index 4e909151ce4..f834efe4a7b 100644 --- a/source/blender/editors/space_view3d/view3d_navigate_zoom_border.c +++ b/source/blender/editors/space_view3d/view3d_navigate_zoom_border.c @@ -125,7 +125,7 @@ static int view3d_zoom_border_exec(bContext *C, wmOperator *op) negate_v3_v3(new_ofs, p); } else { - float mval_f[2]; + float xy_delta[2]; float zfac; /* We can't use the depth, fallback to the old way that doesn't set the center depth */ @@ -134,12 +134,12 @@ static int view3d_zoom_border_exec(bContext *C, wmOperator *op) { float tvec[3]; negate_v3_v3(tvec, new_ofs); - zfac = ED_view3d_calc_zfac(rv3d, tvec, NULL); + zfac = ED_view3d_calc_zfac(rv3d, tvec); } - mval_f[0] = (rect.xmin + rect.xmax - vb[0]) / 2.0f; - mval_f[1] = (rect.ymin + rect.ymax - vb[1]) / 2.0f; - ED_view3d_win_to_delta(region, mval_f, dvec, zfac); + xy_delta[0] = (rect.xmin + rect.xmax - vb[0]) / 2.0f; + xy_delta[1] = (rect.ymin + rect.ymax - vb[1]) / 2.0f; + ED_view3d_win_to_delta(region, xy_delta, zfac, dvec); /* center the view to the center of the rectangle */ sub_v3_v3(new_ofs, dvec); } |