diff options
author | Julian Eisel <julian@blender.org> | 2020-04-03 14:25:03 +0300 |
---|---|---|
committer | Julian Eisel <julian@blender.org> | 2020-04-03 14:34:50 +0300 |
commit | 905c0269f302e8e0e7a27dda8d5256fdcd06ce60 (patch) | |
tree | 1c720d4f0069879d5b4c0c9ea8db867106920d4f /source/blender/editors/sculpt_paint | |
parent | 1a69384e76e2b1ab11c87a582eb2cdf26386ac59 (diff) |
Cleanup: Rename ScrArea variables from sa to area
Follow up of b2ee1770d4c3 and 10c2254d412d, part of T74432.
Now the area and region naming conventions should be less confusing.
Mostly a careful batch rename but had to do few smaller fixes.
Also ran clang-format on affected files.
Diffstat (limited to 'source/blender/editors/sculpt_paint')
5 files changed, 33 insertions, 32 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index cbb0ce84156..58a85fdff25 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -764,9 +764,9 @@ void PAINT_OT_image_paint(wmOperatorType *ot) bool get_imapaint_zoom(bContext *C, float *zoomx, float *zoomy) { - ScrArea *sa = CTX_wm_area(C); - if (sa && sa->spacetype == SPACE_IMAGE) { - SpaceImage *sima = sa->spacedata.first; + ScrArea *area = CTX_wm_area(C); + if (area && area->spacetype == SPACE_IMAGE) { + SpaceImage *sima = area->spacedata.first; if (sima->mode == SI_MODE_PAINT) { ARegion *region = CTX_wm_region(C); ED_space_image_get_zoom(sima, region, zoomx, zoomy); @@ -811,9 +811,9 @@ void ED_space_image_paint_update(Main *bmain, wmWindowManager *wm, Scene *scene) for (wmWindow *win = wm->windows.first; win; win = win->next) { bScreen *screen = WM_window_get_active_screen(win); - for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) { - if (sa->spacetype == SPACE_IMAGE) { - if (((SpaceImage *)sa->spacedata.first)->mode == SI_MODE_PAINT) { + for (ScrArea *area = screen->areabase.first; area; area = area->next) { + if (area->spacetype == SPACE_IMAGE) { + if (((SpaceImage *)area->spacedata.first)->mode == SI_MODE_PAINT) { enabled = true; } } @@ -949,9 +949,9 @@ typedef struct { static void sample_color_update_header(SampleColorData *data, bContext *C) { char msg[UI_MAX_DRAW_STR]; - ScrArea *sa = CTX_wm_area(C); + ScrArea *area = CTX_wm_area(C); - if (sa) { + if (area) { BLI_snprintf(msg, sizeof(msg), TIP_("Sample color for %s"), @@ -1184,10 +1184,10 @@ static int texture_paint_toggle_exec(bContext *C, wmOperator *op) if (ima) { for (sc = bmain->screens.first; sc; sc = sc->id.next) { - ScrArea *sa; - for (sa = sc->areabase.first; sa; sa = sa->next) { + ScrArea *area; + for (area = sc->areabase.first; area; area = area->next) { SpaceLink *sl; - for (sl = sa->spacedata.first; sl; sl = sl->next) { + for (sl = area->spacedata.first; sl; sl = sl->next) { if (sl->spacetype == SPACE_IMAGE) { SpaceImage *sima = (SpaceImage *)sl; diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c index 6494e53e182..0b99806109a 100644 --- a/source/blender/editors/sculpt_paint/paint_image_proj.c +++ b/source/blender/editors/sculpt_paint/paint_image_proj.c @@ -6224,13 +6224,13 @@ static int texture_paint_image_from_view_exec(bContext *C, wmOperator *op) int maxsize; char err_out[256] = "unknown"; - ScrArea *sa = BKE_screen_find_big_area(CTX_wm_screen(C), SPACE_VIEW3D, 0); - if (!sa) { + ScrArea *area = BKE_screen_find_big_area(CTX_wm_screen(C), SPACE_VIEW3D, 0); + if (!area) { BKE_report(op->reports, RPT_ERROR, "No 3D viewport found to create image from"); return OPERATOR_CANCELLED; } - ARegion *region = BKE_area_find_region_active_win(sa); + ARegion *region = BKE_area_find_region_active_win(area); if (!region) { BKE_report(op->reports, RPT_ERROR, "No 3D viewport found to create image from"); return OPERATOR_CANCELLED; @@ -6250,7 +6250,7 @@ static int texture_paint_image_from_view_exec(bContext *C, wmOperator *op) /* Create a copy of the overlays where they are all turned off, except the * texture paint overlay opacity */ - View3D *v3d = sa->spacedata.first; + View3D *v3d = area->spacedata.first; View3D v3d_copy = *v3d; v3d_copy.gridflag = 0; v3d_copy.flag2 = 0; diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c b/source/blender/editors/sculpt_paint/paint_stroke.c index 935b9ef9506..e7bc75be45d 100644 --- a/source/blender/editors/sculpt_paint/paint_stroke.c +++ b/source/blender/editors/sculpt_paint/paint_stroke.c @@ -1597,13 +1597,14 @@ bool paint_poll(bContext *C) { Paint *p = BKE_paint_get_active_from_context(C); Object *ob = CTX_data_active_object(C); - ScrArea *sa = CTX_wm_area(C); + ScrArea *area = CTX_wm_area(C); ARegion *region = CTX_wm_region(C); - if (p && ob && BKE_paint_brush(p) && (sa && ELEM(sa->spacetype, SPACE_VIEW3D, SPACE_IMAGE)) && + if (p && ob && BKE_paint_brush(p) && + (area && ELEM(area->spacetype, SPACE_VIEW3D, SPACE_IMAGE)) && (region && region->regiontype == RGN_TYPE_WINDOW)) { /* Check the current tool is a brush. */ - bToolRef *tref = sa->runtime.tool; + bToolRef *tref = area->runtime.tool; if (tref && tref->runtime && tref->runtime->data_block[0]) { return true; } diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index 8934f4d9668..d050a39ce68 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -214,8 +214,8 @@ bool vertex_paint_mode_poll(bContext *C) static bool vertex_paint_poll_ex(bContext *C, bool check_tool) { if (vertex_paint_mode_poll(C) && BKE_paint_brush(&CTX_data_tool_settings(C)->vpaint->paint)) { - ScrArea *sa = CTX_wm_area(C); - if (sa && sa->spacetype == SPACE_VIEW3D) { + ScrArea *area = CTX_wm_area(C); + if (area && area->spacetype == SPACE_VIEW3D) { ARegion *region = CTX_wm_region(C); if (region->regiontype == RGN_TYPE_WINDOW) { if (!check_tool || WM_toolsystem_active_tool_is_brush(C)) { @@ -247,11 +247,11 @@ bool weight_paint_mode_poll(bContext *C) static bool weight_paint_poll_ex(bContext *C, bool check_tool) { Object *ob = CTX_data_active_object(C); - ScrArea *sa; + ScrArea *area; if ((ob != NULL) && (ob->mode & OB_MODE_WEIGHT_PAINT) && (BKE_paint_brush(&CTX_data_tool_settings(C)->wpaint->paint) != NULL) && - (sa = CTX_wm_area(C)) && (sa->spacetype == SPACE_VIEW3D)) { + (area = CTX_wm_area(C)) && (area->spacetype == SPACE_VIEW3D)) { ARegion *region = CTX_wm_region(C); if (ELEM(region->regiontype, RGN_TYPE_WINDOW, RGN_TYPE_HUD)) { if (!check_tool || WM_toolsystem_active_tool_is_brush(C)) { diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index db138bb907d..d30dce666c4 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -7973,8 +7973,8 @@ static void sculpt_flush_update_done(const bContext *C, Object *ob, SculptUpdate for (wmWindow *win = wm->windows.first; win; win = win->next) { bScreen *screen = WM_window_get_active_screen(win); - for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) { - SpaceLink *sl = sa->spacedata.first; + for (ScrArea *area = screen->areabase.first; area; area = area->next) { + SpaceLink *sl = area->spacedata.first; if (sl->spacetype == SPACE_VIEW3D) { View3D *v3d = (View3D *)sl; if (v3d != current_v3d) { @@ -7984,7 +7984,7 @@ static void sculpt_flush_update_done(const bContext *C, Object *ob, SculptUpdate /* Tag all 3D viewports for redraw now that we are done. Others * viewports did not get a full redraw, and anti-aliasing for the * current viewport was deactivated. */ - for (ARegion *region = sa->regionbase.first; region; region = region->next) { + for (ARegion *region = area->regionbase.first; region; region = region->next) { if (region->regiontype == RGN_TYPE_WINDOW) { ED_region_tag_redraw(region); } @@ -9267,16 +9267,16 @@ static int sample_detail(bContext *C, int mx, int my, int mode) { /* Find 3D view to pick from. */ bScreen *screen = CTX_wm_screen(C); - ScrArea *sa = BKE_screen_find_area_xy(screen, SPACE_VIEW3D, mx, my); - ARegion *region = (sa) ? BKE_area_find_region_xy(sa, RGN_TYPE_WINDOW, mx, my) : NULL; + ScrArea *area = BKE_screen_find_area_xy(screen, SPACE_VIEW3D, mx, my); + ARegion *region = (area) ? BKE_area_find_region_xy(area, RGN_TYPE_WINDOW, mx, my) : NULL; if (region == NULL) { return OPERATOR_CANCELLED; } /* Set context to 3D view. */ - ScrArea *prev_sa = CTX_wm_area(C); + ScrArea *prev_area = CTX_wm_area(C); ARegion *prev_region = CTX_wm_region(C); - CTX_wm_area_set(C, sa); + CTX_wm_area_set(C, area); CTX_wm_region_set(C, region); Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); @@ -9294,7 +9294,7 @@ static int sample_detail(bContext *C, int mx, int my, int mode) switch (mode) { case SAMPLE_DETAIL_DYNTOPO: if (BKE_pbvh_type(ss->pbvh) != PBVH_BMESH) { - CTX_wm_area_set(C, prev_sa); + CTX_wm_area_set(C, prev_area); CTX_wm_region_set(C, prev_region); return OPERATOR_CANCELLED; } @@ -9302,7 +9302,7 @@ static int sample_detail(bContext *C, int mx, int my, int mode) break; case SAMPLE_DETAIL_VOXEL: if (BKE_pbvh_type(ss->pbvh) != PBVH_FACES) { - CTX_wm_area_set(C, prev_sa); + CTX_wm_area_set(C, prev_area); CTX_wm_region_set(C, prev_region); return OPERATOR_CANCELLED; } @@ -9311,7 +9311,7 @@ static int sample_detail(bContext *C, int mx, int my, int mode) } /* Restore context. */ - CTX_wm_area_set(C, prev_sa); + CTX_wm_area_set(C, prev_area); CTX_wm_region_set(C, prev_region); return OPERATOR_FINISHED; |