diff options
author | Julian Eisel <julian@blender.org> | 2020-03-06 18:56:42 +0300 |
---|---|---|
committer | Julian Eisel <julian@blender.org> | 2020-03-06 19:19:23 +0300 |
commit | b2ee1770d4c31078518f4ec9edd5196a41345162 (patch) | |
tree | 6b7f6ff9057322245fc3b3407bece3f1c0cb3eb5 /source/blender/editors/gizmo_library | |
parent | b825a95ec311a169d33fe21e28418f11a516c82f (diff) |
Cleanup: Rename ARegion variables from ar to region
The old convention was easy to confuse with ScrArea.
Part of https://developer.blender.org/T74432.
This is mostly a batch rename with some manual fixing. Only single word
variable names are changed, no prefixed/suffixed names.
Brecht van Lommel and Campbell Barton both gave me a green light for
this convention change.
Also ran clan clang format on affected files.
Diffstat (limited to 'source/blender/editors/gizmo_library')
5 files changed, 29 insertions, 28 deletions
diff --git a/source/blender/editors/gizmo_library/gizmo_library_utils.c b/source/blender/editors/gizmo_library/gizmo_library_utils.c index 1f61c45eb80..1964a2ff1a3 100644 --- a/source/blender/editors/gizmo_library/gizmo_library_utils.c +++ b/source/blender/editors/gizmo_library/gizmo_library_utils.c @@ -196,12 +196,12 @@ bool gizmo_window_project_2d(bContext *C, /* rotate mouse in relation to the center and relocate it */ if (gz->parent_gzgroup->type->flag & WM_GIZMOGROUPTYPE_3D) { /* For 3d views, transform 2D mouse pos onto plane. */ - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); float plane[4], co[3]; plane_from_point_normal_v3(plane, mat[3], mat[2]); - bool clip_ray = ((RegionView3D *)ar->regiondata)->is_persp; - if (ED_view3d_win_to_3d_on_plane(ar, plane, mval, clip_ray, co)) { + bool clip_ray = ((RegionView3D *)region->regiondata)->is_persp; + if (ED_view3d_win_to_3d_on_plane(region, plane, mval, clip_ray, co)) { float imat[4][4]; invert_m4_m4(imat, mat); mul_m4_v3(imat, co); @@ -237,10 +237,10 @@ bool gizmo_window_project_3d( if (gz->parent_gzgroup->type->flag & WM_GIZMOGROUPTYPE_3D) { View3D *v3d = CTX_wm_view3d(C); - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); /* Note: we might want a custom reference point passed in, * instead of the gizmo center. */ - ED_view3d_win_to_3d(v3d, ar, mat[3], mval, r_co); + ED_view3d_win_to_3d(v3d, region, mat[3], mval, r_co); invert_m4(mat); mul_m4_v3(mat, r_co); return true; diff --git a/source/blender/editors/gizmo_library/gizmo_types/arrow3d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/arrow3d_gizmo.c index 99ac683747f..5a256c24c59 100644 --- a/source/blender/editors/gizmo_library/gizmo_types/arrow3d_gizmo.c +++ b/source/blender/editors/gizmo_library/gizmo_types/arrow3d_gizmo.c @@ -274,8 +274,8 @@ static int gizmo_arrow_modal(bContext *C, } ArrowGizmo3D *arrow = (ArrowGizmo3D *)gz; GizmoInteraction *inter = gz->interaction_data; - ARegion *ar = CTX_wm_region(C); - RegionView3D *rv3d = ar->regiondata; + ARegion *region = CTX_wm_region(C); + RegionView3D *rv3d = region->regiondata; float offset[3]; float facdir = 1.0f; @@ -298,7 +298,7 @@ static int gizmo_arrow_modal(bContext *C, int ok = 0; for (int j = 0; j < 2; j++) { - ED_view3d_win_to_ray(ar, proj[j].mval, proj[j].ray_origin, proj[j].ray_direction); + ED_view3d_win_to_ray(region, proj[j].mval, proj[j].ray_origin, proj[j].ray_direction); /* Force Y axis if we're view aligned */ if (j == 0) { if (RAD2DEGF(acosf(dot_v3v3(proj[j].ray_direction, arrow->gizmo.matrix_basis[2]))) < 5.0f) { @@ -353,7 +353,7 @@ static int gizmo_arrow_modal(bContext *C, } /* tag the region for redraw */ - ED_region_tag_redraw_editor_overlays(ar); + ED_region_tag_redraw_editor_overlays(region); WM_event_add_mousemove(CTX_wm_window(C)); return OPERATOR_RUNNING_MODAL; diff --git a/source/blender/editors/gizmo_library/gizmo_types/cage3d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/cage3d_gizmo.c index 6f424252b91..cc69ad8f671 100644 --- a/source/blender/editors/gizmo_library/gizmo_types/cage3d_gizmo.c +++ b/source/blender/editors/gizmo_library/gizmo_types/cage3d_gizmo.c @@ -402,15 +402,15 @@ static void gizmo_cage3d_draw_intern( */ static void gizmo_cage3d_draw_select(const bContext *C, wmGizmo *gz, int select_id) { - ARegion *ar = CTX_wm_region(C); - RegionView3D *rv3d = ar->regiondata; + ARegion *region = CTX_wm_region(C); + RegionView3D *rv3d = region->regiondata; gizmo_cage3d_draw_intern(rv3d, gz, true, false, select_id); } static void gizmo_cage3d_draw(const bContext *C, wmGizmo *gz) { - ARegion *ar = CTX_wm_region(C); - RegionView3D *rv3d = ar->regiondata; + ARegion *region = CTX_wm_region(C); + RegionView3D *rv3d = region->regiondata; const bool is_highlight = (gz->state & WM_GIZMO_STATE_HIGHLIGHT) != 0; gizmo_cage3d_draw_intern(rv3d, gz, false, is_highlight, -1); } diff --git a/source/blender/editors/gizmo_library/gizmo_types/dial3d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/dial3d_gizmo.c index 6dc81e26bf1..0a2f0738a01 100644 --- a/source/blender/editors/gizmo_library/gizmo_types/dial3d_gizmo.c +++ b/source/blender/editors/gizmo_library/gizmo_types/dial3d_gizmo.c @@ -287,15 +287,15 @@ static void dial_ghostarc_draw(const float angle_ofs, static void dial_ghostarc_get_angles(const wmGizmo *gz, const wmEvent *event, - const ARegion *ar, + const ARegion *region, const float mat[4][4], const float co_outer[3], float *r_start, float *r_delta) { DialInteraction *inter = gz->interaction_data; - const RegionView3D *rv3d = ar->regiondata; - const float mval[2] = {event->x - ar->winrct.xmin, event->y - ar->winrct.ymin}; + const RegionView3D *rv3d = region->regiondata; + const float mval[2] = {event->x - region->winrct.xmin, event->y - region->winrct.ymin}; /* We might need to invert the direction of the angles. */ float view_vec[3], axis_vec[3]; @@ -312,12 +312,13 @@ static void dial_ghostarc_get_angles(const wmGizmo *gz, plane_from_point_normal_v3(dial_plane, gz->matrix_basis[3], axis_vec); - if (!ED_view3d_win_to_3d_on_plane(ar, dial_plane, inter->init.mval, false, proj_mval_init_rel)) { + if (!ED_view3d_win_to_3d_on_plane( + region, dial_plane, inter->init.mval, false, proj_mval_init_rel)) { goto fail; } sub_v3_v3(proj_mval_init_rel, gz->matrix_basis[3]); - if (!ED_view3d_win_to_3d_on_plane(ar, dial_plane, mval, false, proj_mval_new_rel)) { + if (!ED_view3d_win_to_3d_on_plane(region, dial_plane, mval, false, proj_mval_new_rel)) { goto fail; } sub_v3_v3(proj_mval_new_rel, gz->matrix_basis[3]); @@ -440,8 +441,8 @@ static void gizmo_dial_draw_select(const bContext *C, wmGizmo *gz, int select_id float *clip_plane = (draw_options & ED_GIZMO_DIAL_DRAW_FLAG_CLIP) ? clip_plane_buf : NULL; if (clip_plane) { - ARegion *ar = CTX_wm_region(C); - RegionView3D *rv3d = ar->regiondata; + ARegion *region = CTX_wm_region(C); + RegionView3D *rv3d = region->regiondata; copy_v3_v3(clip_plane, rv3d->viewinv[2]); clip_plane[3] = -dot_v3v3(rv3d->viewinv[2], gz->matrix_basis[3]); @@ -467,8 +468,8 @@ static void gizmo_dial_draw(const bContext *C, wmGizmo *gz) NULL; if (clip_plane) { - ARegion *ar = CTX_wm_region(C); - RegionView3D *rv3d = ar->regiondata; + ARegion *region = CTX_wm_region(C); + RegionView3D *rv3d = region->regiondata; copy_v3_v3(clip_plane, rv3d->viewinv[2]); clip_plane[3] = -dot_v3v3(rv3d->viewinv[2], gz->matrix_basis[3]); 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 e7264d2c9bd..f7b51a7a0cb 100644 --- a/source/blender/editors/gizmo_library/gizmo_types/move3d_gizmo.c +++ b/source/blender/editors/gizmo_library/gizmo_types/move3d_gizmo.c @@ -148,7 +148,7 @@ static void move_geom_draw(const wmGizmo *gz, static void move3d_get_translate(const wmGizmo *gz, const wmEvent *event, - const ARegion *ar, + const ARegion *region, float co_delta[3]) { MoveInteraction *inter = gz->interaction_data; @@ -157,12 +157,12 @@ static void move3d_get_translate(const wmGizmo *gz, event->mval[1] - inter->init.mval[1], }; - RegionView3D *rv3d = ar->regiondata; + 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); - ED_view3d_win_to_delta(ar, mval_delta, co_delta, zfac); + ED_view3d_win_to_delta(region, mval_delta, co_delta, zfac); float matrix_space_inv[3][3]; copy_m3_m4(matrix_space_inv, gz->matrix_space); @@ -246,11 +246,11 @@ static int gizmo_move_modal(bContext *C, return OPERATOR_RUNNING_MODAL; } MoveGizmo3D *move = (MoveGizmo3D *)gz; - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); float prop_delta[3]; if (CTX_wm_area(C)->spacetype == SPACE_VIEW3D) { - move3d_get_translate(gz, event, ar, prop_delta); + move3d_get_translate(gz, event, region, prop_delta); } else { float mval_proj_init[2], mval_proj_curr[2]; @@ -303,7 +303,7 @@ static int gizmo_move_modal(bContext *C, zero_v3(move->prop_co); } - ED_region_tag_redraw_editor_overlays(ar); + ED_region_tag_redraw_editor_overlays(region); inter->prev.tweak_flag = tweak_flag; |