From b2ee1770d4c31078518f4ec9edd5196a41345162 Mon Sep 17 00:00:00 2001 From: Julian Eisel Date: Fri, 6 Mar 2020 16:56:42 +0100 Subject: 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. --- source/blender/editors/uvedit/uvedit_draw.c | 4 +-- source/blender/editors/uvedit/uvedit_ops.c | 35 +++++++++++----------- .../blender/editors/uvedit/uvedit_smart_stitch.c | 13 ++++---- source/blender/editors/uvedit/uvedit_unwrap_ops.c | 5 ++-- 4 files changed, 30 insertions(+), 27 deletions(-) (limited to 'source/blender/editors/uvedit') diff --git a/source/blender/editors/uvedit/uvedit_draw.c b/source/blender/editors/uvedit/uvedit_draw.c index 528fca85fa7..d9345808d28 100644 --- a/source/blender/editors/uvedit/uvedit_draw.c +++ b/source/blender/editors/uvedit/uvedit_draw.c @@ -99,11 +99,11 @@ static int draw_uvs_face_check(const ToolSettings *ts) /* ------------------------- */ -void ED_image_draw_cursor(ARegion *ar, const float cursor[2]) +void ED_image_draw_cursor(ARegion *region, const float cursor[2]) { float zoom[2], x_fac, y_fac; - UI_view2d_scale_get_inverse(&ar->v2d, &zoom[0], &zoom[1]); + UI_view2d_scale_get_inverse(®ion->v2d, &zoom[0], &zoom[1]); mul_v2_fl(zoom, 256.0f * UI_DPI_FAC); x_fac = zoom[0]; diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c index ffa142dfcf3..7172db788f1 100644 --- a/source/blender/editors/uvedit/uvedit_ops.c +++ b/source/blender/editors/uvedit/uvedit_ops.c @@ -2836,10 +2836,10 @@ static int uv_select_exec(bContext *C, wmOperator *op) static int uv_select_invoke(bContext *C, wmOperator *op, const wmEvent *event) { - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); float co[2]; - UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &co[0], &co[1]); + UI_view2d_region_to_view(®ion->v2d, event->mval[0], event->mval[1], &co[0], &co[1]); RNA_float_set_array(op->ptr, "location", co); return uv_select_exec(C, op); @@ -2905,10 +2905,10 @@ static int uv_select_loop_exec(bContext *C, wmOperator *op) static int uv_select_loop_invoke(bContext *C, wmOperator *op, const wmEvent *event) { - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); float co[2]; - UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &co[0], &co[1]); + UI_view2d_region_to_view(®ion->v2d, event->mval[0], event->mval[1], &co[0], &co[1]); RNA_float_set_array(op->ptr, "location", co); return uv_select_loop_exec(C, op); @@ -2988,9 +2988,9 @@ static int uv_select_linked_internal(bContext *C, wmOperator *op, const wmEvent if (event) { /* invoke */ - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); - UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &co[0], &co[1]); + UI_view2d_region_to_view(®ion->v2d, event->mval[0], event->mval[1], &co[0], &co[1]); RNA_float_set_array(op->ptr, "location", co); } else { @@ -3497,7 +3497,7 @@ static int uv_box_select_exec(bContext *C, wmOperator *op) const ToolSettings *ts = scene->toolsettings; ViewLayer *view_layer = CTX_data_view_layer(C); Image *ima = CTX_data_edit_image(C); - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); BMFace *efa; BMLoop *l; BMIter iter, liter; @@ -3510,7 +3510,7 @@ static int uv_box_select_exec(bContext *C, wmOperator *op) /* get rectangle from operator */ WM_operator_properties_border_to_rctf(op, &rectf); - UI_view2d_region_to_view_rctf(&ar->v2d, &rectf, &rectf); + UI_view2d_region_to_view_rctf(®ion->v2d, &rectf, &rectf); const eSelectOp sel_op = RNA_enum_get(op->ptr, "mode"); const bool select = (sel_op != SEL_OP_SUB); @@ -3654,7 +3654,7 @@ static int uv_circle_select_exec(bContext *C, wmOperator *op) Scene *scene = CTX_data_scene(C); ViewLayer *view_layer = CTX_data_view_layer(C); const ToolSettings *ts = scene->toolsettings; - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); BMFace *efa; BMLoop *l; BMIter iter, liter; @@ -3674,12 +3674,12 @@ static int uv_circle_select_exec(bContext *C, wmOperator *op) /* compute ellipse size and location, not a circle since we deal * with non square image. ellipse is normalized, r = 1.0. */ ED_space_image_get_size(sima, &width, &height); - ED_space_image_get_zoom(sima, ar, &zoomx, &zoomy); + ED_space_image_get_zoom(sima, region, &zoomx, &zoomy); ellipse[0] = width * zoomx / radius; ellipse[1] = height * zoomy / radius; - UI_view2d_region_to_view(&ar->v2d, x, y, &offset[0], &offset[1]); + UI_view2d_region_to_view(®ion->v2d, x, y, &offset[0], &offset[1]); bool changed_multi = false; @@ -3791,7 +3791,7 @@ static bool do_lasso_select_mesh_uv(bContext *C, Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); SpaceImage *sima = CTX_wm_space_image(C); Image *ima = CTX_data_edit_image(C); - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); Scene *scene = CTX_data_scene(C); const ToolSettings *ts = scene->toolsettings; ViewLayer *view_layer = CTX_data_view_layer(C); @@ -3838,7 +3838,7 @@ static bool do_lasso_select_mesh_uv(bContext *C, uv_poly_center(efa, cent, cd_loop_uv_offset); if (UI_view2d_view_to_region_clip( - &ar->v2d, cent[0], cent[1], &screen_uv[0], &screen_uv[1]) && + ®ion->v2d, cent[0], cent[1], &screen_uv[0], &screen_uv[1]) && BLI_rcti_isect_pt_v(&rect, screen_uv) && BLI_lasso_is_point_inside( mcords, moves, screen_uv[0], screen_uv[1], V2D_IS_CLIPPED)) { @@ -3862,7 +3862,7 @@ static bool do_lasso_select_mesh_uv(bContext *C, if ((select) != (uvedit_uv_select_test(scene, l, cd_loop_uv_offset))) { MLoopUV *luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset); if (UI_view2d_view_to_region_clip( - &ar->v2d, luv->uv[0], luv->uv[1], &screen_uv[0], &screen_uv[1]) && + ®ion->v2d, luv->uv[0], luv->uv[1], &screen_uv[0], &screen_uv[1]) && BLI_rcti_isect_pt_v(&rect, screen_uv) && BLI_lasso_is_point_inside( mcords, moves, screen_uv[0], screen_uv[1], V2D_IS_CLIPPED)) { @@ -4954,10 +4954,10 @@ static int uv_set_2d_cursor_exec(bContext *C, wmOperator *op) static int uv_set_2d_cursor_invoke(bContext *C, wmOperator *op, const wmEvent *event) { - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); float location[2]; - if (ar->regiontype == RGN_TYPE_WINDOW) { + if (region->regiontype == RGN_TYPE_WINDOW) { if (event->mval[1] <= 16) { SpaceImage *sima = CTX_wm_space_image(C); if (sima && ED_space_image_show_cache(sima)) { @@ -4966,7 +4966,8 @@ static int uv_set_2d_cursor_invoke(bContext *C, wmOperator *op, const wmEvent *e } } - UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &location[0], &location[1]); + UI_view2d_region_to_view( + ®ion->v2d, event->mval[0], event->mval[1], &location[0], &location[1]); RNA_float_set_array(op->ptr, "location", location); return uv_set_2d_cursor_exec(C, op); diff --git a/source/blender/editors/uvedit/uvedit_smart_stitch.c b/source/blender/editors/uvedit/uvedit_smart_stitch.c index 5d3d016e6c1..5544c5cee63 100644 --- a/source/blender/editors/uvedit/uvedit_smart_stitch.c +++ b/source/blender/editors/uvedit/uvedit_smart_stitch.c @@ -1753,7 +1753,7 @@ static void stitch_draw_vbo(GPUVertBuf *vbo, GPUPrimType prim_type, const float } /* TODO make things pretier : store batches inside StitchPreviewer instead of the bare verts pos */ -static void stitch_draw(const bContext *UNUSED(C), ARegion *UNUSED(ar), void *arg) +static void stitch_draw(const bContext *UNUSED(C), ARegion *UNUSED(region), void *arg) { StitchStateContainer *ssc = (StitchStateContainer *)arg; @@ -2254,8 +2254,8 @@ static bool goto_next_island(StitchStateContainer *ssc) static int stitch_init_all(bContext *C, wmOperator *op) { - ARegion *ar = CTX_wm_region(C); - if (!ar) { + ARegion *region = CTX_wm_region(C); + if (!region) { return 0; } @@ -2399,7 +2399,8 @@ static int stitch_init_all(bContext *C, wmOperator *op) stitch_update_header(ssc, C); - ssc->draw_handle = ED_region_draw_cb_activate(ar->type, stitch_draw, ssc, REGION_DRAW_POST_VIEW); + ssc->draw_handle = ED_region_draw_cb_activate( + region->type, stitch_draw, ssc, REGION_DRAW_POST_VIEW); return 1; } @@ -2548,10 +2549,10 @@ static StitchState *stitch_select(bContext *C, /* add uv under mouse to processed uv's */ float co[2]; UvNearestHit hit = UV_NEAREST_HIT_INIT; - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); Image *ima = CTX_data_edit_image(C); - UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &co[0], &co[1]); + UI_view2d_region_to_view(®ion->v2d, event->mval[0], event->mval[1], &co[0], &co[1]); if (ssc->mode == STITCH_VERT) { if (uv_find_nearest_vert_multi(scene, ima, ssc->objects, ssc->objects_len, co, 0.0f, &hit)) { diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c b/source/blender/editors/uvedit/uvedit_unwrap_ops.c index fb48b1377f1..a198ebb6f20 100644 --- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c +++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c @@ -1809,7 +1809,7 @@ static int uv_from_view_exec(bContext *C, wmOperator *op) { ViewLayer *view_layer = CTX_data_view_layer(C); const Scene *scene = CTX_data_scene(C); - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); View3D *v3d = CTX_wm_view3d(C); RegionView3D *rv3d = CTX_wm_region_view3d(C); Camera *camera = ED_view3d_camera_data_get(v3d, rv3d); @@ -1901,7 +1901,8 @@ static int uv_from_view_exec(bContext *C, wmOperator *op) BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) { luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset); - BLI_uvproject_from_view(luv->uv, l->v->co, rv3d->persmat, rotmat, ar->winx, ar->winy); + BLI_uvproject_from_view( + luv->uv, l->v->co, rv3d->persmat, rotmat, region->winx, region->winy); } changed = true; } -- cgit v1.2.3