diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2017-11-16 18:39:25 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2017-11-22 12:13:33 +0300 |
commit | 3a95bdfc65d883e7db006fdaadb8ed2cd6553239 (patch) | |
tree | 387e3827da8ed17ae655618f8cfaa3ffa565b4cc /source/blender/render/intern | |
parent | 8ba6103e66b0e8bcbe70e6ed8f91500fdc7df3ee (diff) |
SceneRenderLayer Removal/Refactor
This patch moves all the functionality previously in SceneRenderLayer to SceneLayer.
If we want to rename some of these structs now would be a good time to do it, before they are in SceneLayer.
Everything should be working, though I will test things further tomorrow. Once this is committed depsgraph can get
rid of the workaround added in rna_Main_meshes_new_from_object and finish whatever this patch was preventing from being finished.
This patch also adds a few placeholders for the overrides (samples, ...). These are obviously not working, so some unittests that rely on 'lay', and 'zmask' will fail.
This patch does not addressed the change of moving samples to ViewRender (I have this as a separate patch and needs some separate discussion).
Following next is the individual note of the individual parts that were committed.
Note 1: It is up to Cycles to still get rid of exclude_layer internally.
Note 2: Cycles still need to handle its own doversion for the use_layer_samples cases and
(1) Remove the override as it is
(2) Add a new override (scene.cycles.samples) if scene.cycles.use_layer_samples != IGNORE
Respecting the expected behaviour when scene.cycles.use_layer_samples == BOUNDED.
Note 3: Cycles still need to implement the per-object holdout
(similar to how we do shadow catcher).
Note 4: There are parts of the old (Blender Internal) rendering pipeline that is still
using lay, e.g., in shi->lay.
Honestly it will be easier to purge the entire Blender Internal code away instead of taking things from it bit by bit.
Reviewers: sergey, campbellbarton, brecht
Differential Revision: https://developer.blender.org/D2919
Diffstat (limited to 'source/blender/render/intern')
9 files changed, 110 insertions, 102 deletions
diff --git a/source/blender/render/intern/include/render_types.h b/source/blender/render/intern/include/render_types.h index ec5bb2c9376..8f572c34f3d 100644 --- a/source/blender/render/intern/include/render_types.h +++ b/source/blender/render/intern/include/render_types.h @@ -192,6 +192,8 @@ struct Render { struct Main *main; Scene *scene; RenderData r; + ListBase render_layers; + int active_layer; World wrld; ViewRender view_render; struct Object *camera_override; diff --git a/source/blender/render/intern/include/rendercore.h b/source/blender/render/intern/include/rendercore.h index f4c4a50ac27..14c3d798e4f 100644 --- a/source/blender/render/intern/include/rendercore.h +++ b/source/blender/render/intern/include/rendercore.h @@ -83,7 +83,7 @@ void zbufshade_sss_tile(struct RenderPart *pa); int get_sample_layers(struct RenderPart *pa, struct RenderLayer *rl, struct RenderLayer **rlpp); -void render_internal_update_passes(struct RenderEngine *engine, struct Scene *scene, struct SceneRenderLayer *srl); +void render_internal_update_passes(struct RenderEngine *engine, struct Scene *scene, struct SceneLayer *scene_layer); /* -------- ray.c ------- */ diff --git a/source/blender/render/intern/include/renderpipeline.h b/source/blender/render/intern/include/renderpipeline.h index 44df2726847..8c23eb0d4cb 100644 --- a/source/blender/render/intern/include/renderpipeline.h +++ b/source/blender/render/intern/include/renderpipeline.h @@ -33,6 +33,7 @@ #ifndef __RENDERPIPELINE_H__ #define __RENDERPIPELINE_H__ +struct ListBase; struct Render; struct RenderData; struct RenderLayer; @@ -41,7 +42,7 @@ struct ViewRender; struct RenderLayer *render_get_active_layer(struct Render *re, struct RenderResult *rr); float panorama_pixel_rot(struct Render *re); -void render_update_anim_renderdata(struct Render *re, struct RenderData *rd); +void render_update_anim_renderdata(struct Render *re, struct RenderData *rd, struct ListBase *render_layers); void render_copy_renderdata(struct RenderData *to, struct RenderData *from); void render_copy_viewrender(struct ViewRender *to, struct ViewRender *from); diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c index 8b91b970845..496349e4ca6 100644 --- a/source/blender/render/intern/source/convertblender.c +++ b/source/blender/render/intern/source/convertblender.c @@ -5203,7 +5203,7 @@ void RE_Database_FromScene(Render *re, Main *bmain, Scene *scene, unsigned int l /* applies changes fully */ if ((re->r.scemode & (R_NO_FRAME_UPDATE|R_BUTS_PREVIEW|R_VIEWPORT_PREVIEW))==0) { BKE_scene_graph_update_for_newframe(re->eval_ctx, re->depsgraph, re->main, re->scene, NULL); - render_update_anim_renderdata(re, &re->scene->r); + render_update_anim_renderdata(re, &re->scene->r, &re->scene->render_layers); } /* if no camera, viewmat should have been set! */ diff --git a/source/blender/render/intern/source/envmap.c b/source/blender/render/intern/source/envmap.c index 1aab70c0fb9..c873de064eb 100644 --- a/source/blender/render/intern/source/envmap.c +++ b/source/blender/render/intern/source/envmap.c @@ -143,7 +143,7 @@ static Render *envmap_render_copy(Render *re, EnvMap *env) /* set up renderdata */ envre->r.mode &= ~(R_BORDER | R_PANORAMA | R_ORTHO | R_MBLUR); - BLI_freelistN(&envre->r.layers); + BLI_freelistN(&envre->render_layers); BLI_freelistN(&envre->r.views); envre->r.filtertype = 0; envre->r.tilex = envre->r.xsch / 2; @@ -151,7 +151,7 @@ static Render *envmap_render_copy(Render *re, EnvMap *env) envre->r.size = 100; envre->r.yasp = envre->r.xasp = 1; - RE_InitState(envre, NULL, &envre->r, &envre->view_render, NULL, cuberes, cuberes, NULL); + RE_InitState(envre, NULL, &envre->r, &re->render_layers, re->active_layer, &envre->view_render, NULL, cuberes, cuberes, NULL); envre->main = re->main; envre->scene = re->scene; /* unsure about this... */ envre->scene_color_manage = re->scene_color_manage; diff --git a/source/blender/render/intern/source/external_engine.c b/source/blender/render/intern/source/external_engine.c index 61f59eace89..160f999f4e7 100644 --- a/source/blender/render/intern/source/external_engine.c +++ b/source/blender/render/intern/source/external_engine.c @@ -658,7 +658,7 @@ int RE_engine_render(Render *re, int do_all) * creating the render result */ if ((re->r.scemode & (R_NO_FRAME_UPDATE | R_BUTS_PREVIEW)) == 0) { BKE_scene_graph_update_for_newframe(re->eval_ctx, re->depsgraph, re->main, re->scene, NULL); - render_update_anim_renderdata(re, &re->scene->r); + render_update_anim_renderdata(re, &re->scene->r, &re->scene->render_layers); } /* create render result */ @@ -777,12 +777,12 @@ int RE_engine_render(Render *re, int do_all) return 1; } -void RE_engine_register_pass(struct RenderEngine *engine, struct Scene *scene, struct SceneRenderLayer *srl, +void RE_engine_register_pass(struct RenderEngine *engine, struct Scene *scene, struct SceneLayer *scene_layer, const char *name, int UNUSED(channels), const char *UNUSED(chanid), int type) { /* The channel information is currently not used, but is part of the API in case it's needed in the future. */ - if (!(scene && srl && engine)) { + if (!(scene && scene_layer && engine)) { return; } @@ -792,7 +792,7 @@ void RE_engine_register_pass(struct RenderEngine *engine, struct Scene *scene, s Scene *sce; for (sce = G.main->scene.first; sce; sce = sce->id.next) { if (sce->nodetree) { - ntreeCompositRegisterPass(sce->nodetree, scene, srl, name, type); + ntreeCompositRegisterPass(sce->nodetree, scene, scene_layer, name, type); } } } diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c index 951a66cadeb..ed74696ba78 100644 --- a/source/blender/render/intern/source/pipeline.c +++ b/source/blender/render/intern/source/pipeline.c @@ -264,7 +264,7 @@ RenderResult *RE_MultilayerConvert(void *exrhandle, const char *colorspace, bool RenderLayer *render_get_active_layer(Render *re, RenderResult *rr) { - RenderLayer *rl = BLI_findlink(&rr->layers, re->r.actlay); + RenderLayer *rl = BLI_findlink(&rr->layers, re->active_layer); if (rl) return rl; @@ -274,21 +274,21 @@ RenderLayer *render_get_active_layer(Render *re, RenderResult *rr) static int render_scene_needs_vector(Render *re) { - SceneRenderLayer *srl; - - for (srl = re->r.layers.first; srl; srl = srl->next) - if (!(srl->layflag & SCE_LAY_DISABLE)) - if (srl->passflag & SCE_PASS_VECTOR) + SceneLayer *scene_layer; + for (scene_layer = re->render_layers.first; scene_layer; scene_layer = scene_layer->next) + if (scene_layer->flag & SCENE_LAYER_RENDER) { + if (scene_layer->passflag & SCE_PASS_VECTOR) { return 1; - + } + } return 0; } static bool render_scene_has_layers_to_render(Scene *scene) { - SceneRenderLayer *srl; - for (srl = scene->r.layers.first; srl; srl = srl->next) { - if (!(srl->layflag & SCE_LAY_DISABLE)) { + SceneLayer *scene_layer; + for (scene_layer = scene->render_layers.first; scene_layer; scene_layer = scene_layer->next) { + if (scene_layer->flag & SCENE_LAYER_RENDER) { return true; } } @@ -584,7 +584,7 @@ void RE_FreeRender(Render *re) BLI_rw_mutex_end(&re->resultmutex); BLI_rw_mutex_end(&re->partsmutex); - BLI_freelistN(&re->r.layers); + BLI_freelistN(&re->render_layers); BLI_freelistN(&re->r.views); curvemapping_free_data(&re->r.mblur_shutter_curve); @@ -730,13 +730,11 @@ static void re_init_resolution(Render *re, Render *source, void render_copy_renderdata(RenderData *to, RenderData *from) { - BLI_freelistN(&to->layers); BLI_freelistN(&to->views); curvemapping_free_data(&to->mblur_shutter_curve); *to = *from; - BLI_duplicatelist(&to->layers, &from->layers); BLI_duplicatelist(&to->views, &from->views); curvemapping_copy_data(&to->mblur_shutter_curve, &from->mblur_shutter_curve); } @@ -749,7 +747,8 @@ void render_copy_viewrender(ViewRender *to, ViewRender *from) /* what doesn't change during entire render sequence */ /* disprect is optional, if NULL it assumes full window render */ void RE_InitState(Render *re, Render *source, RenderData *rd, - ViewRender *view_render, SceneRenderLayer *srl, + ListBase *render_layers, const int active_layer, + ViewRender *view_render, SceneLayer *scene_layer, int winx, int winy, rcti *disprect) { bool had_freestyle = (re->r.mode & R_EDGE_FRS) != 0; @@ -761,6 +760,9 @@ void RE_InitState(Render *re, Render *source, RenderData *rd, /* copy render data and render layers for thread safety */ render_copy_renderdata(&re->r, rd); render_copy_viewrender(&re->view_render, view_render); + BLI_freelistN(&re->render_layers); + BLI_duplicatelist(&re->render_layers, render_layers); + re->active_layer = active_layer; if (source) { /* reuse border flags from source renderer */ @@ -809,10 +811,10 @@ void RE_InitState(Render *re, Render *source, RenderData *rd, else re->osa = 0; } - if (srl) { - int index = BLI_findindex(&rd->layers, srl); + if (scene_layer) { + int index = BLI_findindex(render_layers, scene_layer); if (index != -1) { - re->r.actlay = index; + re->active_layer = index; re->r.scemode |= R_SINGLE_LAYER; } } @@ -830,12 +832,12 @@ void RE_InitState(Render *re, Render *source, RenderData *rd, re->result = NULL; } else if (re->result) { - SceneRenderLayer *actsrl = BLI_findlink(&re->r.layers, re->r.actlay); + SceneLayer *active_render_layer = BLI_findlink(&re->render_layers, re->active_layer); RenderLayer *rl; bool have_layer = false; for (rl = re->result->layers.first; rl; rl = rl->next) - if (STREQ(rl->name, actsrl->name)) + if (STREQ(rl->name, active_render_layer->name)) have_layer = true; if (re->result->rectx == re->rectx && re->result->recty == re->recty && @@ -960,7 +962,7 @@ void RE_ChangeModeFlag(Render *re, int flag, bool clear) /* update some variables that can be animated, and otherwise wouldn't be due to * RenderData getting copied once at the start of animation render */ -void render_update_anim_renderdata(Render *re, RenderData *rd) +void render_update_anim_renderdata(Render *re, RenderData *rd, ListBase *render_layers) { /* filter */ re->r.gauss = rd->gauss; @@ -974,8 +976,8 @@ void render_update_anim_renderdata(Render *re, RenderData *rd) re->r.unit_line_thickness = rd->unit_line_thickness; /* render layers */ - BLI_freelistN(&re->r.layers); - BLI_duplicatelist(&re->r.layers, &rd->layers); + BLI_freelistN(&re->render_layers); + BLI_duplicatelist(&re->render_layers, render_layers); /* render views */ BLI_freelistN(&re->r.views); @@ -1977,7 +1979,7 @@ static void render_scene(Render *re, Scene *sce, int cfra) } /* initial setup */ - RE_InitState(resc, re, &sce->r, &sce->view_render, NULL, winx, winy, &re->disprect); + RE_InitState(resc, re, &sce->r, &sce->render_layers, sce->active_layer, &sce->view_render, NULL, winx, winy, &re->disprect); /* We still want to use 'rendercache' setting from org (main) scene... */ resc->r.scemode = (resc->r.scemode & ~R_EXR_CACHE_FILE) | (re->r.scemode & R_EXR_CACHE_FILE); @@ -2248,24 +2250,24 @@ static void init_freestyle(Render *re) /* invokes Freestyle stroke rendering */ static void add_freestyle(Render *re, int render) { - SceneRenderLayer *srl, *actsrl; + SceneLayer *scene_layer, *active_render_layer; LinkData *link; Render *r; const bool do_link = (re->r.mode & R_MBLUR) == 0 || re->i.curblur == re->r.mblur_samples; - actsrl = BLI_findlink(&re->r.layers, re->r.actlay); + active_render_layer = BLI_findlink(&re->render_layers, re->active_layer); FRS_begin_stroke_rendering(re); - for (srl = (SceneRenderLayer *)re->r.layers.first; srl; srl = srl->next) { + for (scene_layer = (SceneLayer *)re->render_layers.first; scene_layer; scene_layer = scene_layer->next) { if (do_link) { link = (LinkData *)MEM_callocN(sizeof(LinkData), "LinkData to Freestyle render"); BLI_addtail(&re->freestyle_renders, link); } - if ((re->r.scemode & R_SINGLE_LAYER) && srl != actsrl) + if ((re->r.scemode & R_SINGLE_LAYER) && scene_layer != active_render_layer) continue; - if (FRS_is_freestyle_enabled(srl)) { - r = FRS_do_stroke_rendering(re, srl, render); + if (FRS_is_freestyle_enabled(scene_layer)) { + r = FRS_do_stroke_rendering(re, scene_layer, render); if (do_link) link->data = (void *)r; } @@ -2282,25 +2284,25 @@ static void composite_freestyle_renders(Render *re, int sample) { Render *freestyle_render; RenderView *rv; - SceneRenderLayer *srl, *actsrl; + SceneLayer *scene_layer, *active_scene_layer; LinkData *link; - actsrl = BLI_findlink(&re->r.layers, re->r.actlay); + active_scene_layer = BLI_findlink(&re->render_layers, re->active_layer); link = (LinkData *)re->freestyle_renders.first; for (rv = re->result->views.first; rv; rv = rv->next) { - for (srl = (SceneRenderLayer *)re->r.layers.first; srl; srl = srl->next) { - if ((re->r.scemode & R_SINGLE_LAYER) && srl != actsrl) + for (scene_layer = (SceneLayer *)re->render_layers.first; scene_layer; scene_layer = scene_layer->next) { + if ((re->r.scemode & R_SINGLE_LAYER) && scene_layer != active_scene_layer) continue; - if (FRS_is_freestyle_enabled(srl)) { + if (FRS_is_freestyle_enabled(scene_layer)) { freestyle_render = (Render *)link->data; /* may be NULL in case of empty render layer */ if (freestyle_render) { render_result_exr_file_read_sample(freestyle_render, sample); - FRS_composite_result(re, srl, freestyle_render); + FRS_composite_result(re, scene_layer, freestyle_render); RE_FreeRenderResult(freestyle_render->result); freestyle_render->result = NULL; } @@ -2880,10 +2882,10 @@ bool RE_force_single_renderlayer(Scene *scene) { int scemode = check_mode_full_sample(&scene->r, &scene->view_render); if (scemode & R_SINGLE_LAYER) { - SceneRenderLayer *srl = BLI_findlink(&scene->r.layers, scene->r.actlay); + SceneLayer *scene_layer = BLI_findlink(&scene->render_layers, scene->active_layer); /* force layer to be enabled */ - if (srl->layflag & SCE_LAY_DISABLE) { - srl->layflag &= ~SCE_LAY_DISABLE; + if ((scene_layer->flag & SCENE_LAYER_RENDER) == 0) { + scene_layer->flag |= SCENE_LAYER_RENDER; return true; } } @@ -3174,7 +3176,7 @@ void RE_SetEngineByID(Render *re, const char *engine_id) /* evaluating scene options for general Blender render */ static int render_initialize_from_main(Render *re, RenderData *rd, Main *bmain, Scene *scene, ViewRender *view_render, - SceneRenderLayer *srl, Object *camera_override, unsigned int lay_override, + SceneLayer *scene_layer, Object *camera_override, unsigned int lay_override, int anim, int anim_init) { int winx, winy; @@ -3213,7 +3215,7 @@ static int render_initialize_from_main(Render *re, RenderData *rd, Main *bmain, /* not too nice, but it survives anim-border render */ if (anim) { - render_update_anim_renderdata(re, &scene->r); + render_update_anim_renderdata(re, &scene->r, &scene->render_layers); re->disprect = disprect; return 1; } @@ -3228,17 +3230,17 @@ static int render_initialize_from_main(Render *re, RenderData *rd, Main *bmain, */ if (0) { /* make sure dynamics are up to date */ - SceneLayer *scene_layer = BKE_scene_layer_from_scene_get(scene); + scene_layer = BKE_scene_layer_from_scene_get(scene); update_physics_cache(re, scene, scene_layer, anim_init); } - if (srl || scene->r.scemode & R_SINGLE_LAYER) { + if (scene_layer || scene->r.scemode & R_SINGLE_LAYER) { BLI_rw_mutex_lock(&re->resultmutex, THREAD_LOCK_WRITE); render_result_single_layer_begin(re); BLI_rw_mutex_unlock(&re->resultmutex); } - RE_InitState(re, NULL, &scene->r, &scene->view_render, srl, winx, winy, &disprect); + RE_InitState(re, NULL, &scene->r, &scene->render_layers, scene->active_layer, &scene->view_render, scene_layer, winx, winy, &disprect); if (!re->ok) /* if an error was printed, abort */ return 0; @@ -3259,7 +3261,7 @@ void RE_SetReports(Render *re, ReportList *reports) } /* general Blender frame render call */ -void RE_BlenderFrame(Render *re, Main *bmain, Scene *scene, SceneRenderLayer *srl, Object *camera_override, +void RE_BlenderFrame(Render *re, Main *bmain, Scene *scene, SceneLayer *scene_layer, Object *camera_override, unsigned int lay_override, int frame, const bool write_still) { BLI_callback_exec(re->main, (ID *)scene, BLI_CB_EVT_RENDER_INIT); @@ -3269,7 +3271,7 @@ void RE_BlenderFrame(Render *re, Main *bmain, Scene *scene, SceneRenderLayer *sr scene->r.cfra = frame; - if (render_initialize_from_main(re, &scene->r, bmain, scene, &scene->view_render, srl, + if (render_initialize_from_main(re, &scene->r, bmain, scene, &scene->view_render, scene_layer, camera_override, lay_override, 0, 0)) { MEM_reset_peak_memory(); @@ -3855,7 +3857,7 @@ void RE_PreviewRender(Render *re, Main *bmain, Scene *sce, ViewRender *view_rend winx = (sce->r.size * sce->r.xsch) / 100; winy = (sce->r.size * sce->r.ysch) / 100; - RE_InitState(re, NULL, &sce->r, view_render, NULL, winx, winy, NULL); + RE_InitState(re, NULL, &sce->r, &sce->render_layers, sce->active_layer, view_render, NULL, winx, winy, NULL); re->pool = BKE_image_pool_new(); @@ -3910,7 +3912,7 @@ bool RE_ReadRenderResult(Scene *scene, Scene *scenode) re = RE_GetSceneRender(scene); if (re == NULL) re = RE_NewSceneRender(scene); - RE_InitState(re, NULL, &scene->r, &scene->view_render, NULL, winx, winy, &disprect); + RE_InitState(re, NULL, &scene->r, &scene->render_layers, scene->active_layer, &scene->view_render, NULL, winx, winy, &disprect); re->scene = scene; re->scene_color_manage = BKE_scene_check_color_management_enabled(scene); diff --git a/source/blender/render/intern/source/render_result.c b/source/blender/render/intern/source/render_result.c index f5f36b88c1d..1b19307b9e8 100644 --- a/source/blender/render/intern/source/render_result.c +++ b/source/blender/render/intern/source/render_result.c @@ -264,7 +264,7 @@ RenderResult *render_result_new(Render *re, rcti *partrct, int crop, int savebuf RenderResult *rr; RenderLayer *rl; RenderView *rv; - SceneRenderLayer *srl; + SceneLayer *scene_layer; int rectx, recty; int nr; @@ -294,27 +294,30 @@ RenderResult *render_result_new(Render *re, rcti *partrct, int crop, int savebuf render_result_views_new(rr, &re->r); /* check renderdata for amount of layers */ - for (nr = 0, srl = re->r.layers.first; srl; srl = srl->next, nr++) { + for (nr = 0, scene_layer = re->render_layers.first; scene_layer; scene_layer = scene_layer->next, nr++) { if (layername && layername[0]) - if (!STREQ(srl->name, layername)) + if (!STREQ(scene_layer->name, layername)) continue; if (re->r.scemode & R_SINGLE_LAYER) { - if (nr != re->r.actlay) + if (nr != re->active_layer) { continue; + } } else { - if (srl->layflag & SCE_LAY_DISABLE) + if ((scene_layer->flag & SCENE_LAYER_RENDER) == 0) { continue; + } } rl = MEM_callocN(sizeof(RenderLayer), "new render layer"); BLI_addtail(&rr->layers, rl); - BLI_strncpy(rl->name, srl->name, sizeof(rl->name)); - rl->passflag = srl->passflag; /* for debugging: srl->passflag | SCE_PASS_RAYHITS; */ - rl->pass_xor = srl->pass_xor; + BLI_strncpy(rl->name, scene_layer->name, sizeof(rl->name)); + rl->layflag = scene_layer->layflag; + rl->passflag = scene_layer->passflag; /* for debugging: scene_layer->passflag | SCE_PASS_RAYHITS; */ + rl->pass_xor = scene_layer->pass_xor; rl->rectx = rectx; rl->recty = recty; @@ -349,65 +352,65 @@ RenderResult *render_result_new(Render *re, rcti *partrct, int crop, int savebuf /* a renderlayer should always have a Combined pass*/ render_layer_add_pass(rr, rl, 4, "Combined", view, "RGBA"); - if (srl->passflag & SCE_PASS_Z) + if (scene_layer->passflag & SCE_PASS_Z) RENDER_LAYER_ADD_PASS_SAFE(rr, rl, 1, RE_PASSNAME_Z, view, "Z"); - if (srl->passflag & SCE_PASS_VECTOR) + if (scene_layer->passflag & SCE_PASS_VECTOR) RENDER_LAYER_ADD_PASS_SAFE(rr, rl, 4, RE_PASSNAME_VECTOR, view, "XYZW"); - if (srl->passflag & SCE_PASS_NORMAL) + if (scene_layer->passflag & SCE_PASS_NORMAL) RENDER_LAYER_ADD_PASS_SAFE(rr, rl, 3, RE_PASSNAME_NORMAL, view, "XYZ"); - if (srl->passflag & SCE_PASS_UV) + if (scene_layer->passflag & SCE_PASS_UV) RENDER_LAYER_ADD_PASS_SAFE(rr, rl, 3, RE_PASSNAME_UV, view, "UVA"); - if (srl->passflag & SCE_PASS_RGBA) + if (scene_layer->passflag & SCE_PASS_RGBA) RENDER_LAYER_ADD_PASS_SAFE(rr, rl, 4, RE_PASSNAME_RGBA, view, "RGBA"); - if (srl->passflag & SCE_PASS_EMIT) + if (scene_layer->passflag & SCE_PASS_EMIT) RENDER_LAYER_ADD_PASS_SAFE(rr, rl, 3, RE_PASSNAME_EMIT, view, "RGB"); - if (srl->passflag & SCE_PASS_DIFFUSE) + if (scene_layer->passflag & SCE_PASS_DIFFUSE) RENDER_LAYER_ADD_PASS_SAFE(rr, rl, 3, RE_PASSNAME_DIFFUSE, view, "RGB"); - if (srl->passflag & SCE_PASS_SPEC) + if (scene_layer->passflag & SCE_PASS_SPEC) RENDER_LAYER_ADD_PASS_SAFE(rr, rl, 3, RE_PASSNAME_SPEC, view, "RGB"); - if (srl->passflag & SCE_PASS_AO) + if (scene_layer->passflag & SCE_PASS_AO) RENDER_LAYER_ADD_PASS_SAFE(rr, rl, 3, RE_PASSNAME_AO, view, "RGB"); - if (srl->passflag & SCE_PASS_ENVIRONMENT) + if (scene_layer->passflag & SCE_PASS_ENVIRONMENT) RENDER_LAYER_ADD_PASS_SAFE(rr, rl, 3, RE_PASSNAME_ENVIRONMENT, view, "RGB"); - if (srl->passflag & SCE_PASS_INDIRECT) + if (scene_layer->passflag & SCE_PASS_INDIRECT) RENDER_LAYER_ADD_PASS_SAFE(rr, rl, 3, RE_PASSNAME_INDIRECT, view, "RGB"); - if (srl->passflag & SCE_PASS_SHADOW) + if (scene_layer->passflag & SCE_PASS_SHADOW) RENDER_LAYER_ADD_PASS_SAFE(rr, rl, 3, RE_PASSNAME_SHADOW, view, "RGB"); - if (srl->passflag & SCE_PASS_REFLECT) + if (scene_layer->passflag & SCE_PASS_REFLECT) RENDER_LAYER_ADD_PASS_SAFE(rr, rl, 3, RE_PASSNAME_REFLECT, view, "RGB"); - if (srl->passflag & SCE_PASS_REFRACT) + if (scene_layer->passflag & SCE_PASS_REFRACT) RENDER_LAYER_ADD_PASS_SAFE(rr, rl, 3, RE_PASSNAME_REFRACT, view, "RGB"); - if (srl->passflag & SCE_PASS_INDEXOB) + if (scene_layer->passflag & SCE_PASS_INDEXOB) RENDER_LAYER_ADD_PASS_SAFE(rr, rl, 1, RE_PASSNAME_INDEXOB, view, "X"); - if (srl->passflag & SCE_PASS_INDEXMA) + if (scene_layer->passflag & SCE_PASS_INDEXMA) RENDER_LAYER_ADD_PASS_SAFE(rr, rl, 1, RE_PASSNAME_INDEXMA, view, "X"); - if (srl->passflag & SCE_PASS_MIST) + if (scene_layer->passflag & SCE_PASS_MIST) RENDER_LAYER_ADD_PASS_SAFE(rr, rl, 1, RE_PASSNAME_MIST, view, "Z"); if (rl->passflag & SCE_PASS_RAYHITS) RENDER_LAYER_ADD_PASS_SAFE(rr, rl, 4, RE_PASSNAME_RAYHITS, view, "RGB"); - if (srl->passflag & SCE_PASS_DIFFUSE_DIRECT) + if (scene_layer->passflag & SCE_PASS_DIFFUSE_DIRECT) RENDER_LAYER_ADD_PASS_SAFE(rr, rl, 3, RE_PASSNAME_DIFFUSE_DIRECT, view, "RGB"); - if (srl->passflag & SCE_PASS_DIFFUSE_INDIRECT) + if (scene_layer->passflag & SCE_PASS_DIFFUSE_INDIRECT) RENDER_LAYER_ADD_PASS_SAFE(rr, rl, 3, RE_PASSNAME_DIFFUSE_INDIRECT, view, "RGB"); - if (srl->passflag & SCE_PASS_DIFFUSE_COLOR) + if (scene_layer->passflag & SCE_PASS_DIFFUSE_COLOR) RENDER_LAYER_ADD_PASS_SAFE(rr, rl, 3, RE_PASSNAME_DIFFUSE_COLOR, view, "RGB"); - if (srl->passflag & SCE_PASS_GLOSSY_DIRECT) + if (scene_layer->passflag & SCE_PASS_GLOSSY_DIRECT) RENDER_LAYER_ADD_PASS_SAFE(rr, rl, 3, RE_PASSNAME_GLOSSY_DIRECT, view, "RGB"); - if (srl->passflag & SCE_PASS_GLOSSY_INDIRECT) + if (scene_layer->passflag & SCE_PASS_GLOSSY_INDIRECT) RENDER_LAYER_ADD_PASS_SAFE(rr, rl, 3, RE_PASSNAME_GLOSSY_INDIRECT, view, "RGB"); - if (srl->passflag & SCE_PASS_GLOSSY_COLOR) + if (scene_layer->passflag & SCE_PASS_GLOSSY_COLOR) RENDER_LAYER_ADD_PASS_SAFE(rr, rl, 3, RE_PASSNAME_GLOSSY_COLOR, view, "RGB"); - if (srl->passflag & SCE_PASS_TRANSM_DIRECT) + if (scene_layer->passflag & SCE_PASS_TRANSM_DIRECT) RENDER_LAYER_ADD_PASS_SAFE(rr, rl, 3, RE_PASSNAME_TRANSM_DIRECT, view, "RGB"); - if (srl->passflag & SCE_PASS_TRANSM_INDIRECT) + if (scene_layer->passflag & SCE_PASS_TRANSM_INDIRECT) RENDER_LAYER_ADD_PASS_SAFE(rr, rl, 3, RE_PASSNAME_TRANSM_INDIRECT, view, "RGB"); - if (srl->passflag & SCE_PASS_TRANSM_COLOR) + if (scene_layer->passflag & SCE_PASS_TRANSM_COLOR) RENDER_LAYER_ADD_PASS_SAFE(rr, rl, 3, RE_PASSNAME_TRANSM_COLOR, view, "RGB"); - if (srl->passflag & SCE_PASS_SUBSURFACE_DIRECT) + if (scene_layer->passflag & SCE_PASS_SUBSURFACE_DIRECT) RENDER_LAYER_ADD_PASS_SAFE(rr, rl, 3, RE_PASSNAME_SUBSURFACE_DIRECT, view, "RGB"); - if (srl->passflag & SCE_PASS_SUBSURFACE_INDIRECT) + if (scene_layer->passflag & SCE_PASS_SUBSURFACE_INDIRECT) RENDER_LAYER_ADD_PASS_SAFE(rr, rl, 3, RE_PASSNAME_SUBSURFACE_INDIRECT, view, "RGB"); - if (srl->passflag & SCE_PASS_SUBSURFACE_COLOR) + if (scene_layer->passflag & SCE_PASS_SUBSURFACE_COLOR) RENDER_LAYER_ADD_PASS_SAFE(rr, rl, 3, RE_PASSNAME_SUBSURFACE_COLOR, view, "RGB"); #undef RENDER_LAYER_ADD_PASS_SAFE } @@ -444,7 +447,7 @@ RenderResult *render_result_new(Render *re, rcti *partrct, int crop, int savebuf rl->layflag = 0x7FFF; /* solid ztra halo strand */ rl->passflag = SCE_PASS_COMBINED; - re->r.actlay = 0; + re->active_layer = 0; } /* border render; calculate offset for use in compositor. compo is centralized coords */ @@ -975,7 +978,7 @@ void render_result_single_layer_begin(Render *re) /* if scemode is R_SINGLE_LAYER, at end of rendering, merge the both render results */ void render_result_single_layer_end(Render *re) { - SceneRenderLayer *srl; + SceneLayer *scene_layer; RenderLayer *rlpush; RenderLayer *rl; int nr; @@ -996,12 +999,12 @@ void render_result_single_layer_end(Render *re) BLI_remlink(&re->result->layers, rl); /* reconstruct render result layers */ - for (nr = 0, srl = re->r.layers.first; srl; srl = srl->next, nr++) { - if (nr == re->r.actlay) { + for (nr = 0, scene_layer = re->render_layers.first; scene_layer; scene_layer = scene_layer->next, nr++) { + if (nr == re->active_layer) { BLI_addtail(&re->result->layers, rl); } else { - rlpush = RE_GetRenderLayer(re->pushedresult, srl->name); + rlpush = RE_GetRenderLayer(re->pushedresult, scene_layer->name); if (rlpush) { BLI_remlink(&re->pushedresult->layers, rlpush); BLI_addtail(&re->result->layers, rlpush); diff --git a/source/blender/render/intern/source/rendercore.c b/source/blender/render/intern/source/rendercore.c index 71d233e7d70..a129e64db49 100644 --- a/source/blender/render/intern/source/rendercore.c +++ b/source/blender/render/intern/source/rendercore.c @@ -1992,18 +1992,18 @@ void add_halo_flare(Render *re) } } -void render_internal_update_passes(RenderEngine *engine, Scene *scene, SceneRenderLayer *srl) +void render_internal_update_passes(RenderEngine *engine, Scene *scene, SceneLayer *scene_layer) { int type; - RE_engine_register_pass(engine, scene, srl, RE_PASSNAME_COMBINED, 4, "RGBA", SOCK_RGBA); + RE_engine_register_pass(engine, scene, scene_layer, RE_PASSNAME_COMBINED, 4, "RGBA", SOCK_RGBA); #define CHECK_PASS(name, channels, chanid) \ - if (srl->passflag & (SCE_PASS_ ## name)) { \ + if (scene_layer->passflag & (SCE_PASS_ ## name)) { \ if (channels == 4) type = SOCK_RGBA; \ else if (channels == 3) type = SOCK_VECTOR; \ else type = SOCK_FLOAT; \ - RE_engine_register_pass(engine, scene, srl, RE_PASSNAME_ ## name, channels, chanid, type); \ + RE_engine_register_pass(engine, scene, scene_layer, RE_PASSNAME_ ## name, channels, chanid, type); \ } CHECK_PASS(Z, 1, "Z"); |