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/render | |
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/render')
-rw-r--r-- | source/blender/editors/render/render_internal.c | 52 | ||||
-rw-r--r-- | source/blender/editors/render/render_preview.c | 20 | ||||
-rw-r--r-- | source/blender/editors/render/render_shading.c | 12 | ||||
-rw-r--r-- | source/blender/editors/render/render_update.c | 28 | ||||
-rw-r--r-- | source/blender/editors/render/render_view.c | 114 |
5 files changed, 113 insertions, 113 deletions
diff --git a/source/blender/editors/render/render_internal.c b/source/blender/editors/render/render_internal.c index 8a8fd703845..3d87220979b 100644 --- a/source/blender/editors/render/render_internal.c +++ b/source/blender/editors/render/render_internal.c @@ -112,7 +112,7 @@ typedef struct RenderJob { ReportList *reports; int orig_layer; int last_layer; - ScrArea *sa; + ScrArea *area; ColorManagedViewSettings view_settings; ColorManagedDisplaySettings display_settings; bool supports_glsl_draw; @@ -543,24 +543,24 @@ static void render_progress_update(void *rjv, float progress) static void render_image_update_pass_and_layer(RenderJob *rj, RenderResult *rr, ImageUser *iuser) { wmWindowManager *wm; - ScrArea *first_sa = NULL, *matched_sa = NULL; + ScrArea *first_area = NULL, *matched_area = NULL; /* image window, compo node users */ - for (wm = rj->main->wm.first; wm && matched_sa == NULL; wm = wm->id.next) { /* only 1 wm */ + for (wm = rj->main->wm.first; wm && matched_area == NULL; wm = wm->id.next) { /* only 1 wm */ wmWindow *win; - for (win = wm->windows.first; win && matched_sa == NULL; win = win->next) { + for (win = wm->windows.first; win && matched_area == NULL; win = win->next) { const bScreen *screen = WM_window_get_active_screen(win); - for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) { - if (sa->spacetype == SPACE_IMAGE) { - SpaceImage *sima = sa->spacedata.first; - // sa->spacedata might be empty when toggling fullscreen mode. + for (ScrArea *area = screen->areabase.first; area; area = area->next) { + if (area->spacetype == SPACE_IMAGE) { + SpaceImage *sima = area->spacedata.first; + // area->spacedata might be empty when toggling fullscreen mode. if (sima != NULL && sima->image == rj->image) { - if (first_sa == NULL) { - first_sa = sa; + if (first_area == NULL) { + first_area = area; } - if (sa == rj->sa) { - matched_sa = sa; + if (area == rj->area) { + matched_area = area; break; } } @@ -569,12 +569,12 @@ static void render_image_update_pass_and_layer(RenderJob *rj, RenderResult *rr, } } - if (matched_sa == NULL) { - matched_sa = first_sa; + if (matched_area == NULL) { + matched_area = first_area; } - if (matched_sa) { - SpaceImage *sima = matched_sa->spacedata.first; + if (matched_area) { + SpaceImage *sima = matched_area->spacedata.first; RenderResult *main_rr = RE_AcquireResultRead(rj->re); /* TODO(sergey): is there faster way to get the layer index? */ @@ -689,10 +689,10 @@ static void render_image_restore_layer(RenderJob *rj) for (win = wm->windows.first; win; win = win->next) { const bScreen *screen = WM_window_get_active_screen(win); - for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) { - if (sa == rj->sa) { - if (sa->spacetype == SPACE_IMAGE) { - SpaceImage *sima = sa->spacedata.first; + for (ScrArea *area = screen->areabase.first; area; area = area->next) { + if (area == rj->area) { + if (area->spacetype == SPACE_IMAGE) { + SpaceImage *sima = area->spacedata.first; if (RE_HasSingleLayer(rj->re)) { /* For single layer renders keep the active layer @@ -748,7 +748,7 @@ static void render_endjob(void *rjv) WM_main_add_notifier(NC_NODE | NA_EDITED, rj->scene); } - if (rj->sa) { + if (rj->area) { render_image_restore_layer(rj); } @@ -920,7 +920,7 @@ static int screen_render_invoke(bContext *C, wmOperator *op, const wmEvent *even View3D *v3d = use_viewport ? CTX_wm_view3d(C) : NULL; struct Object *camera_override = v3d ? V3D_CAMERA_LOCAL(v3d) : NULL; const char *name; - ScrArea *sa; + ScrArea *area; /* Cannot do render if there is not this function. */ if (re_type->render == NULL) { @@ -970,7 +970,7 @@ static int screen_render_invoke(bContext *C, wmOperator *op, const wmEvent *even // store spare /* ensure at least 1 area shows result */ - sa = render_view_open(C, event->x, event->y, op->reports); + area = render_view_open(C, event->x, event->y, op->reports); /* job custom data */ rj = MEM_callocN(sizeof(RenderJob), "render job"); @@ -991,14 +991,14 @@ static int screen_render_invoke(bContext *C, wmOperator *op, const wmEvent *even rj->reports = op->reports; rj->orig_layer = 0; rj->last_layer = 0; - rj->sa = sa; + rj->area = area; rj->supports_glsl_draw = IMB_colormanagement_support_glsl_draw(&scene->view_settings); BKE_color_managed_display_settings_copy(&rj->display_settings, &scene->display_settings); BKE_color_managed_view_settings_copy(&rj->view_settings, &scene->view_settings); - if (sa) { - SpaceImage *sima = sa->spacedata.first; + if (area) { + SpaceImage *sima = area->spacedata.first; rj->orig_layer = sima->iuser.layer; } diff --git a/source/blender/editors/render/render_preview.c b/source/blender/editors/render/render_preview.c index fc22e3cd3e0..2c508472a9c 100644 --- a/source/blender/editors/render/render_preview.c +++ b/source/blender/editors/render/render_preview.c @@ -566,7 +566,7 @@ static Scene *preview_prepare_scene( /* new UI convention: draw is in pixel space already. */ /* uses UI_BTYPE_ROUNDBOX button in block to get the rect */ -static bool ed_preview_draw_rect(ScrArea *sa, int split, int first, rcti *rect, rcti *newrect) +static bool ed_preview_draw_rect(ScrArea *area, int split, int first, rcti *rect, rcti *newrect) { Render *re; RenderView *rv; @@ -578,10 +578,10 @@ static bool ed_preview_draw_rect(ScrArea *sa, int split, int first, rcti *rect, bool ok = false; if (!split || first) { - sprintf(name, "Preview %p", (void *)sa); + sprintf(name, "Preview %p", (void *)area); } else { - sprintf(name, "SecondPreview %p", (void *)sa); + sprintf(name, "SecondPreview %p", (void *)area); } if (split) { @@ -661,12 +661,12 @@ void ED_preview_draw(const bContext *C, void *idp, void *parentp, void *slotp, r { if (idp) { wmWindowManager *wm = CTX_wm_manager(C); - ScrArea *sa = CTX_wm_area(C); + ScrArea *area = CTX_wm_area(C); ID *id = (ID *)idp; ID *parent = (ID *)parentp; MTex *slot = (MTex *)slotp; SpaceProperties *sbuts = CTX_wm_space_properties(C); - ShaderPreview *sp = WM_jobs_customdata(wm, sa); + ShaderPreview *sp = WM_jobs_customdata(wm, area); rcti newrect; int ok; int newx = BLI_rcti_size_x(rect); @@ -678,11 +678,11 @@ void ED_preview_draw(const bContext *C, void *idp, void *parentp, void *slotp, r newrect.ymax = rect->ymin; if (parent) { - ok = ed_preview_draw_rect(sa, 1, 1, rect, &newrect); - ok &= ed_preview_draw_rect(sa, 1, 0, rect, &newrect); + ok = ed_preview_draw_rect(area, 1, 1, rect, &newrect); + ok &= ed_preview_draw_rect(area, 1, 0, rect, &newrect); } else { - ok = ed_preview_draw_rect(sa, 0, 0, rect, &newrect); + ok = ed_preview_draw_rect(area, 0, 0, rect, &newrect); } if (ok) { @@ -693,12 +693,12 @@ void ED_preview_draw(const bContext *C, void *idp, void *parentp, void *slotp, r * if no render result was found and no preview render job is running, * or if the job is running and the size of preview changed */ if ((sbuts != NULL && sbuts->preview) || - (!ok && !WM_jobs_test(wm, sa, WM_JOB_TYPE_RENDER_PREVIEW)) || + (!ok && !WM_jobs_test(wm, area, WM_JOB_TYPE_RENDER_PREVIEW)) || (sp && (abs(sp->sizex - newx) >= 2 || abs(sp->sizey - newy) > 2))) { if (sbuts != NULL) { sbuts->preview = 0; } - ED_preview_shader_job(C, sa, id, parent, slot, newx, newy, PR_BUTS_RENDER); + ED_preview_shader_job(C, area, id, parent, slot, newx, newy, PR_BUTS_RENDER); } } } diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c index a0dfa54f8f5..99d9d585a30 100644 --- a/source/blender/editors/render/render_shading.c +++ b/source/blender/editors/render/render_shading.c @@ -100,15 +100,15 @@ */ static Object **object_array_for_shading(bContext *C, uint *r_objects_len) { - ScrArea *sa = CTX_wm_area(C); + ScrArea *area = CTX_wm_area(C); SpaceProperties *sbuts = NULL; View3D *v3d = NULL; - if (sa != NULL) { - if (sa->spacetype == SPACE_PROPERTIES) { - sbuts = sa->spacedata.first; + if (area != NULL) { + if (area->spacetype == SPACE_PROPERTIES) { + sbuts = area->spacedata.first; } - else if (sa->spacetype == SPACE_VIEW3D) { - v3d = sa->spacedata.first; + else if (area->spacetype == SPACE_VIEW3D) { + v3d = area->spacedata.first; } } diff --git a/source/blender/editors/render/render_update.c b/source/blender/editors/render/render_update.c index d2bb53de06f..56b7e2a771d 100644 --- a/source/blender/editors/render/render_update.c +++ b/source/blender/editors/render/render_update.c @@ -106,17 +106,17 @@ void ED_render_scene_update(const DEGEditorUpdateContext *update_ctx, int update for (win = wm->windows.first; win; win = win->next) { bScreen *sc = WM_window_get_active_screen(win); - ScrArea *sa; + ScrArea *area; ARegion *region; CTX_wm_window_set(C, win); - for (sa = sc->areabase.first; sa; sa = sa->next) { - if (sa->spacetype != SPACE_VIEW3D) { + for (area = sc->areabase.first; area; area = area->next) { + if (area->spacetype != SPACE_VIEW3D) { continue; } - View3D *v3d = sa->spacedata.first; - for (region = sa->regionbase.first; region; region = region->next) { + View3D *v3d = area->spacedata.first; + for (region = area->regionbase.first; region; region = region->next) { if (region->regiontype != RGN_TYPE_WINDOW) { continue; } @@ -128,7 +128,7 @@ void ED_render_scene_update(const DEGEditorUpdateContext *update_ctx, int update if (engine && (updated || (engine->flag & RE_ENGINE_DO_UPDATE))) { CTX_wm_screen_set(C, sc); - CTX_wm_area_set(C, sa); + CTX_wm_area_set(C, area); CTX_wm_region_set(C, region); engine->flag &= ~RE_ENGINE_DO_UPDATE; @@ -146,7 +146,7 @@ void ED_render_scene_update(const DEGEditorUpdateContext *update_ctx, int update .scene = scene, .view_layer = view_layer, .region = region, - .v3d = (View3D *)sa->spacedata.first, + .v3d = (View3D *)area->spacedata.first, .engine_type = engine_type, })); } @@ -160,17 +160,17 @@ void ED_render_scene_update(const DEGEditorUpdateContext *update_ctx, int update recursive_check = false; } -void ED_render_engine_area_exit(Main *bmain, ScrArea *sa) +void ED_render_engine_area_exit(Main *bmain, ScrArea *area) { /* clear all render engines in this area */ ARegion *region; wmWindowManager *wm = bmain->wm.first; - if (sa->spacetype != SPACE_VIEW3D) { + if (area->spacetype != SPACE_VIEW3D) { return; } - for (region = sa->regionbase.first; region; region = region->next) { + for (region = area->regionbase.first; region; region = region->next) { if (region->regiontype != RGN_TYPE_WINDOW || !(region->regiondata)) { continue; } @@ -182,8 +182,8 @@ void ED_render_engine_changed(Main *bmain) { /* on changing the render engine type, clear all running render engines */ for (bScreen *sc = bmain->screens.first; sc; sc = sc->id.next) { - for (ScrArea *sa = sc->areabase.first; sa; sa = sa->next) { - ED_render_engine_area_exit(bmain, sa); + for (ScrArea *area = sc->areabase.first; area; area = area->next) { + ED_render_engine_area_exit(bmain, area); } } RE_FreePersistentData(); @@ -206,8 +206,8 @@ void ED_render_engine_changed(Main *bmain) void ED_render_view_layer_changed(Main *bmain, bScreen *sc) { - for (ScrArea *sa = sc->areabase.first; sa; sa = sa->next) { - ED_render_engine_area_exit(bmain, sa); + for (ScrArea *area = sc->areabase.first; area; area = area->next) { + ED_render_engine_area_exit(bmain, area); } } diff --git a/source/blender/editors/render/render_view.c b/source/blender/editors/render/render_view.c index a93ea343229..c0d35938787 100644 --- a/source/blender/editors/render/render_view.c +++ b/source/blender/editors/render/render_view.c @@ -57,22 +57,22 @@ static ScrArea *biggest_non_image_area(bContext *C) { bScreen *sc = CTX_wm_screen(C); - ScrArea *sa, *big = NULL; + ScrArea *area, *big = NULL; int size, maxsize = 0, bwmaxsize = 0; short foundwin = 0; - for (sa = sc->areabase.first; sa; sa = sa->next) { - if (sa->winx > 30 && sa->winy > 30) { - size = sa->winx * sa->winy; - if (!sa->full && sa->spacetype == SPACE_PROPERTIES) { + for (area = sc->areabase.first; area; area = area->next) { + if (area->winx > 30 && area->winy > 30) { + size = area->winx * area->winy; + if (!area->full && area->spacetype == SPACE_PROPERTIES) { if (foundwin == 0 && size > bwmaxsize) { bwmaxsize = size; - big = sa; + big = area; } } - else if (sa->spacetype != SPACE_IMAGE && size > maxsize) { + else if (area->spacetype != SPACE_IMAGE && size > maxsize) { maxsize = size; - big = sa; + big = area; foundwin = 1; } } @@ -84,7 +84,7 @@ static ScrArea *biggest_non_image_area(bContext *C) static ScrArea *find_area_showing_r_result(bContext *C, Scene *scene, wmWindow **win) { wmWindowManager *wm = CTX_wm_manager(C); - ScrArea *sa = NULL; + ScrArea *area = NULL; SpaceImage *sima; /* find an imagewindow showing render result */ @@ -92,40 +92,40 @@ static ScrArea *find_area_showing_r_result(bContext *C, Scene *scene, wmWindow * if (WM_window_get_active_scene(*win) == scene) { const bScreen *screen = WM_window_get_active_screen(*win); - for (sa = screen->areabase.first; sa; sa = sa->next) { - if (sa->spacetype == SPACE_IMAGE) { - sima = sa->spacedata.first; + for (area = screen->areabase.first; area; area = area->next) { + if (area->spacetype == SPACE_IMAGE) { + sima = area->spacedata.first; if (sima->image && sima->image->type == IMA_TYPE_R_RESULT) { break; } } } - if (sa) { + if (area) { break; } } } - return sa; + return area; } static ScrArea *find_area_image_empty(bContext *C) { bScreen *sc = CTX_wm_screen(C); - ScrArea *sa; + ScrArea *area; SpaceImage *sima; /* find an imagewindow showing render result */ - for (sa = sc->areabase.first; sa; sa = sa->next) { - if (sa->spacetype == SPACE_IMAGE) { - sima = sa->spacedata.first; + for (area = sc->areabase.first; area; area = area->next) { + if (area->spacetype == SPACE_IMAGE) { + sima = area->spacedata.first; if ((sima->mode == SI_MODE_VIEW) && !sima->image) { break; } } } - return sa; + return area; } /********************** open image editor for render *************************/ @@ -136,7 +136,7 @@ ScrArea *render_view_open(bContext *C, int mx, int my, ReportList *reports) Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); wmWindow *win = NULL; - ScrArea *sa = NULL; + ScrArea *area = NULL; SpaceImage *sima; bool area_was_image = false; @@ -163,34 +163,34 @@ ScrArea *render_view_open(bContext *C, int mx, int my, ReportList *reports) return NULL; } - sa = CTX_wm_area(C); - if (BLI_listbase_is_single(&sa->spacedata) == false) { - sima = sa->spacedata.first; + area = CTX_wm_area(C); + if (BLI_listbase_is_single(&area->spacedata) == false) { + sima = area->spacedata.first; sima->flag |= SI_PREVSPACE; } } else if (U.render_display_type == USER_RENDER_DISPLAY_SCREEN) { - sa = CTX_wm_area(C); + area = CTX_wm_area(C); /* if the active screen is already in fullscreen mode, skip this and * unset the area, so that the fullscreen area is just changed later */ - if (sa && sa->full) { - sa = NULL; + if (area && area->full) { + area = NULL; } else { - if (sa && sa->spacetype == SPACE_IMAGE) { + if (area && area->spacetype == SPACE_IMAGE) { area_was_image = true; } /* this function returns with changed context */ - sa = ED_screen_full_newspace(C, sa, SPACE_IMAGE); + area = ED_screen_full_newspace(C, area, SPACE_IMAGE); } } - if (!sa) { - sa = find_area_showing_r_result(C, scene, &win); - if (sa == NULL) { - sa = find_area_image_empty(C); + if (!area) { + area = find_area_showing_r_result(C, scene, &win); + if (area == NULL) { + area = find_area_image_empty(C); } /* if area found in other window, we make that one show in front */ @@ -198,27 +198,27 @@ ScrArea *render_view_open(bContext *C, int mx, int my, ReportList *reports) wm_window_raise(win); } - if (sa == NULL) { + if (area == NULL) { /* find largest open non-image area */ - sa = biggest_non_image_area(C); - if (sa) { - ED_area_newspace(C, sa, SPACE_IMAGE, true); - sima = sa->spacedata.first; + area = biggest_non_image_area(C); + if (area) { + ED_area_newspace(C, area, SPACE_IMAGE, true); + sima = area->spacedata.first; /* makes ESC go back to prev space */ sima->flag |= SI_PREVSPACE; /* we already had a fullscreen here -> mark new space as a stacked fullscreen */ - if (sa->full) { - sa->flag |= AREA_FLAG_STACKED_FULLSCREEN; + if (area->full) { + area->flag |= AREA_FLAG_STACKED_FULLSCREEN; } } else { /* use any area of decent size */ - sa = BKE_screen_find_big_area(CTX_wm_screen(C), SPACE_TYPE_ANY, 0); - if (sa->spacetype != SPACE_IMAGE) { - // XXX newspace(sa, SPACE_IMAGE); - sima = sa->spacedata.first; + area = BKE_screen_find_big_area(CTX_wm_screen(C), SPACE_TYPE_ANY, 0); + if (area->spacetype != SPACE_IMAGE) { + // XXX newspace(area, SPACE_IMAGE); + sima = area->spacedata.first; /* makes ESC go back to prev space */ sima->flag |= SI_PREVSPACE; @@ -226,7 +226,7 @@ ScrArea *render_view_open(bContext *C, int mx, int my, ReportList *reports) } } } - sima = sa->spacedata.first; + sima = area->spacedata.first; sima->link_flag |= SPACE_FLAG_TYPE_TEMPORARY; /* get the correct image, and scale it */ @@ -234,7 +234,7 @@ ScrArea *render_view_open(bContext *C, int mx, int my, ReportList *reports) /* If we're rendering to full screen, set appropriate hints on image editor * so it can restore properly on pressing escape. */ - if (sa->full) { + if (area->full) { sima->flag |= SI_FULLWINDOW; /* Tell the image editor to revert to previous space in space list on close @@ -253,7 +253,7 @@ ScrArea *render_view_open(bContext *C, int mx, int my, ReportList *reports) old_sl->link_flag |= SPACE_FLAG_TYPE_WAS_ACTIVE; } - return sa; + return area; } /*************************** cancel render viewer **********************/ @@ -261,11 +261,11 @@ ScrArea *render_view_open(bContext *C, int mx, int my, ReportList *reports) static int render_view_cancel_exec(bContext *C, wmOperator *UNUSED(op)) { wmWindow *win = CTX_wm_window(C); - ScrArea *sa = CTX_wm_area(C); - SpaceImage *sima = sa->spacedata.first; + ScrArea *area = CTX_wm_area(C); + SpaceImage *sima = area->spacedata.first; /* ensure image editor fullscreen and area fullscreen states are in sync */ - if ((sima->flag & SI_FULLWINDOW) && !sa->full) { + if ((sima->flag & SI_FULLWINDOW) && !area->full) { sima->flag &= ~SI_FULLWINDOW; } @@ -275,17 +275,17 @@ static int render_view_cancel_exec(bContext *C, wmOperator *UNUSED(op)) if (sima->flag & SI_FULLWINDOW) { sima->flag &= ~SI_FULLWINDOW; - ED_screen_full_prevspace(C, sa); + ED_screen_full_prevspace(C, area); } else { - ED_area_prevspace(C, sa); + ED_area_prevspace(C, area); } return OPERATOR_FINISHED; } else if (sima->flag & SI_FULLWINDOW) { sima->flag &= ~SI_FULLWINDOW; - ED_screen_state_toggle(C, win, sa, SCREENMAXIMIZED); + ED_screen_state_toggle(C, win, area, SCREENMAXIMIZED); return OPERATOR_FINISHED; } else if (WM_window_is_temp_screen(win)) { @@ -320,7 +320,7 @@ static int render_view_show_invoke(bContext *C, wmOperator *op, const wmEvent *e } else { wmWindow *win, *winshow; - ScrArea *sa = find_area_showing_r_result(C, CTX_data_scene(C), &winshow); + ScrArea *area = find_area_showing_r_result(C, CTX_data_scene(C), &winshow); /* is there another window on current scene showing result? */ for (win = CTX_wm_manager(C)->windows.first; win; win = win->next) { @@ -335,20 +335,20 @@ static int render_view_show_invoke(bContext *C, wmOperator *op, const wmEvent *e } /* determine if render already shows */ - if (sa) { + if (area) { /* but don't close it when rendering */ if (G.is_rendering == false) { - SpaceImage *sima = sa->spacedata.first; + SpaceImage *sima = area->spacedata.first; if (sima->flag & SI_PREVSPACE) { sima->flag &= ~SI_PREVSPACE; if (sima->flag & SI_FULLWINDOW) { sima->flag &= ~SI_FULLWINDOW; - ED_screen_full_prevspace(C, sa); + ED_screen_full_prevspace(C, area); } else { - ED_area_prevspace(C, sa); + ED_area_prevspace(C, area); } } } |