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/transform | |
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/transform')
21 files changed, 188 insertions, 188 deletions
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index 37cfa846657..d8700a3dba4 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -71,7 +71,7 @@ * and being able to set it to zero is handy. */ // #define USE_NUM_NO_ZERO -static void drawTransformApply(const struct bContext *C, ARegion *ar, void *arg); +static void drawTransformApply(const struct bContext *C, ARegion *region, void *arg); static void initSnapSpatial(TransInfo *t, float r_snap[3]); @@ -84,8 +84,8 @@ bool transdata_check_local_islands(TransInfo *t, short around) void setTransformViewMatrices(TransInfo *t) { - if (t->spacetype == SPACE_VIEW3D && t->ar && t->ar->regiontype == RGN_TYPE_WINDOW) { - RegionView3D *rv3d = t->ar->regiondata; + if (t->spacetype == SPACE_VIEW3D && t->region && t->region->regiontype == RGN_TYPE_WINDOW) { + RegionView3D *rv3d = t->region->regiondata; copy_m4_m4(t->viewmat, rv3d->viewmat); copy_m4_m4(t->viewinv, rv3d->viewinv); @@ -174,14 +174,14 @@ static void convertViewVec2D_mask(View2D *v2d, float r_vec[3], int dx, int dy) void convertViewVec(TransInfo *t, float r_vec[3], double dx, double dy) { - if ((t->spacetype == SPACE_VIEW3D) && (t->ar->regiontype == RGN_TYPE_WINDOW)) { + if ((t->spacetype == SPACE_VIEW3D) && (t->region->regiontype == RGN_TYPE_WINDOW)) { if (t->options & CTX_PAINT_CURVE) { r_vec[0] = dx; r_vec[1] = dy; } else { const float mval_f[2] = {(float)dx, (float)dy}; - ED_view3d_win_to_delta(t->ar, mval_f, r_vec, t->zfac); + ED_view3d_win_to_delta(t->region, mval_f, r_vec, t->zfac); } } else if (t->spacetype == SPACE_IMAGE) { @@ -203,7 +203,7 @@ void convertViewVec(TransInfo *t, float r_vec[3], double dx, double dy) convertViewVec2D(t->view, r_vec, dx, dy); } else if (ELEM(t->spacetype, SPACE_NODE, SPACE_SEQ)) { - convertViewVec2D(&t->ar->v2d, r_vec, dx, dy); + convertViewVec2D(&t->region->v2d, r_vec, dx, dy); } else if (t->spacetype == SPACE_CLIP) { if (t->options & CTX_MASK) { @@ -225,8 +225,8 @@ void convertViewVec(TransInfo *t, float r_vec[3], double dx, double dy) void projectIntViewEx(TransInfo *t, const float vec[3], int adr[2], const eV3DProjTest flag) { if (t->spacetype == SPACE_VIEW3D) { - if (t->ar->regiontype == RGN_TYPE_WINDOW) { - if (ED_view3d_project_int_global(t->ar, vec, adr, flag) != V3D_PROJ_RET_OK) { + if (t->region->regiontype == RGN_TYPE_WINDOW) { + if (ED_view3d_project_int_global(t->region, vec, adr, flag) != V3D_PROJ_RET_OK) { /* this is what was done in 2.64, perhaps we can be smarter? */ adr[0] = (int)2140000000.0f; adr[1] = (int)2140000000.0f; @@ -244,7 +244,7 @@ void projectIntViewEx(TransInfo *t, const float vec[3], int adr[2], const eV3DPr BKE_mask_coord_to_image(sima->image, &sima->iuser, v, v); - ED_image_point_pos__reverse(sima, t->ar, v, v); + ED_image_point_pos__reverse(sima, t->region, v, v); adr[0] = v[0]; adr[1] = v[1]; @@ -309,7 +309,7 @@ void projectIntViewEx(TransInfo *t, const float vec[3], int adr[2], const eV3DPr BKE_mask_coord_to_movieclip(sc->clip, &sc->user, v, v); - ED_clip_point_stable_pos__reverse(sc, t->ar, v, v); + ED_clip_point_stable_pos__reverse(sc, t->region, v, v); adr[0] = v[0]; adr[1] = v[1]; @@ -348,12 +348,12 @@ void projectFloatViewEx(TransInfo *t, const float vec[3], float adr[2], const eV adr[0] = vec[0]; adr[1] = vec[1]; } - else if (t->ar->regiontype == RGN_TYPE_WINDOW) { + else if (t->region->regiontype == RGN_TYPE_WINDOW) { /* allow points behind the view [#33643] */ - if (ED_view3d_project_float_global(t->ar, vec, adr, flag) != V3D_PROJ_RET_OK) { + if (ED_view3d_project_float_global(t->region, vec, adr, flag) != V3D_PROJ_RET_OK) { /* XXX, 2.64 and prior did this, weak! */ - adr[0] = t->ar->winx / 2.0f; - adr[1] = t->ar->winy / 2.0f; + adr[0] = t->region->winx / 2.0f; + adr[1] = t->region->winy / 2.0f; } return; } @@ -434,7 +434,7 @@ static void viewRedrawForce(const bContext *C, TransInfo *t) else if (t->spacetype == SPACE_VIEW3D) { if (t->options & CTX_PAINT_CURVE) { wmWindow *window = CTX_wm_window(C); - WM_paint_cursor_tag_redraw(window, t->ar); + WM_paint_cursor_tag_redraw(window, t->region); } else { /* Do we need more refined tags? */ @@ -480,7 +480,7 @@ static void viewRedrawForce(const bContext *C, TransInfo *t) } else if (t->options & CTX_PAINT_CURVE) { wmWindow *window = CTX_wm_window(C); - WM_paint_cursor_tag_redraw(window, t->ar); + WM_paint_cursor_tag_redraw(window, t->region); } else if (t->flag & T_CURSOR) { ED_area_tag_redraw(t->sa); @@ -1513,11 +1513,11 @@ bool calculateTransformCenter(bContext *C, int centerMode, float cent3d[3], floa return success; } -static bool transinfo_show_overlay(const struct bContext *C, TransInfo *t, ARegion *ar) +static bool transinfo_show_overlay(const struct bContext *C, TransInfo *t, ARegion *region) { /* Don't show overlays when not the active view and when overlay is disabled: T57139 */ bool ok = false; - if (ar == t->ar) { + if (region == t->region) { ok = true; } else { @@ -1532,11 +1532,11 @@ static bool transinfo_show_overlay(const struct bContext *C, TransInfo *t, ARegi return ok; } -static void drawTransformView(const struct bContext *C, ARegion *ar, void *arg) +static void drawTransformView(const struct bContext *C, ARegion *region, void *arg) { TransInfo *t = arg; - if (!transinfo_show_overlay(C, t, ar)) { + if (!transinfo_show_overlay(C, t, region)) { return; } @@ -1546,7 +1546,7 @@ static void drawTransformView(const struct bContext *C, ARegion *ar, void *arg) drawPropCircle(C, t); drawSnapping(C, t); - if (ar == t->ar) { + if (region == t->region) { /* edge slide, vert slide */ drawEdgeSlide(t); drawVertSlide(t); @@ -1558,13 +1558,13 @@ static void drawTransformView(const struct bContext *C, ARegion *ar, void *arg) /* just draw a little warning message in the top-right corner of the viewport * to warn that autokeying is enabled */ -static void drawAutoKeyWarning(TransInfo *UNUSED(t), ARegion *ar) +static void drawAutoKeyWarning(TransInfo *UNUSED(t), ARegion *region) { const char *printable = IFACE_("Auto Keying On"); float printable_size[2]; int xco, yco; - const rcti *rect = ED_region_visible_rect(ar); + const rcti *rect = ED_region_visible_rect(region); const int font_id = BLF_default(); BLF_width_and_height( @@ -1598,15 +1598,15 @@ static void drawAutoKeyWarning(TransInfo *UNUSED(t), ARegion *ar) GPU_blend(false); } -static void drawTransformPixel(const struct bContext *C, ARegion *ar, void *arg) +static void drawTransformPixel(const struct bContext *C, ARegion *region, void *arg) { TransInfo *t = arg; - if (!transinfo_show_overlay(C, t, ar)) { + if (!transinfo_show_overlay(C, t, region)) { return; } - if (ar == t->ar) { + if (region == t->region) { Scene *scene = t->scene; ViewLayer *view_layer = t->view_layer; Object *ob = OBACT(view_layer); @@ -1617,10 +1617,10 @@ static void drawTransformPixel(const struct bContext *C, ARegion *ar, void *arg) * AND only for the active region (as showing all is too overwhelming) */ if ((U.autokey_flag & AUTOKEY_FLAG_NOWARNING) == 0) { - if (ar == t->ar) { + if (region == t->region) { if (t->flag & (T_OBJECT | T_POSE)) { if (ob && autokeyframe_cfra_can_key(scene, &ob->id)) { - drawAutoKeyWarning(t, ar); + drawAutoKeyWarning(t, region); } } } @@ -1867,7 +1867,7 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op) static void initSnapSpatial(TransInfo *t, float r_snap[3]) { if (t->spacetype == SPACE_VIEW3D) { - RegionView3D *rv3d = t->ar->regiondata; + RegionView3D *rv3d = t->region->regiondata; if (rv3d) { View3D *v3d = t->sa->spacedata.first; @@ -1967,11 +1967,11 @@ bool initTransform(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve if (t->spacetype == SPACE_VIEW3D) { t->draw_handle_apply = ED_region_draw_cb_activate( - t->ar->type, drawTransformApply, t, REGION_DRAW_PRE_VIEW); + t->region->type, drawTransformApply, t, REGION_DRAW_PRE_VIEW); t->draw_handle_view = ED_region_draw_cb_activate( - t->ar->type, drawTransformView, t, REGION_DRAW_POST_VIEW); + t->region->type, drawTransformView, t, REGION_DRAW_POST_VIEW); t->draw_handle_pixel = ED_region_draw_cb_activate( - t->ar->type, drawTransformPixel, t, REGION_DRAW_POST_PIXEL); + t->region->type, drawTransformPixel, t, REGION_DRAW_POST_PIXEL); t->draw_handle_cursor = WM_paint_cursor_activate(CTX_wm_manager(C), SPACE_TYPE_ANY, RGN_TYPE_ANY, @@ -1981,7 +1981,7 @@ bool initTransform(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve } else if (t->spacetype == SPACE_IMAGE) { t->draw_handle_view = ED_region_draw_cb_activate( - t->ar->type, drawTransformView, t, REGION_DRAW_POST_VIEW); + t->region->type, drawTransformView, t, REGION_DRAW_POST_VIEW); t->draw_handle_cursor = WM_paint_cursor_activate(CTX_wm_manager(C), SPACE_TYPE_ANY, RGN_TYPE_ANY, @@ -1991,7 +1991,7 @@ bool initTransform(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve } else if (t->spacetype == SPACE_CLIP) { t->draw_handle_view = ED_region_draw_cb_activate( - t->ar->type, drawTransformView, t, REGION_DRAW_POST_VIEW); + t->region->type, drawTransformView, t, REGION_DRAW_POST_VIEW); t->draw_handle_cursor = WM_paint_cursor_activate(CTX_wm_manager(C), SPACE_TYPE_ANY, RGN_TYPE_ANY, @@ -2001,7 +2001,7 @@ bool initTransform(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve } else if (t->spacetype == SPACE_NODE) { t->draw_handle_view = ED_region_draw_cb_activate( - t->ar->type, drawTransformView, t, REGION_DRAW_POST_VIEW); + t->region->type, drawTransformView, t, REGION_DRAW_POST_VIEW); t->draw_handle_cursor = WM_paint_cursor_activate(CTX_wm_manager(C), SPACE_TYPE_ANY, RGN_TYPE_ANY, @@ -2011,7 +2011,7 @@ bool initTransform(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve } else if (t->spacetype == SPACE_GRAPH) { t->draw_handle_view = ED_region_draw_cb_activate( - t->ar->type, drawTransformView, t, REGION_DRAW_POST_VIEW); + t->region->type, drawTransformView, t, REGION_DRAW_POST_VIEW); t->draw_handle_cursor = WM_paint_cursor_activate(CTX_wm_manager(C), SPACE_TYPE_ANY, RGN_TYPE_ANY, @@ -2021,7 +2021,7 @@ bool initTransform(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve } else if (t->spacetype == SPACE_ACTION) { t->draw_handle_view = ED_region_draw_cb_activate( - t->ar->type, drawTransformView, t, REGION_DRAW_POST_VIEW); + t->region->type, drawTransformView, t, REGION_DRAW_POST_VIEW); t->draw_handle_cursor = WM_paint_cursor_activate(CTX_wm_manager(C), SPACE_TYPE_ANY, RGN_TYPE_ANY, @@ -2250,7 +2250,7 @@ void transformApply(bContext *C, TransInfo *t) t->context = NULL; } -static void drawTransformApply(const bContext *C, ARegion *UNUSED(ar), void *arg) +static void drawTransformApply(const bContext *C, ARegion *UNUSED(region), void *arg) { TransInfo *t = arg; diff --git a/source/blender/editors/transform/transform.h b/source/blender/editors/transform/transform.h index 826e22bbace..2a4268ad939 100644 --- a/source/blender/editors/transform/transform.h +++ b/source/blender/editors/transform/transform.h @@ -582,7 +582,7 @@ typedef struct TransInfo { /** Only valid (non null) during an operator called function. */ struct bContext *context; struct ScrArea *sa; - struct ARegion *ar; + struct ARegion *region; struct Depsgraph *depsgraph; struct Scene *scene; struct ViewLayer *view_layer; diff --git a/source/blender/editors/transform/transform_constraints.c b/source/blender/editors/transform/transform_constraints.c index 5bcc1387a1b..1db2ffa0ed4 100644 --- a/source/blender/editors/transform/transform_constraints.c +++ b/source/blender/editors/transform/transform_constraints.c @@ -846,8 +846,8 @@ void drawPropCircle(const struct bContext *C, TransInfo *t) } else if (ELEM(t->spacetype, SPACE_GRAPH, SPACE_ACTION)) { /* only scale y */ - rcti *mask = &t->ar->v2d.mask; - rctf *datamask = &t->ar->v2d.cur; + rcti *mask = &t->region->v2d.mask; + rctf *datamask = &t->region->v2d.cur; float xsize = BLI_rctf_size_x(datamask); float ysize = BLI_rctf_size_y(datamask); float xmask = BLI_rcti_size_x(mask); @@ -1055,7 +1055,7 @@ static void setNearestAxis3d(TransInfo *t) * projecting them with ED_view3d_win_to_delta and then get the length of that vector. */ zfac = mul_project_m4_v3_zfac(t->persmat, t->center_global); - zfac = len_v3(t->persinv[0]) * 2.0f / t->ar->winx * zfac * 30.0f; + zfac = len_v3(t->persinv[0]) * 2.0f / t->region->winx * zfac * 30.0f; for (i = 0; i < 3; i++) { float axis[3], axis_2d[2]; diff --git a/source/blender/editors/transform/transform_convert.c b/source/blender/editors/transform/transform_convert.c index 55f08d501ec..009164057ce 100644 --- a/source/blender/editors/transform/transform_convert.c +++ b/source/blender/editors/transform/transform_convert.c @@ -206,8 +206,8 @@ static void set_prop_dist(TransInfo *t, const bool with_dist) const bool use_island = transdata_check_local_islands(t, t->around); if (t->flag & T_PROP_PROJECTED) { - if (t->spacetype == SPACE_VIEW3D && t->ar && t->ar->regiontype == RGN_TYPE_WINDOW) { - RegionView3D *rv3d = t->ar->regiondata; + if (t->spacetype == SPACE_VIEW3D && t->region && t->region->regiontype == RGN_TYPE_WINDOW) { + RegionView3D *rv3d = t->region->regiondata; normalize_v3_v3(_proj_vec, rv3d->viewinv[2]); proj_vec = _proj_vec; } @@ -2768,9 +2768,9 @@ void createTransData(bContext *C, TransInfo *t) } /* Check if we're transforming the camera from the camera */ - if ((t->spacetype == SPACE_VIEW3D) && (t->ar->regiontype == RGN_TYPE_WINDOW)) { + if ((t->spacetype == SPACE_VIEW3D) && (t->region->regiontype == RGN_TYPE_WINDOW)) { View3D *v3d = t->view; - RegionView3D *rv3d = t->ar->regiondata; + RegionView3D *rv3d = t->region->regiondata; if ((rv3d->persp == RV3D_CAMOB) && v3d->camera) { /* we could have a flag to easily check an object is being transformed */ if (v3d->camera->id.tag & LIB_TAG_DOIT) { diff --git a/source/blender/editors/transform/transform_convert_action.c b/source/blender/editors/transform/transform_convert_action.c index 42e8523d4cb..f1bc54f12d1 100644 --- a/source/blender/editors/transform/transform_convert_action.c +++ b/source/blender/editors/transform/transform_convert_action.c @@ -297,8 +297,8 @@ void createTransActionData(bContext *C, TransInfo *t) TransData2D *td2d = NULL; tGPFtransdata *tfd = NULL; - rcti *mask = &t->ar->v2d.mask; - rctf *datamask = &t->ar->v2d.cur; + rcti *mask = &t->region->v2d.mask; + rctf *datamask = &t->region->v2d.cur; float xsize = BLI_rctf_size_x(datamask); float ysize = BLI_rctf_size_y(datamask); @@ -313,7 +313,7 @@ void createTransActionData(bContext *C, TransInfo *t) int count = 0; float cfra; - float ypos = 1.0f / ((ysize / xsize) * (xmask / ymask)) * BLI_rctf_cent_y(&t->ar->v2d.cur); + float ypos = 1.0f / ((ysize / xsize) * (xmask / ymask)) * BLI_rctf_cent_y(&t->region->v2d.cur); /* determine what type of data we are operating on */ if (ANIM_animdata_get_context(C, &ac) == 0) { diff --git a/source/blender/editors/transform/transform_convert_graph.c b/source/blender/editors/transform/transform_convert_graph.c index 502679efedf..95a385a5a50 100644 --- a/source/blender/editors/transform/transform_convert_graph.c +++ b/source/blender/editors/transform/transform_convert_graph.c @@ -226,8 +226,8 @@ void createTransGraphEditData(bContext *C, TransInfo *t) { SpaceGraph *sipo = (SpaceGraph *)t->sa->spacedata.first; Scene *scene = t->scene; - ARegion *ar = t->ar; - View2D *v2d = &ar->v2d; + ARegion *region = t->region; + View2D *v2d = ®ion->v2d; TransData *td = NULL; TransData2D *td2d = NULL; diff --git a/source/blender/editors/transform/transform_convert_mask.c b/source/blender/editors/transform/transform_convert_mask.c index 32152442acf..65244a09b73 100644 --- a/source/blender/editors/transform/transform_convert_mask.c +++ b/source/blender/editors/transform/transform_convert_mask.c @@ -333,7 +333,7 @@ void createTransMaskingData(bContext *C, TransInfo *t) return; } - ED_mask_get_aspect(t->sa, t->ar, &asp[0], &asp[1]); + ED_mask_get_aspect(t->sa, t->region, &asp[0], &asp[1]); tc->data_len = (is_prop_edit) ? count : countsel; td = tc->data = MEM_callocN(tc->data_len * sizeof(TransData), "TransObData(Mask Editing)"); @@ -409,7 +409,7 @@ void flushTransMasking(TransInfo *t) TransDataContainer *tc = TRANS_DATA_CONTAINER_FIRST_SINGLE(t); - ED_mask_get_aspect(t->sa, t->ar, &asp[0], &asp[1]); + ED_mask_get_aspect(t->sa, t->region, &asp[0], &asp[1]); inv[0] = 1.0f / asp[0]; inv[1] = 1.0f / asp[1]; diff --git a/source/blender/editors/transform/transform_convert_tracking.c b/source/blender/editors/transform/transform_convert_tracking.c index b68b79adbd8..a8bde661342 100644 --- a/source/blender/editors/transform/transform_convert_tracking.c +++ b/source/blender/editors/transform/transform_convert_tracking.c @@ -518,7 +518,7 @@ static void createTransTrackingCurvesData(bContext *C, TransInfo *t) void createTransTrackingData(bContext *C, TransInfo *t) { - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); SpaceClip *sc = CTX_wm_space_clip(C); MovieClip *clip = ED_space_clip_get_clip(sc); int width, height; @@ -537,7 +537,7 @@ void createTransTrackingData(bContext *C, TransInfo *t) return; } - if (ar->regiontype == RGN_TYPE_PREVIEW) { + if (region->regiontype == RGN_TYPE_PREVIEW) { /* transformation was called from graph editor */ createTransTrackingCurvesData(C, t); } diff --git a/source/blender/editors/transform/transform_draw_cursors.c b/source/blender/editors/transform/transform_draw_cursors.c index dc2ebdca56a..f3105c8eb36 100644 --- a/source/blender/editors/transform/transform_draw_cursors.c +++ b/source/blender/editors/transform/transform_draw_cursors.c @@ -148,9 +148,9 @@ static void drawArc(float angle_start, float angle_end, int segments, float size */ bool transform_draw_cursor_poll(bContext *C) { - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); - if (ar && ar->regiontype == RGN_TYPE_WINDOW) { + if (region && region->regiontype == RGN_TYPE_WINDOW) { return 1; } return 0; @@ -181,8 +181,8 @@ void transform_draw_cursor_draw(bContext *UNUSED(C), int x, int y, void *customd projectFloatViewEx(t, t->center_global, cent, V3D_PROJ_TEST_CLIP_ZERO); /* Offset the values for the area region. */ const float offset[2] = { - t->ar->winrct.xmin, - t->ar->winrct.ymin, + t->region->winrct.xmin, + t->region->winrct.ymin, }; for (int i = 0; i < 2; i++) { diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c index 7d9a122f802..3fe1b99adfb 100644 --- a/source/blender/editors/transform/transform_generics.c +++ b/source/blender/editors/transform/transform_generics.c @@ -369,10 +369,10 @@ static void recalcData_actedit(TransInfo *t) ac.view_layer = t->view_layer; ac.obact = OBACT(view_layer); ac.sa = t->sa; - ac.ar = t->ar; + ac.region = t->region; ac.sl = (t->sa) ? t->sa->spacedata.first : NULL; ac.spacetype = (t->sa) ? t->sa->spacetype : 0; - ac.regiontype = (t->ar) ? t->ar->regiontype : 0; + ac.regiontype = (t->region) ? t->region->regiontype : 0; ANIM_animdata_context_getdata(&ac); @@ -422,10 +422,10 @@ static void recalcData_graphedit(TransInfo *t) ac.view_layer = t->view_layer; ac.obact = OBACT(view_layer); ac.sa = t->sa; - ac.ar = t->ar; + ac.region = t->region; ac.sl = (t->sa) ? t->sa->spacedata.first : NULL; ac.spacetype = (t->sa) ? t->sa->spacetype : 0; - ac.regiontype = (t->ar) ? t->ar->regiontype : 0; + ac.regiontype = (t->region) ? t->region->regiontype : 0; ANIM_animdata_context_getdata(&ac); @@ -1368,7 +1368,7 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve Object *obact = OBACT(view_layer); const eObjectMode object_mode = obact ? obact->mode : OB_MODE_OBJECT; ToolSettings *ts = CTX_data_tool_settings(C); - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); ScrArea *sa = CTX_wm_area(C); bGPdata *gpd = CTX_data_gpencil_data(C); @@ -1378,7 +1378,7 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve t->scene = sce; t->view_layer = view_layer; t->sa = sa; - t->ar = ar; + t->region = region; t->settings = ts; t->reports = op ? op->reports : NULL; @@ -1463,7 +1463,7 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve /* background mode */ t->spacetype = SPACE_EMPTY; } - else if ((ar == NULL) && (sa->spacetype == SPACE_VIEW3D)) { + else if ((region == NULL) && (sa->spacetype == SPACE_VIEW3D)) { /* running in the text editor */ t->spacetype = SPACE_EMPTY; } @@ -1560,7 +1560,7 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve else if (t->spacetype == SPACE_IMAGE) { SpaceImage *sima = sa->spacedata.first; // XXX for now, get View2D from the active region - t->view = &ar->v2d; + t->view = ®ion->v2d; t->around = sima->around; if (ED_space_image_show_uvedit(sima, OBACT(t->view_layer))) { @@ -1579,17 +1579,17 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve } else if (t->spacetype == SPACE_NODE) { // XXX for now, get View2D from the active region - t->view = &ar->v2d; + t->view = ®ion->v2d; t->around = V3D_AROUND_CENTER_BOUNDS; } else if (t->spacetype == SPACE_GRAPH) { SpaceGraph *sipo = sa->spacedata.first; - t->view = &ar->v2d; + t->view = ®ion->v2d; t->around = sipo->around; } else if (t->spacetype == SPACE_CLIP) { SpaceClip *sclip = sa->spacedata.first; - t->view = &ar->v2d; + t->view = ®ion->v2d; t->around = sclip->around; if (ED_space_clip_check_show_trackedit(sclip)) { @@ -1600,9 +1600,9 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve } } else { - if (ar) { + if (region) { // XXX for now, get View2D from the active region - t->view = &ar->v2d; + t->view = ®ion->v2d; // XXX for now, the center point is the midpoint of the data } else { @@ -1818,13 +1818,13 @@ void freeTransCustomDataForMode(TransInfo *t) void postTrans(bContext *C, TransInfo *t) { if (t->draw_handle_view) { - ED_region_draw_cb_exit(t->ar->type, t->draw_handle_view); + ED_region_draw_cb_exit(t->region->type, t->draw_handle_view); } if (t->draw_handle_apply) { - ED_region_draw_cb_exit(t->ar->type, t->draw_handle_apply); + ED_region_draw_cb_exit(t->region->type, t->draw_handle_apply); } if (t->draw_handle_pixel) { - ED_region_draw_cb_exit(t->ar->type, t->draw_handle_pixel); + ED_region_draw_cb_exit(t->region->type, t->draw_handle_pixel); } if (t->draw_handle_cursor) { WM_paint_cursor_end(CTX_wm_manager(C), t->draw_handle_cursor); @@ -2003,10 +2003,10 @@ void calculateCenterCursor(TransInfo *t, float r_center[3]) /* If edit or pose mode, move cursor in local space */ if (t->options & CTX_PAINT_CURVE) { - if (ED_view3d_project_float_global(t->ar, cursor, r_center, V3D_PROJ_TEST_NOP) != + if (ED_view3d_project_float_global(t->region, cursor, r_center, V3D_PROJ_TEST_NOP) != V3D_PROJ_RET_OK) { - r_center[0] = t->ar->winx / 2.0f; - r_center[1] = t->ar->winy / 2.0f; + r_center[0] = t->region->winx / 2.0f; + r_center[1] = t->region->winy / 2.0f; } r_center[2] = 0.0f; } @@ -2046,8 +2046,8 @@ void calculateCenterCursor2D(TransInfo *t, float r_center[2]) } else if (t->options & CTX_PAINT_CURVE) { if (t->spacetype == SPACE_IMAGE) { - r_center[0] = UI_view2d_view_to_region_x(&t->ar->v2d, cursor[0]); - r_center[1] = UI_view2d_view_to_region_y(&t->ar->v2d, cursor[1]); + r_center[0] = UI_view2d_view_to_region_x(&t->region->v2d, cursor[0]); + r_center[1] = UI_view2d_view_to_region_y(&t->region->v2d, cursor[1]); } } else { @@ -2229,7 +2229,7 @@ void calculateCenter(TransInfo *t) /* for panning from cameraview */ if ((t->flag & T_OBJECT) && (t->flag & T_OVERRIDE_CENTER) == 0) { - if (t->spacetype == SPACE_VIEW3D && t->ar && t->ar->regiontype == RGN_TYPE_WINDOW) { + if (t->spacetype == SPACE_VIEW3D && t->region && t->region->regiontype == RGN_TYPE_WINDOW) { if (t->flag & T_CAMERA) { float axis[3]; @@ -2262,8 +2262,8 @@ void calculateCenter(TransInfo *t) * We need special case here as well, since ED_view3d_calc_zfac will crash when called * for a region different from RGN_TYPE_WINDOW. */ - if (t->ar->regiontype == RGN_TYPE_WINDOW) { - t->zfac = ED_view3d_calc_zfac(t->ar->regiondata, t->center_global, NULL); + if (t->region->regiontype == RGN_TYPE_WINDOW) { + t->zfac = ED_view3d_calc_zfac(t->region->regiondata, t->center_global, NULL); } else { t->zfac = 0.0f; diff --git a/source/blender/editors/transform/transform_gizmo_2d.c b/source/blender/editors/transform/transform_gizmo_2d.c index 558e14750d6..74f5924b717 100644 --- a/source/blender/editors/transform/transform_gizmo_2d.c +++ b/source/blender/editors/transform/transform_gizmo_2d.c @@ -87,10 +87,10 @@ static void gizmo2d_pivot_point_message_subscribe(struct wmGizmoGroup *gzgroup, /* Additional args. */ bScreen *screen, ScrArea *sa, - ARegion *ar) + ARegion *region) { wmMsgSubscribeValue msg_sub_value_gz_tag_refresh = { - .owner = ar, + .owner = region, .user_data = gzgroup->parent_gzmap, .notify = WM_gizmo_do_msg_notify_tag_refresh, }; @@ -256,9 +256,9 @@ static bool gizmo2d_calc_center(const bContext *C, float r_center[2]) /** * Convert origin (or any other point) from view to region space. */ -BLI_INLINE void gizmo2d_origin_to_region(ARegion *ar, float *r_origin) +BLI_INLINE void gizmo2d_origin_to_region(ARegion *region, float *r_origin) { - UI_view2d_view_to_region_fl(&ar->v2d, r_origin[0], r_origin[1], &r_origin[0], &r_origin[1]); + UI_view2d_view_to_region_fl(®ion->v2d, r_origin[0], r_origin[1], &r_origin[0], &r_origin[1]); } /** @@ -269,14 +269,14 @@ static int gizmo2d_modal(bContext *C, const wmEvent *UNUSED(event), eWM_GizmoFlagTweak UNUSED(tweak_flag)) { - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); float origin[3]; gizmo2d_calc_center(C, origin); - gizmo2d_origin_to_region(ar, origin); + gizmo2d_origin_to_region(region, origin); WM_gizmo_set_matrix_location(widget, origin); - ED_region_tag_redraw_editor_overlays(ar); + ED_region_tag_redraw_editor_overlays(region); return OPERATOR_RUNNING_MODAL; } @@ -480,19 +480,19 @@ static void gizmo2d_xform_refresh(const bContext *C, wmGizmoGroup *gzgroup) static void gizmo2d_xform_draw_prepare(const bContext *C, wmGizmoGroup *gzgroup) { - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); GizmoGroup2D *ggd = gzgroup->customdata; float origin[3] = {UNPACK2(ggd->origin), 0.0f}; float origin_aa[3] = {UNPACK2(ggd->origin), 0.0f}; - gizmo2d_origin_to_region(ar, origin); + gizmo2d_origin_to_region(region, origin); for (int i = 0; i < ARRAY_SIZE(ggd->translate_xy); i++) { wmGizmo *gz = ggd->translate_xy[i]; WM_gizmo_set_matrix_location(gz, origin); } - UI_view2d_view_to_region_m4(&ar->v2d, ggd->cage->matrix_space); + UI_view2d_view_to_region_m4(®ion->v2d, ggd->cage->matrix_space); WM_gizmo_set_matrix_offset_location(ggd->cage, origin_aa); ggd->cage->matrix_offset[0][0] = (ggd->max[0] - ggd->min[0]); ggd->cage->matrix_offset[1][1] = (ggd->max[1] - ggd->min[1]); @@ -504,8 +504,8 @@ static void gizmo2d_xform_no_cage_message_subscribe(const struct bContext *C, { bScreen *screen = CTX_wm_screen(C); ScrArea *sa = CTX_wm_area(C); - ARegion *ar = CTX_wm_region(C); - gizmo2d_pivot_point_message_subscribe(gzgroup, mbus, screen, sa, ar); + ARegion *region = CTX_wm_region(C); + gizmo2d_pivot_point_message_subscribe(gzgroup, mbus, screen, sa, region); } void ED_widgetgroup_gizmo2d_xform_callbacks_set(wmGizmoGroupType *gzgt) @@ -575,7 +575,7 @@ static void gizmo2d_resize_refresh(const bContext *C, wmGizmoGroup *gzgroup) static void gizmo2d_resize_draw_prepare(const bContext *C, wmGizmoGroup *gzgroup) { - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); GizmoGroup_Resize2D *ggd = gzgroup->customdata; float origin[3] = {UNPACK2(ggd->origin), 0.0f}; @@ -589,7 +589,7 @@ static void gizmo2d_resize_draw_prepare(const bContext *C, wmGizmoGroup *gzgroup } } - gizmo2d_origin_to_region(ar, origin); + gizmo2d_origin_to_region(region, origin); for (int i = 0; i < ARRAY_SIZE(ggd->gizmo_xy); i++) { wmGizmo *gz = ggd->gizmo_xy[i]; @@ -660,8 +660,8 @@ static void gizmo2d_resize_message_subscribe(const struct bContext *C, { bScreen *screen = CTX_wm_screen(C); ScrArea *sa = CTX_wm_area(C); - ARegion *ar = CTX_wm_region(C); - gizmo2d_pivot_point_message_subscribe(gzgroup, mbus, screen, sa, ar); + ARegion *region = CTX_wm_region(C); + gizmo2d_pivot_point_message_subscribe(gzgroup, mbus, screen, sa, region); } void ED_widgetgroup_gizmo2d_resize_callbacks_set(wmGizmoGroupType *gzgt) @@ -718,7 +718,7 @@ static void gizmo2d_rotate_refresh(const bContext *C, wmGizmoGroup *gzgroup) static void gizmo2d_rotate_draw_prepare(const bContext *C, wmGizmoGroup *gzgroup) { - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); GizmoGroup_Rotate2D *ggd = gzgroup->customdata; float origin[3] = {UNPACK2(ggd->origin), 0.0f}; @@ -732,7 +732,7 @@ static void gizmo2d_rotate_draw_prepare(const bContext *C, wmGizmoGroup *gzgroup } } - gizmo2d_origin_to_region(ar, origin); + gizmo2d_origin_to_region(region, origin); wmGizmo *gz = ggd->gizmo; WM_gizmo_set_matrix_location(gz, origin); @@ -776,8 +776,8 @@ static void gizmo2d_rotate_message_subscribe(const struct bContext *C, { bScreen *screen = CTX_wm_screen(C); ScrArea *sa = CTX_wm_area(C); - ARegion *ar = CTX_wm_region(C); - gizmo2d_pivot_point_message_subscribe(gzgroup, mbus, screen, sa, ar); + ARegion *region = CTX_wm_region(C); + gizmo2d_pivot_point_message_subscribe(gzgroup, mbus, screen, sa, region); } void ED_widgetgroup_gizmo2d_rotate_callbacks_set(wmGizmoGroupType *gzgt) diff --git a/source/blender/editors/transform/transform_gizmo_3d.c b/source/blender/editors/transform/transform_gizmo_3d.c index 46add93b2e1..02767156ef4 100644 --- a/source/blender/editors/transform/transform_gizmo_3d.c +++ b/source/blender/editors/transform/transform_gizmo_3d.c @@ -637,11 +637,11 @@ bool gimbal_axis(Object *ob, float gmat[3][3]) void ED_transform_calc_orientation_from_type(const bContext *C, float r_mat[3][3]) { - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); Scene *scene = CTX_data_scene(C); ViewLayer *view_layer = CTX_data_view_layer(C); Object *obedit = CTX_data_edit_object(C); - RegionView3D *rv3d = ar->regiondata; + RegionView3D *rv3d = region->regiondata; Object *ob = OBACT(view_layer); const short orientation_type = scene->orientation_slots[SCE_ORIENT_DEFAULT].type; const short orientation_index_custom = scene->orientation_slots[SCE_ORIENT_DEFAULT].index_custom; @@ -735,7 +735,7 @@ int ED_transform_calc_gizmo_stats(const bContext *C, struct TransformBounds *tbounds) { ScrArea *sa = CTX_wm_area(C); - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); Scene *scene = CTX_data_scene(C); /* TODO(sergey): This function is used from operator's modal() and from gizmo's refresh(). * Is it fine to possibly evaluate dependency graph here? */ @@ -743,7 +743,7 @@ int ED_transform_calc_gizmo_stats(const bContext *C, ViewLayer *view_layer = CTX_data_view_layer(C); View3D *v3d = sa->spacedata.first; Object *obedit = CTX_data_edit_object(C); - RegionView3D *rv3d = ar->regiondata; + RegionView3D *rv3d = region->regiondata; Base *base; Object *ob = OBACT(view_layer); bGPdata *gpd = CTX_data_gpencil_data(C); @@ -1245,12 +1245,12 @@ static void gizmo_xform_message_subscribe(wmGizmoGroup *gzgroup, Scene *scene, bScreen *screen, ScrArea *sa, - ARegion *ar, + ARegion *region, const void *type_fn) { /* Subscribe to view properties */ wmMsgSubscribeValue msg_sub_value_gz_tag_refresh = { - .owner = ar, + .owner = region, .user_data = gzgroup->parent_gzmap, .notify = WM_gizmo_do_msg_notify_tag_refresh, }; @@ -1369,7 +1369,7 @@ static void gizmo_xform_message_subscribe(wmGizmoGroup *gzgroup, void drawDial3d(const TransInfo *t) { if (t->mode == TFM_ROTATION && t->spacetype == SPACE_VIEW3D) { - wmGizmo *gz = wm_gizmomap_modal_get(t->ar->gizmo_map); + wmGizmo *gz = wm_gizmomap_modal_get(t->region->gizmo_map); if (gz == NULL) { /* We only draw Dial3d if the operator has been called by a gizmo. */ return; @@ -1411,7 +1411,7 @@ void drawDial3d(const TransInfo *t) mat_basis[2][3] = -dot_v3v3(mat_basis[2], mat_basis[3]); if (ED_view3d_win_to_3d_on_plane( - t->ar, mat_basis[2], (float[2]){UNPACK2(t->mouse.imval)}, false, mat_basis[1])) { + t->region, mat_basis[2], (float[2]){UNPACK2(t->mouse.imval)}, false, mat_basis[1])) { sub_v3_v3(mat_basis[1], mat_basis[3]); normalize_v3(mat_basis[1]); cross_v3_v3v3(mat_basis[0], mat_basis[1], mat_basis[2]); @@ -1428,7 +1428,7 @@ void drawDial3d(const TransInfo *t) mat_basis[3][3] = 1.0f; copy_m4_m4(mat_final, mat_basis); - scale *= ED_view3d_pixel_size_no_ui_scale(t->ar->regiondata, mat_final[3]); + scale *= ED_view3d_pixel_size_no_ui_scale(t->region->regiondata, mat_final[3]); mul_mat3_m4_fl(mat_final, scale); if (activeSnap(t) && (!transformModeUseSnap(t) || @@ -1554,8 +1554,8 @@ static int gizmo_modal(bContext *C, return OPERATOR_RUNNING_MODAL; } - ARegion *ar = CTX_wm_region(C); - RegionView3D *rv3d = ar->regiondata; + ARegion *region = CTX_wm_region(C); + RegionView3D *rv3d = region->regiondata; struct TransformBounds tbounds; if (ED_transform_calc_gizmo_stats(C, @@ -1567,7 +1567,7 @@ static int gizmo_modal(bContext *C, WM_gizmo_set_matrix_location(widget, rv3d->twmat[3]); } - ED_region_tag_redraw_editor_overlays(ar); + ED_region_tag_redraw_editor_overlays(region); return OPERATOR_RUNNING_MODAL; } @@ -1739,8 +1739,8 @@ static void WIDGETGROUP_gizmo_refresh(const bContext *C, wmGizmoGroup *gzgroup) Scene *scene = CTX_data_scene(C); ScrArea *sa = CTX_wm_area(C); View3D *v3d = sa->spacedata.first; - ARegion *ar = CTX_wm_region(C); - RegionView3D *rv3d = ar->regiondata; + ARegion *region = CTX_wm_region(C); + RegionView3D *rv3d = region->regiondata; struct TransformBounds tbounds; if (scene->toolsettings->workspace_tool_type == SCE_WORKSPACE_TOOL_FALLBACK) { @@ -1845,17 +1845,17 @@ static void WIDGETGROUP_gizmo_message_subscribe(const bContext *C, Scene *scene = CTX_data_scene(C); bScreen *screen = CTX_wm_screen(C); ScrArea *sa = CTX_wm_area(C); - ARegion *ar = CTX_wm_region(C); - gizmo_xform_message_subscribe(gzgroup, mbus, scene, screen, sa, ar, VIEW3D_GGT_xform_gizmo); + ARegion *region = CTX_wm_region(C); + gizmo_xform_message_subscribe(gzgroup, mbus, scene, screen, sa, region, VIEW3D_GGT_xform_gizmo); } static void WIDGETGROUP_gizmo_draw_prepare(const bContext *C, wmGizmoGroup *gzgroup) { GizmoGroup *ggd = gzgroup->customdata; // ScrArea *sa = CTX_wm_area(C); - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); // View3D *v3d = sa->spacedata.first; - RegionView3D *rv3d = ar->regiondata; + RegionView3D *rv3d = region->regiondata; float viewinv_m3[3][3]; copy_m3_m4(viewinv_m3, rv3d->viewinv); float idot[3]; @@ -2168,8 +2168,8 @@ static void WIDGETGROUP_xform_cage_setup(const bContext *UNUSED(C), wmGizmoGroup static void WIDGETGROUP_xform_cage_refresh(const bContext *C, wmGizmoGroup *gzgroup) { - ARegion *ar = CTX_wm_region(C); - RegionView3D *rv3d = ar->regiondata; + ARegion *region = CTX_wm_region(C); + RegionView3D *rv3d = region->regiondata; Scene *scene = CTX_data_scene(C); struct XFormCageWidgetGroup *xgzgroup = gzgroup->customdata; @@ -2248,8 +2248,8 @@ static void WIDGETGROUP_xform_cage_message_subscribe(const bContext *C, Scene *scene = CTX_data_scene(C); bScreen *screen = CTX_wm_screen(C); ScrArea *sa = CTX_wm_area(C); - ARegion *ar = CTX_wm_region(C); - gizmo_xform_message_subscribe(gzgroup, mbus, scene, screen, sa, ar, VIEW3D_GGT_xform_cage); + ARegion *region = CTX_wm_region(C); + gizmo_xform_message_subscribe(gzgroup, mbus, scene, screen, sa, region, VIEW3D_GGT_xform_cage); } static void WIDGETGROUP_xform_cage_draw_prepare(const bContext *C, wmGizmoGroup *gzgroup) @@ -2384,8 +2384,8 @@ static void WIDGETGROUP_xform_shear_setup(const bContext *UNUSED(C), wmGizmoGrou static void WIDGETGROUP_xform_shear_refresh(const bContext *C, wmGizmoGroup *gzgroup) { Scene *scene = CTX_data_scene(C); - ARegion *ar = CTX_wm_region(C); - RegionView3D *rv3d = ar->regiondata; + ARegion *region = CTX_wm_region(C); + RegionView3D *rv3d = region->regiondata; struct XFormShearWidgetGroup *xgzgroup = gzgroup->customdata; struct TransformBounds tbounds; @@ -2461,8 +2461,8 @@ static void WIDGETGROUP_xform_shear_message_subscribe(const bContext *C, Scene *scene = CTX_data_scene(C); bScreen *screen = CTX_wm_screen(C); ScrArea *sa = CTX_wm_area(C); - ARegion *ar = CTX_wm_region(C); - gizmo_xform_message_subscribe(gzgroup, mbus, scene, screen, sa, ar, VIEW3D_GGT_xform_shear); + ARegion *region = CTX_wm_region(C); + gizmo_xform_message_subscribe(gzgroup, mbus, scene, screen, sa, region, VIEW3D_GGT_xform_shear); } static void WIDGETGROUP_xform_shear_draw_prepare(const bContext *C, wmGizmoGroup *gzgroup) diff --git a/source/blender/editors/transform/transform_gizmo_extrude_3d.c b/source/blender/editors/transform/transform_gizmo_extrude_3d.c index fb33471cf3f..8b5db2b57ec 100644 --- a/source/blender/editors/transform/transform_gizmo_extrude_3d.c +++ b/source/blender/editors/transform/transform_gizmo_extrude_3d.c @@ -469,11 +469,11 @@ static void gizmo_mesh_extrude_message_subscribe(const bContext *C, struct wmMsgBus *mbus) { GizmoExtrudeGroup *ggd = gzgroup->customdata; - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); /* Subscribe to view properties */ wmMsgSubscribeValue msg_sub_value_gz_tag_refresh = { - .owner = ar, + .owner = region, .user_data = gzgroup->parent_gzmap, .notify = WM_gizmo_do_msg_notify_tag_refresh, }; diff --git a/source/blender/editors/transform/transform_input.c b/source/blender/editors/transform/transform_input.c index 8dc403c45d2..fb929b60739 100644 --- a/source/blender/editors/transform/transform_input.c +++ b/source/blender/editors/transform/transform_input.c @@ -93,7 +93,7 @@ static void InputHorizontalRatio(TransInfo *t, const double mval[2], float output[3]) { - const int winx = t->ar ? t->ar->winx : 1; + const int winx = t->region ? t->region->winx : 1; output[0] = ((mval[0] - mi->imval[0]) / winx) * 2.0f; } @@ -113,7 +113,7 @@ static void InputHorizontalAbsolute(TransInfo *t, static void InputVerticalRatio(TransInfo *t, MouseInput *mi, const double mval[2], float output[3]) { - const int winy = t->ar ? t->ar->winy : 1; + const int winy = t->region ? t->region->winy : 1; /* Flip so dragging up increases (matching viewport zoom). */ output[0] = ((mval[1] - mi->imval[1]) / winy) * -2.0f; @@ -153,10 +153,10 @@ void setCustomPoints(TransInfo *UNUSED(t), void setCustomPointsFromDirection(TransInfo *t, MouseInput *mi, const float dir[2]) { BLI_ASSERT_UNIT_V2(dir); - const int win_axis = t->ar ? - ((abs((int)(t->ar->winx * dir[0])) + abs((int)(t->ar->winy * dir[1]))) / - 2) : - 1; + const int win_axis = t->region ? ((abs((int)(t->region->winx * dir[0])) + + abs((int)(t->region->winy * dir[1]))) / + 2) : + 1; const int mval_start[2] = { mi->imval[0] + dir[0] * win_axis, mi->imval[1] + dir[1] * win_axis, diff --git a/source/blender/editors/transform/transform_mode_bend.c b/source/blender/editors/transform/transform_mode_bend.c index daa2e583e2f..d4c39ac969b 100644 --- a/source/blender/editors/transform/transform_mode_bend.c +++ b/source/blender/editors/transform/transform_mode_bend.c @@ -289,7 +289,7 @@ void initBend(TransInfo *t) curs = t->scene->cursor.location; copy_v3_v3(data->warp_sta, curs); - ED_view3d_win_to_3d((View3D *)t->sa->spacedata.first, t->ar, curs, mval_fl, data->warp_end); + ED_view3d_win_to_3d((View3D *)t->sa->spacedata.first, t->region, curs, mval_fl, data->warp_end); copy_v3_v3(data->warp_nor, t->viewinv[2]); normalize_v3(data->warp_nor); diff --git a/source/blender/editors/transform/transform_mode_edge_slide.c b/source/blender/editors/transform/transform_mode_edge_slide.c index 27b5dbba488..fb43d75567c 100644 --- a/source/blender/editors/transform/transform_mode_edge_slide.c +++ b/source/blender/editors/transform/transform_mode_edge_slide.c @@ -320,7 +320,7 @@ static void calcEdgeSlide_mval_range(TransInfo *t, { TransDataEdgeSlideVert *sv; BMEditMesh *em = BKE_editmesh_from_object(tc->obedit); - ARegion *ar = t->ar; + ARegion *region = t->region; View3D *v3d = NULL; RegionView3D *rv3d = NULL; float projectMat[4][4]; @@ -335,7 +335,7 @@ static void calcEdgeSlide_mval_range(TransInfo *t, if (t->spacetype == SPACE_VIEW3D) { /* background mode support */ v3d = t->sa ? t->sa->spacedata.first : NULL; - rv3d = t->ar ? t->ar->regiondata : NULL; + rv3d = t->region ? t->region->regiondata : NULL; } if (!rv3d) { @@ -387,26 +387,26 @@ static void calcEdgeSlide_mval_range(TransInfo *t, /* This test is only relevant if object is not wire-drawn! See [#32068]. */ bool is_visible = !use_occlude_geometry || - BMBVH_EdgeVisible(bmbvh, e, t->depsgraph, ar, v3d, tc->obedit); + BMBVH_EdgeVisible(bmbvh, e, t->depsgraph, region, v3d, tc->obedit); if (!is_visible && !use_calc_direction) { continue; } if (sv->v_side[1]) { - ED_view3d_project_float_v3_m4(ar, sv->v_side[1]->co, sco_b, projectMat); + ED_view3d_project_float_v3_m4(region, sv->v_side[1]->co, sco_b, projectMat); } else { add_v3_v3v3(sco_b, v->co, sv->dir_side[1]); - ED_view3d_project_float_v3_m4(ar, sco_b, sco_b, projectMat); + ED_view3d_project_float_v3_m4(region, sco_b, sco_b, projectMat); } if (sv->v_side[0]) { - ED_view3d_project_float_v3_m4(ar, sv->v_side[0]->co, sco_a, projectMat); + ED_view3d_project_float_v3_m4(region, sv->v_side[0]->co, sco_a, projectMat); } else { add_v3_v3v3(sco_a, v->co, sv->dir_side[0]); - ED_view3d_project_float_v3_m4(ar, sco_a, sco_a, projectMat); + ED_view3d_project_float_v3_m4(region, sco_a, sco_a, projectMat); } /* global direction */ @@ -479,7 +479,7 @@ static void calcEdgeSlide_even(TransInfo *t, TransDataEdgeSlideVert *sv = sld->sv; if (sld->totsv > 0) { - ARegion *ar = t->ar; + ARegion *region = t->region; RegionView3D *rv3d = NULL; float projectMat[4][4]; @@ -491,7 +491,7 @@ static void calcEdgeSlide_even(TransInfo *t, if (t->spacetype == SPACE_VIEW3D) { /* background mode support */ - rv3d = t->ar ? t->ar->regiondata : NULL; + rv3d = t->region ? t->region->regiondata : NULL; } if (!rv3d) { @@ -506,7 +506,7 @@ static void calcEdgeSlide_even(TransInfo *t, /* Set length */ sv->edge_len = len_v3v3(sv->dir_side[0], sv->dir_side[1]); - ED_view3d_project_float_v2_m4(ar, sv->v->co, v_proj, projectMat); + ED_view3d_project_float_v2_m4(region, sv->v->co, v_proj, projectMat); dist_sq = len_squared_v2v2(mval, v_proj); if (dist_sq < dist_min_sq) { dist_min_sq = dist_sq; @@ -859,7 +859,7 @@ static bool createEdgeSlideVerts_double_side(TransInfo *t, TransDataContainer *t /* use for visibility checks */ if (t->spacetype == SPACE_VIEW3D) { v3d = t->sa ? t->sa->spacedata.first : NULL; - rv3d = t->ar ? t->ar->regiondata : NULL; + rv3d = t->region ? t->region->regiondata : NULL; use_occlude_geometry = (v3d && TRANS_DATA_CONTAINER_FIRST_OK(t)->obedit->dt > OB_WIRE && !XRAY_ENABLED(v3d)); } @@ -900,7 +900,7 @@ static bool createEdgeSlideVerts_single_side(TransInfo *t, TransDataContainer *t if (t->spacetype == SPACE_VIEW3D) { /* background mode support */ v3d = t->sa ? t->sa->spacedata.first : NULL; - rv3d = t->ar ? t->ar->regiondata : NULL; + rv3d = t->region ? t->region->regiondata : NULL; } sld->curr_sv_index = 0; @@ -1044,7 +1044,7 @@ static bool createEdgeSlideVerts_single_side(TransInfo *t, TransDataContainer *t /* use for visibility checks */ if (t->spacetype == SPACE_VIEW3D) { v3d = t->sa ? t->sa->spacedata.first : NULL; - rv3d = t->ar ? t->ar->regiondata : NULL; + rv3d = t->region ? t->region->regiondata : NULL; use_occlude_geometry = (v3d && TRANS_DATA_CONTAINER_FIRST_OK(t)->obedit->dt > OB_WIRE && !XRAY_ENABLED(v3d)); } diff --git a/source/blender/editors/transform/transform_mode_vert_slide.c b/source/blender/editors/transform/transform_mode_vert_slide.c index 4009a0fb3f9..ae775b5db24 100644 --- a/source/blender/editors/transform/transform_mode_vert_slide.c +++ b/source/blender/editors/transform/transform_mode_vert_slide.c @@ -98,8 +98,8 @@ static void calcVertSlideCustomPoints(struct TransInfo *t) int mval_ofs[2], mval_start[2], mval_end[2]; - ED_view3d_project_float_v2_m4(t->ar, co_orig_3d, co_orig_2d, sld->proj_mat); - ED_view3d_project_float_v2_m4(t->ar, co_curr_3d, co_curr_2d, sld->proj_mat); + ED_view3d_project_float_v2_m4(t->region, co_orig_3d, co_orig_2d, sld->proj_mat); + ED_view3d_project_float_v2_m4(t->region, co_curr_3d, co_curr_2d, sld->proj_mat); ARRAY_SET_ITEMS(mval_ofs, t->mouse.imval[0] - co_orig_2d[0], t->mouse.imval[1] - co_orig_2d[1]); ARRAY_SET_ITEMS(mval_start, co_orig_2d[0] + mval_ofs[0], co_orig_2d[1] + mval_ofs[1]); @@ -136,7 +136,7 @@ static void calcVertSlideMouseActiveVert(struct TransInfo *t, const int mval[2]) for (i = 0, sv = sld->sv; i < sld->totsv; i++, sv++) { float co_2d[2]; - ED_view3d_project_float_v2_m4(t->ar, sv->co_orig_3d, co_2d, sld->proj_mat); + ED_view3d_project_float_v2_m4(t->region, sv->co_orig_3d, co_2d, sld->proj_mat); dist_sq = len_squared_v2v2(mval_fl, co_2d); if (dist_sq < dist_min_sq) { @@ -165,7 +165,7 @@ static void calcVertSlideMouseActiveEdges(struct TransInfo *t, const int mval[2] /* first get the direction of the original mouse position */ sub_v2_v2v2(dir, imval_fl, mval_fl); - ED_view3d_win_to_delta(t->ar, dir, dir, t->zfac); + ED_view3d_win_to_delta(t->region, dir, dir, t->zfac); normalize_v3(dir); for (i = 0, sv = sld->sv; i < sld->totsv; i++, sv++) { @@ -280,9 +280,9 @@ static bool createVertSlideVerts(TransInfo *t, TransDataContainer *tc) if (t->spacetype == SPACE_VIEW3D) { /* view vars */ RegionView3D *rv3d = NULL; - ARegion *ar = t->ar; + ARegion *region = t->region; - rv3d = ar ? ar->regiondata : NULL; + rv3d = region ? region->regiondata : NULL; if (rv3d) { ED_view3d_ob_project_mat_get(rv3d, tc->obedit, sld->proj_mat); } @@ -468,9 +468,9 @@ void drawVertSlide(TransInfo *t) mul_v3_m4v3( co_orig_3d, TRANS_DATA_CONTAINER_FIRST_OK(t)->obedit->obmat, curr_sv->co_orig_3d); - zfac = ED_view3d_calc_zfac(t->ar->regiondata, co_orig_3d, NULL); + zfac = ED_view3d_calc_zfac(t->region->regiondata, co_orig_3d, NULL); - ED_view3d_win_to_delta(t->ar, mval_ofs, co_dest_3d, zfac); + ED_view3d_win_to_delta(t->region, mval_ofs, co_dest_3d, zfac); invert_m4_m4(TRANS_DATA_CONTAINER_FIRST_OK(t)->obedit->imat, TRANS_DATA_CONTAINER_FIRST_OK(t)->obedit->obmat); diff --git a/source/blender/editors/transform/transform_ops.c b/source/blender/editors/transform/transform_ops.c index 39f6f24eb8d..ee1353a28fa 100644 --- a/source/blender/editors/transform/transform_ops.c +++ b/source/blender/editors/transform/transform_ops.c @@ -1248,8 +1248,8 @@ static int transform_from_gizmo_invoke(bContext *C, { bToolRef *tref = WM_toolsystem_ref_from_context(C); if (tref) { - ARegion *ar = CTX_wm_region(C); - wmGizmoMap *gzmap = ar->gizmo_map; + ARegion *region = CTX_wm_region(C); + wmGizmoMap *gzmap = region->gizmo_map; wmGizmoGroup *gzgroup = gzmap ? WM_gizmomap_group_find(gzmap, "VIEW3D_GGT_xform_gizmo") : NULL; if (gzgroup != NULL) { PointerRNA gzg_ptr; diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c index ea4f1eedd81..3f08f795d32 100644 --- a/source/blender/editors/transform/transform_orientations.c +++ b/source/blender/editors/transform/transform_orientations.c @@ -471,8 +471,8 @@ void initTransformOrientation(bContext *C, TransInfo *t) break; case V3D_ORIENT_VIEW: - if ((t->spacetype == SPACE_VIEW3D) && (t->ar->regiontype == RGN_TYPE_WINDOW)) { - RegionView3D *rv3d = t->ar->regiondata; + if ((t->spacetype == SPACE_VIEW3D) && (t->region->regiontype == RGN_TYPE_WINDOW)) { + RegionView3D *rv3d = t->region->regiondata; float mat[3][3]; BLI_strncpy(t->spacename, TIP_("view"), sizeof(t->spacename)); diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c index 4b6ab2045c0..8336fd7890b 100644 --- a/source/blender/editors/transform/transform_snap.c +++ b/source/blender/editors/transform/transform_snap.c @@ -283,7 +283,7 @@ void drawSnapping(const struct bContext *C, TransInfo *t) } else if (t->spacetype == SPACE_NODE) { if (validSnap(t)) { - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); TransSnapPoint *p; float size; @@ -304,13 +304,13 @@ void drawSnapping(const struct bContext *C, TransInfo *t) immUniformColor4ubv(col); } - ED_node_draw_snap(&ar->v2d, p->co, size, 0, pos); + ED_node_draw_snap(®ion->v2d, p->co, size, 0, pos); } if (t->tsnap.status & POINT_INIT) { immUniformColor4ubv(activeCol); - ED_node_draw_snap(&ar->v2d, t->tsnap.snapPoint, size, t->tsnap.snapNodeBorder, pos); + ED_node_draw_snap(®ion->v2d, t->tsnap.snapPoint, size, t->tsnap.snapNodeBorder, pos); } immUnbindProgram(); @@ -373,7 +373,7 @@ void applyProject(TransInfo *t) copy_v3_v3(iloc, td->ob->obmat[3]); } - if (ED_view3d_project_float_global(t->ar, iloc, mval_fl, V3D_PROJ_TEST_NOP) == + if (ED_view3d_project_float_global(t->region, iloc, mval_fl, V3D_PROJ_TEST_NOP) == V3D_PROJ_RET_OK) { if (ED_transform_snap_object_project_view3d( t->tsnap.object_context, @@ -686,7 +686,7 @@ static void initSnappingMode(TransInfo *t) if (t->spacetype == SPACE_VIEW3D) { if (t->tsnap.object_context == NULL) { t->tsnap.object_context = ED_transform_snap_object_context_create_view3d( - bmain, t->scene, t->depsgraph, 0, t->ar, t->view); + bmain, t->scene, t->depsgraph, 0, t->region, t->view); ED_transform_snap_object_context_set_editmesh_callbacks( t->tsnap.object_context, @@ -847,7 +847,7 @@ eRedrawFlag updateSelectedSnapPoint(TransInfo *t) for (p = t->tsnap.points.first; p; p = p->next) { float dist_sq; - if (ED_view3d_project_float_global(t->ar, p->co, screen_loc, V3D_PROJ_TEST_NOP) != + if (ED_view3d_project_float_global(t->region, p->co, screen_loc, V3D_PROJ_TEST_NOP) != V3D_PROJ_RET_OK) { continue; } @@ -936,7 +936,7 @@ static void ApplySnapTranslation(TransInfo *t, float vec[3]) else { if (t->spacetype == SPACE_VIEW3D) { if (t->options & CTX_PAINT_CURVE) { - if (ED_view3d_project_float_global(t->ar, point, point, V3D_PROJ_TEST_NOP) != + if (ED_view3d_project_float_global(t->region, point, point, V3D_PROJ_TEST_NOP) != V3D_PROJ_RET_OK) { zero_v3(point); /* no good answer here... */ } @@ -1108,7 +1108,7 @@ static void CalcSnapGeometry(TransInfo *t, float *UNUSED(vec)) Image *ima = ED_space_image(t->sa->spacedata.first); float co[2]; - UI_view2d_region_to_view(&t->ar->v2d, t->mval[0], t->mval[1], &co[0], &co[1]); + UI_view2d_region_to_view(&t->region->v2d, t->mval[0], t->mval[1], &co[0], &co[1]); uint objects_len = 0; Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data_with_uvs( @@ -1504,14 +1504,14 @@ static NodeBorder snapNodeBorder(int snap_node_mode) static bool snapNode(ToolSettings *ts, SpaceNode *UNUSED(snode), - ARegion *ar, + ARegion *region, bNode *node, const int mval[2], float r_loc[2], float *r_dist_px, char *r_node_border) { - View2D *v2d = &ar->v2d; + View2D *v2d = ®ion->v2d; NodeBorder border = snapNodeBorder(ts->snap_node_mode); bool retval = false; rcti totr; @@ -1564,7 +1564,7 @@ static bool snapNode(ToolSettings *ts, static bool snapNodes(ToolSettings *ts, SpaceNode *snode, - ARegion *ar, + ARegion *region, const int mval[2], eSnapSelect snap_select, float r_loc[2], @@ -1578,8 +1578,8 @@ static bool snapNodes(ToolSettings *ts, *r_node_border = 0; for (node = ntree->nodes.first; node; node = node->next) { - if (snapNodeTest(&ar->v2d, node, snap_select)) { - retval |= snapNode(ts, snode, ar, node, mval, r_loc, r_dist_px, r_node_border); + if (snapNodeTest(®ion->v2d, node, snap_select)) { + retval |= snapNode(ts, snode, region, node, mval, r_loc, r_dist_px, r_node_border); } } @@ -1591,7 +1591,7 @@ bool snapNodesTransform( { return snapNodes(t->settings, t->sa->spacedata.first, - t->ar, + t->region, mval, t->tsnap.modeSelect, r_loc, @@ -1691,7 +1691,7 @@ void snapSequenceBounds(TransInfo *t, const int mval[2]) } /* convert to frame range */ - UI_view2d_region_to_view(&t->ar->v2d, mval[0], mval[1], &xmouse, &ymouse); + UI_view2d_region_to_view(&t->region->v2d, mval[0], mval[1], &xmouse, &ymouse); mframe = round_fl_to_int(xmouse); /* now find the closest sequence */ frame = BKE_sequencer_find_next_prev_edit(t->scene, mframe, SEQ_SIDE_BOTH, true, false, true); @@ -1723,7 +1723,7 @@ static void applyGridIncrement( if (use_aspect) { /* custom aspect for fcurve */ if (t->spacetype == SPACE_GRAPH) { - View2D *v2d = &t->ar->v2d; + View2D *v2d = &t->region->v2d; Scene *scene = t->scene; SpaceGraph *sipo = t->sa->spacedata.first; asp_local[0] = UI_view2d_grid_resolution_x__frames_or_seconds( diff --git a/source/blender/editors/transform/transform_snap_object.c b/source/blender/editors/transform/transform_snap_object.c index 2365d3d77d7..c9970e7e49c 100644 --- a/source/blender/editors/transform/transform_snap_object.c +++ b/source/blender/editors/transform/transform_snap_object.c @@ -121,7 +121,7 @@ struct SnapObjectContext { bool use_v3d; struct { const struct View3D *v3d; - const struct ARegion *ar; + const struct ARegion *region; } v3d_data; /* Object -> SnapObjectData map */ @@ -2872,13 +2872,13 @@ SnapObjectContext *ED_transform_snap_object_context_create_view3d(Main *bmain, Depsgraph *depsgraph, int flag, /* extra args for view3d */ - const ARegion *ar, + const ARegion *region, const View3D *v3d) { SnapObjectContext *sctx = ED_transform_snap_object_context_create(bmain, scene, depsgraph, flag); sctx->use_v3d = true; - sctx->v3d_data.ar = ar; + sctx->v3d_data.region = region; sctx->v3d_data.v3d = v3d; return sctx; @@ -3034,15 +3034,15 @@ static short transform_snap_context_project_view3d_mixed_impl( float loc[3], no[3], obmat[4][4]; int index = -1; - const ARegion *ar = sctx->v3d_data.ar; - const RegionView3D *rv3d = ar->regiondata; + const ARegion *region = sctx->v3d_data.region; + const RegionView3D *rv3d = region->regiondata; bool use_occlusion_test = params->use_occlusion_test && !XRAY_ENABLED(sctx->v3d_data.v3d); if (snap_to_flag & SCE_SNAP_MODE_FACE || use_occlusion_test) { float ray_start[3], ray_normal[3]; if (!ED_view3d_win_to_ray_clipped_ex(sctx->depsgraph, - sctx->v3d_data.ar, + sctx->v3d_data.region, sctx->v3d_data.v3d, mval, NULL, @@ -3083,8 +3083,8 @@ static short transform_snap_context_project_view3d_mixed_impl( SnapData snapdata; copy_m4_m4(snapdata.pmat, rv3d->persmat); - snapdata.win_size[0] = ar->winx; - snapdata.win_size[1] = ar->winy; + snapdata.win_size[0] = region->winx; + snapdata.win_size[1] = region->winy; copy_v2_v2(snapdata.mval, mval); snapdata.view_proj = rv3d->is_persp ? VIEW_PROJ_PERSP : VIEW_PROJ_ORTHO; @@ -3230,7 +3230,7 @@ bool ED_transform_snap_object_project_all_view3d_ex(SnapObjectContext *sctx, float ray_start[3], ray_normal[3]; if (!ED_view3d_win_to_ray_clipped_ex(sctx->depsgraph, - sctx->v3d_data.ar, + sctx->v3d_data.region, sctx->v3d_data.v3d, mval, NULL, |