From eb0f8317e231c4a02940d0269125a96a47e94c7e Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 1 Mar 2022 10:56:28 +1100 Subject: 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. --- source/blender/editors/gizmo_library/gizmo_types/move3d_gizmo.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source/blender/editors/gizmo_library') diff --git a/source/blender/editors/gizmo_library/gizmo_types/move3d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/move3d_gizmo.c index aea6d41202e..447fe1005a1 100644 --- a/source/blender/editors/gizmo_library/gizmo_types/move3d_gizmo.c +++ b/source/blender/editors/gizmo_library/gizmo_types/move3d_gizmo.c @@ -147,7 +147,7 @@ static void move3d_get_translate(const wmGizmo *gz, float co_delta[3]) { MoveInteraction *inter = gz->interaction_data; - const float mval_delta[2] = { + const float xy_delta[2] = { event->mval[0] - inter->init.mval[0], event->mval[1] - inter->init.mval[1], }; @@ -155,9 +155,9 @@ static void move3d_get_translate(const wmGizmo *gz, RegionView3D *rv3d = region->regiondata; float co_ref[3]; mul_v3_mat3_m4v3(co_ref, gz->matrix_space, inter->init.prop_co); - const float zfac = ED_view3d_calc_zfac(rv3d, co_ref, NULL); + const float zfac = ED_view3d_calc_zfac(rv3d, co_ref); - ED_view3d_win_to_delta(region, mval_delta, co_delta, zfac); + ED_view3d_win_to_delta(region, xy_delta, zfac, co_delta); float matrix_space_inv[3][3]; copy_m3_m4(matrix_space_inv, gz->matrix_space); -- cgit v1.2.3