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. --- .../editors/animation/anim_channels_defines.c | 22 +++++++------- .../blender/editors/animation/anim_channels_edit.c | 18 ++++++------ source/blender/editors/animation/anim_draw.c | 18 ++++++------ source/blender/editors/animation/anim_filter.c | 6 ++-- source/blender/editors/animation/anim_markers.c | 18 ++++++------ source/blender/editors/animation/anim_ops.c | 6 ++-- source/blender/editors/animation/time_scrub_ui.c | 34 +++++++++++----------- 7 files changed, 61 insertions(+), 61 deletions(-) (limited to 'source/blender/editors/animation') diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c index 95165e35fd9..d1fd1ebd06f 100644 --- a/source/blender/editors/animation/anim_channels_defines.c +++ b/source/blender/editors/animation/anim_channels_defines.c @@ -114,7 +114,7 @@ static void acf_generic_root_backdrop(bAnimContext *ac, float ymaxc) { const bAnimChannelType *acf = ANIM_channel_get_typeinfo(ale); - View2D *v2d = &ac->ar->v2d; + View2D *v2d = &ac->region->v2d; short expanded = ANIM_channel_setting_get(ac, ale, ACHANNEL_SETTING_EXPAND) != 0; short offset = (acf->get_offset) ? acf->get_offset(ac, ale) : 0; float color[3]; @@ -145,7 +145,7 @@ static void acf_generic_dataexpand_backdrop(bAnimContext *ac, float ymaxc) { const bAnimChannelType *acf = ANIM_channel_get_typeinfo(ale); - View2D *v2d = &ac->ar->v2d; + View2D *v2d = &ac->region->v2d; short offset = (acf->get_offset) ? acf->get_offset(ac, ale) : 0; float color[3]; @@ -253,7 +253,7 @@ static void acf_generic_channel_backdrop(bAnimContext *ac, float ymaxc) { const bAnimChannelType *acf = ANIM_channel_get_typeinfo(ale); - View2D *v2d = &ac->ar->v2d; + View2D *v2d = &ac->region->v2d; short offset = (acf->get_offset) ? acf->get_offset(ac, ale) : 0; float color[3]; @@ -466,7 +466,7 @@ static void acf_summary_color(bAnimContext *UNUSED(ac), static void acf_summary_backdrop(bAnimContext *ac, bAnimListElem *ale, float yminc, float ymaxc) { const bAnimChannelType *acf = ANIM_channel_get_typeinfo(ale); - View2D *v2d = &ac->ar->v2d; + View2D *v2d = &ac->region->v2d; float color[3]; /* set backdrop drawing color */ @@ -874,7 +874,7 @@ static void acf_group_color(bAnimContext *ac, bAnimListElem *ale, float r_color[ static void acf_group_backdrop(bAnimContext *ac, bAnimListElem *ale, float yminc, float ymaxc) { const bAnimChannelType *acf = ANIM_channel_get_typeinfo(ale); - View2D *v2d = &ac->ar->v2d; + View2D *v2d = &ac->region->v2d; short expanded = ANIM_channel_setting_get(ac, ale, ACHANNEL_SETTING_EXPAND) != 0; short offset = (acf->get_offset) ? acf->get_offset(ac, ale) : 0; float color[3]; @@ -1147,7 +1147,7 @@ static void acf_nla_controls_backdrop(bAnimContext *ac, float ymaxc) { const bAnimChannelType *acf = ANIM_channel_get_typeinfo(ale); - View2D *v2d = &ac->ar->v2d; + View2D *v2d = &ac->region->v2d; short expanded = ANIM_channel_setting_get(ac, ale, ACHANNEL_SETTING_EXPAND) != 0; short offset = (acf->get_offset) ? acf->get_offset(ac, ale) : 0; float color[3]; @@ -3580,7 +3580,7 @@ static void acf_nlaaction_color(bAnimContext *UNUSED(ac), bAnimListElem *ale, fl static void acf_nlaaction_backdrop(bAnimContext *ac, bAnimListElem *ale, float yminc, float ymaxc) { const bAnimChannelType *acf = ANIM_channel_get_typeinfo(ale); - View2D *v2d = &ac->ar->v2d; + View2D *v2d = &ac->region->v2d; AnimData *adt = ale->adt; short offset = (acf->get_offset) ? acf->get_offset(ac, ale) : 0; float color[4]; @@ -4010,7 +4010,7 @@ void ANIM_channel_draw( bAnimContext *ac, bAnimListElem *ale, float yminc, float ymaxc, size_t channel_index) { const bAnimChannelType *acf = ANIM_channel_get_typeinfo(ale); - View2D *v2d = &ac->ar->v2d; + View2D *v2d = &ac->region->v2d; short selected, offset; float y, ymid, ytext; @@ -4741,7 +4741,7 @@ void ANIM_channel_draw_widgets(const bContext *C, size_t channel_index) { const bAnimChannelType *acf = ANIM_channel_get_typeinfo(ale); - View2D *v2d = &ac->ar->v2d; + View2D *v2d = &ac->region->v2d; float ymid; const short channel_height = round_fl_to_int(BLI_rctf_size_y(rect)); const bool is_being_renamed = achannel_is_being_renamed(ac, acf, channel_index); @@ -4871,7 +4871,7 @@ void ANIM_channel_draw_widgets(const bContext *C, */ if (acf->name_prop(ale, &ptr, &prop)) { const short margin_x = 3 * round_fl_to_int(UI_DPI_FAC); - const short width = ac->ar->winx - offset - (margin_x * 2); + const short width = ac->region->winx - offset - (margin_x * 2); uiBut *but; UI_block_emboss_set(block, UI_EMBOSS); @@ -4894,7 +4894,7 @@ void ANIM_channel_draw_widgets(const bContext *C, NULL); /* copy what outliner does here, see outliner_buttons */ - if (UI_but_active_only(C, ac->ar, block, but) == false) { + if (UI_but_active_only(C, ac->region, block, but) == false) { ac->ads->renameIndex = 0; /* send notifiers */ diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c index 0d811ef31e9..20f565990e9 100644 --- a/source/blender/editors/animation/anim_channels_edit.c +++ b/source/blender/editors/animation/anim_channels_edit.c @@ -2553,7 +2553,7 @@ static void box_select_anim_channels(bAnimContext *ac, rcti *rect, short selectm int filter; SpaceNla *snla = (SpaceNla *)ac->sl; - View2D *v2d = &ac->ar->v2d; + View2D *v2d = &ac->region->v2d; rctf rectf; /* convert border-region to view coordinates */ @@ -2736,20 +2736,20 @@ static bool rename_anim_channels(bAnimContext *ac, int channel_index) /* free temp data and tag for refresh */ ANIM_animdata_freelist(&anim_data); - ED_region_tag_redraw(ac->ar); + ED_region_tag_redraw(ac->region); return success; } static int animchannels_channel_get(bAnimContext *ac, const int mval[2]) { - ARegion *ar; + ARegion *region; View2D *v2d; int channel_index; float x, y; /* get useful pointers from animation context data */ - ar = ac->ar; - v2d = &ar->v2d; + region = ac->region; + v2d = ®ion->v2d; /* Figure out which channel user clicked in. */ UI_view2d_region_to_view(v2d, mval[0], mval[1], &x, &y); @@ -3194,7 +3194,7 @@ static int mouse_anim_channels(bContext *C, bAnimContext *ac, int channel_index, static int animchannels_mouseclick_invoke(bContext *C, wmOperator *op, const wmEvent *event) { bAnimContext ac; - ARegion *ar; + ARegion *region; View2D *v2d; int channel_index; int notifierFlags = 0; @@ -3207,8 +3207,8 @@ static int animchannels_mouseclick_invoke(bContext *C, wmOperator *op, const wmE } /* get useful pointers from animation context data */ - ar = ac.ar; - v2d = &ar->v2d; + region = ac.region; + v2d = ®ion->v2d; /* select mode is either replace (deselect all, then add) or add/extend */ if (RNA_boolean_get(op->ptr, "extend")) { @@ -3327,7 +3327,7 @@ static bool select_anim_channel_keys(bAnimContext *ac, int channel_index, bool e } /* free temp data and tag for refresh */ - ED_region_tag_redraw(ac->ar); + ED_region_tag_redraw(ac->region); return success; } diff --git a/source/blender/editors/animation/anim_draw.c b/source/blender/editors/animation/anim_draw.c index 40b2706cc75..abcc2fe5291 100644 --- a/source/blender/editors/animation/anim_draw.c +++ b/source/blender/editors/animation/anim_draw.c @@ -615,9 +615,9 @@ static bool find_prev_next_keyframes(struct bContext *C, int *nextfra, int *prev void ANIM_center_frame(struct bContext *C, int smooth_viewtx) { - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); Scene *scene = CTX_data_scene(C); - float w = BLI_rctf_size_x(&ar->v2d.cur); + float w = BLI_rctf_size_x(®ion->v2d.cur); rctf newrct; int nextfra, prevfra; @@ -626,8 +626,8 @@ void ANIM_center_frame(struct bContext *C, int smooth_viewtx) const float fps = FPS; newrct.xmax = scene->r.cfra + U.view_frame_seconds * fps + 1; newrct.xmin = scene->r.cfra - U.view_frame_seconds * fps - 1; - newrct.ymax = ar->v2d.cur.ymax; - newrct.ymin = ar->v2d.cur.ymin; + newrct.ymax = region->v2d.cur.ymax; + newrct.ymin = region->v2d.cur.ymin; break; } @@ -636,8 +636,8 @@ void ANIM_center_frame(struct bContext *C, int smooth_viewtx) if (find_prev_next_keyframes(C, &nextfra, &prevfra)) { newrct.xmax = nextfra; newrct.xmin = prevfra; - newrct.ymax = ar->v2d.cur.ymax; - newrct.ymin = ar->v2d.cur.ymin; + newrct.ymax = region->v2d.cur.ymax; + newrct.ymin = region->v2d.cur.ymin; break; } /* else drop through, keep range instead */ @@ -647,11 +647,11 @@ void ANIM_center_frame(struct bContext *C, int smooth_viewtx) default: newrct.xmax = scene->r.cfra + (w / 2); newrct.xmin = scene->r.cfra - (w / 2); - newrct.ymax = ar->v2d.cur.ymax; - newrct.ymin = ar->v2d.cur.ymin; + newrct.ymax = region->v2d.cur.ymax; + newrct.ymin = region->v2d.cur.ymin; break; } - UI_view2d_smooth_view(C, ar, &newrct, smooth_viewtx); + UI_view2d_smooth_view(C, region, &newrct, smooth_viewtx); } /* *************************************************** */ diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c index 5a0e60f8d58..dcf0377ffc0 100644 --- a/source/blender/editors/animation/anim_filter.c +++ b/source/blender/editors/animation/anim_filter.c @@ -397,7 +397,7 @@ bool ANIM_animdata_get_context(const bContext *C, bAnimContext *ac) { Main *bmain = CTX_data_main(C); ScrArea *sa = CTX_wm_area(C); - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); SpaceLink *sl = CTX_wm_space_data(C); Scene *scene = CTX_data_scene(C); @@ -416,10 +416,10 @@ bool ANIM_animdata_get_context(const bContext *C, bAnimContext *ac) ac->view_layer = CTX_data_view_layer(C); ac->obact = (ac->view_layer->basact) ? ac->view_layer->basact->object : NULL; ac->sa = sa; - ac->ar = ar; + ac->region = region; ac->sl = sl; ac->spacetype = (sa) ? sa->spacetype : 0; - ac->regiontype = (ar) ? ar->regiontype : 0; + ac->regiontype = (region) ? region->regiontype : 0; /* initialise default y-scale factor */ animedit_get_yscale_factor(ac); diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c index 4f1cab40463..93cb2d1e306 100644 --- a/source/blender/editors/animation/anim_markers.c +++ b/source/blender/editors/animation/anim_markers.c @@ -575,7 +575,7 @@ void ED_markers_draw(const bContext *C, int flag) return; } - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); View2D *v2d = UI_view2d_fromcontext(C); int cfra = CTX_data_scene(C)->r.cfra; @@ -599,14 +599,14 @@ void ED_markers_draw(const bContext *C, int flag) for (TimeMarker *marker = markers->first; marker; marker = marker->next) { if ((marker->flag & SELECT) == 0) { if (marker_is_in_frame_range(marker, clip_frame_range)) { - draw_marker(fstyle, marker, cfra, marker->frame * xscale, flag, ar->winy); + draw_marker(fstyle, marker, cfra, marker->frame * xscale, flag, region->winy); } } } for (TimeMarker *marker = markers->first; marker; marker = marker->next) { if (marker->flag & SELECT) { if (marker_is_in_frame_range(marker, clip_frame_range)) { - draw_marker(fstyle, marker, cfra, marker->frame * xscale, flag, ar->winy); + draw_marker(fstyle, marker, cfra, marker->frame * xscale, flag, region->winy); } } } @@ -870,10 +870,10 @@ static int ed_marker_move_invoke(bContext *C, wmOperator *op, const wmEvent *eve { bool tweak = RNA_boolean_get(op->ptr, "tweak"); if (tweak) { - ARegion *ar = CTX_wm_region(C); - View2D *v2d = &ar->v2d; + ARegion *region = CTX_wm_region(C); + View2D *v2d = ®ion->v2d; ListBase *markers = ED_context_get_markers(C); - if (!region_position_is_over_marker(v2d, markers, event->x - ar->winrct.xmin)) { + if (!region_position_is_over_marker(v2d, markers, event->x - region->winrct.xmin)) { return OPERATOR_CANCELLED | OPERATOR_PASS_THROUGH; } } @@ -1337,11 +1337,11 @@ static void MARKER_OT_select(wmOperatorType *ot) static int ed_marker_box_select_invoke(bContext *C, wmOperator *op, const wmEvent *event) { - ARegion *ar = CTX_wm_region(C); - View2D *v2d = &ar->v2d; + ARegion *region = CTX_wm_region(C); + View2D *v2d = ®ion->v2d; ListBase *markers = ED_context_get_markers(C); - bool over_marker = region_position_is_over_marker(v2d, markers, event->x - ar->winrct.xmin); + bool over_marker = region_position_is_over_marker(v2d, markers, event->x - region->winrct.xmin); bool tweak = RNA_boolean_get(op->ptr, "tweak"); if (tweak && over_marker) { diff --git a/source/blender/editors/animation/anim_ops.c b/source/blender/editors/animation/anim_ops.c index 9e3f91bc971..fb045abe016 100644 --- a/source/blender/editors/animation/anim_ops.c +++ b/source/blender/editors/animation/anim_ops.c @@ -403,7 +403,7 @@ static void ANIM_OT_end_frame_set(wmOperatorType *ot) static int previewrange_define_exec(bContext *C, wmOperator *op) { Scene *scene = CTX_data_scene(C); - ARegion *ar = CTX_wm_region(C); + ARegion *region = CTX_wm_region(C); float sfra, efra; rcti rect; @@ -411,8 +411,8 @@ static int previewrange_define_exec(bContext *C, wmOperator *op) WM_operator_properties_border_to_rcti(op, &rect); /* convert min/max values to frames (i.e. region to 'tot' rect) */ - sfra = UI_view2d_region_to_view_x(&ar->v2d, rect.xmin); - efra = UI_view2d_region_to_view_x(&ar->v2d, rect.xmax); + sfra = UI_view2d_region_to_view_x(®ion->v2d, rect.xmin); + efra = UI_view2d_region_to_view_x(®ion->v2d, rect.xmax); /* set start/end frames for preview-range * - must clamp within allowable limits diff --git a/source/blender/editors/animation/time_scrub_ui.c b/source/blender/editors/animation/time_scrub_ui.c index 84ef28744b3..74c359737b0 100644 --- a/source/blender/editors/animation/time_scrub_ui.c +++ b/source/blender/editors/animation/time_scrub_ui.c @@ -46,11 +46,11 @@ #include "RNA_access.h" -static void get_time_scrub_region_rect(const ARegion *ar, rcti *rect) +static void get_time_scrub_region_rect(const ARegion *region, rcti *rect) { rect->xmin = 0; - rect->xmax = ar->winx; - rect->ymax = ar->winy; + rect->xmax = region->winx; + rect->ymax = region->winy; rect->ymin = rect->ymax - UI_TIME_SCRUB_MARGIN_Y; } @@ -134,18 +134,18 @@ static void draw_current_frame(const Scene *scene, color); } -void ED_time_scrub_draw(const ARegion *ar, +void ED_time_scrub_draw(const ARegion *region, const Scene *scene, bool display_seconds, bool discrete_frames) { - const View2D *v2d = &ar->v2d; + const View2D *v2d = ®ion->v2d; GPU_matrix_push_projection(); - wmOrtho2_region_pixelspace(ar); + wmOrtho2_region_pixelspace(region); rcti scrub_region_rect; - get_time_scrub_region_rect(ar, &scrub_region_rect); + get_time_scrub_region_rect(region, &scrub_region_rect); draw_background(&scrub_region_rect); @@ -153,11 +153,11 @@ void ED_time_scrub_draw(const ARegion *ar, numbers_rect.ymin = get_centered_text_y(&scrub_region_rect) - 4 * UI_DPI_FAC; if (discrete_frames) { UI_view2d_draw_scale_x__discrete_frames_or_seconds( - ar, v2d, &numbers_rect, scene, display_seconds, TH_TEXT); + region, v2d, &numbers_rect, scene, display_seconds, TH_TEXT); } else { UI_view2d_draw_scale_x__frames_or_seconds( - ar, v2d, &numbers_rect, scene, display_seconds, TH_TEXT); + region, v2d, &numbers_rect, scene, display_seconds, TH_TEXT); } draw_current_frame(scene, display_seconds, v2d, &scrub_region_rect, scene->r.cfra); @@ -165,23 +165,23 @@ void ED_time_scrub_draw(const ARegion *ar, GPU_matrix_pop_projection(); } -bool ED_time_scrub_event_in_region(const ARegion *ar, const wmEvent *event) +bool ED_time_scrub_event_in_region(const ARegion *region, const wmEvent *event) { - rcti rect = ar->winrct; + rcti rect = region->winrct; rect.ymin = rect.ymax - UI_TIME_SCRUB_MARGIN_Y; return BLI_rcti_isect_pt(&rect, event->x, event->y); } -void ED_time_scrub_channel_search_draw(const bContext *C, ARegion *ar, bDopeSheet *dopesheet) +void ED_time_scrub_channel_search_draw(const bContext *C, ARegion *region, bDopeSheet *dopesheet) { GPU_matrix_push_projection(); - wmOrtho2_region_pixelspace(ar); + wmOrtho2_region_pixelspace(region); rcti rect; rect.xmin = 0; - rect.xmax = ar->winx; - rect.ymin = ar->winy - UI_TIME_SCRUB_MARGIN_Y; - rect.ymax = ar->winy; + rect.xmax = region->winx; + rect.ymin = region->winy - UI_TIME_SCRUB_MARGIN_Y; + rect.ymax = region->winy; uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -189,7 +189,7 @@ void ED_time_scrub_channel_search_draw(const bContext *C, ARegion *ar, bDopeShee immRectf(pos, rect.xmin, rect.ymin, rect.xmax, rect.ymax); immUnbindProgram(); - uiBlock *block = UI_block_begin(C, ar, __func__, UI_EMBOSS); + uiBlock *block = UI_block_begin(C, region, __func__, UI_EMBOSS); PointerRNA ptr; RNA_pointer_create(&CTX_wm_screen(C)->id, &RNA_DopeSheet, dopesheet, &ptr); -- cgit v1.2.3