diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2013-09-12 16:09:14 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2013-09-12 16:09:14 +0400 |
commit | c41bb7961f1eb39dc423949a0474dd63ced53c98 (patch) | |
tree | d2852203d3c4635636c7e309c72539c42d40616c /source/blender | |
parent | 8309f1c0de6f8a70f85e3f980f83a5513d61d898 (diff) |
Different implementation of patch #36430: use layer froms scene directly for
rendering, in case some script wants to set it in the render_pre callback. In
case of decoupled 3d view layers or local view it will still override this
though.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/editors/render/render_internal.c | 22 | ||||
-rw-r--r-- | source/blender/render/extern/include/RE_pipeline.h | 4 | ||||
-rw-r--r-- | source/blender/render/intern/source/pipeline.c | 16 |
3 files changed, 21 insertions, 21 deletions
diff --git a/source/blender/editors/render/render_internal.c b/source/blender/editors/render/render_internal.c index 0d6e6fb5ac1..f59c5d6af8d 100644 --- a/source/blender/editors/render/render_internal.c +++ b/source/blender/editors/render/render_internal.c @@ -212,7 +212,7 @@ static int screen_render_exec(bContext *C, wmOperator *op) Image *ima; View3D *v3d = CTX_wm_view3d(C); Main *mainp = CTX_data_main(C); - unsigned int lay; + unsigned int lay_override; const short is_animation = RNA_boolean_get(op->ptr, "animation"); const short is_write_still = RNA_boolean_get(op->ptr, "write_still"); struct Object *camera_override = v3d ? V3D_CAMERA_LOCAL(v3d) : NULL; @@ -226,7 +226,7 @@ static int screen_render_exec(bContext *C, wmOperator *op) } re = RE_NewRender(scene->id.name); - lay = (v3d) ? v3d->lay : scene->lay; + lay_override = (v3d && v3d->lay != scene->lay) ? v3d->lay : 0; G.is_break = FALSE; RE_test_break_cb(re, NULL, render_break); @@ -244,9 +244,9 @@ static int screen_render_exec(bContext *C, wmOperator *op) RE_SetReports(re, op->reports); if (is_animation) - RE_BlenderAnim(re, mainp, scene, camera_override, lay, scene->r.sfra, scene->r.efra, scene->r.frame_step); + RE_BlenderAnim(re, mainp, scene, camera_override, lay_override, scene->r.sfra, scene->r.efra, scene->r.frame_step); else - RE_BlenderFrame(re, mainp, scene, srl, camera_override, lay, scene->r.cfra, is_write_still); + RE_BlenderFrame(re, mainp, scene, srl, camera_override, lay_override, scene->r.cfra, is_write_still); RE_SetReports(re, NULL); @@ -265,7 +265,7 @@ typedef struct RenderJob { wmWindow *win; SceneRenderLayer *srl; struct Object *camera_override; - int lay; + int lay_override; bool v3d_override; short anim, write_still; Image *image; @@ -444,9 +444,9 @@ static void render_startjob(void *rjv, short *stop, short *do_update, float *pro RE_SetReports(rj->re, rj->reports); if (rj->anim) - RE_BlenderAnim(rj->re, rj->main, rj->scene, rj->camera_override, rj->lay, rj->scene->r.sfra, rj->scene->r.efra, rj->scene->r.frame_step); + RE_BlenderAnim(rj->re, rj->main, rj->scene, rj->camera_override, rj->lay_override, rj->scene->r.sfra, rj->scene->r.efra, rj->scene->r.frame_step); else - RE_BlenderFrame(rj->re, rj->main, rj->scene, rj->srl, rj->camera_override, rj->lay, rj->scene->r.cfra, rj->write_still); + RE_BlenderFrame(rj->re, rj->main, rj->scene, rj->srl, rj->camera_override, rj->lay_override, rj->scene->r.cfra, rj->write_still); RE_SetReports(rj->re, NULL); } @@ -651,7 +651,7 @@ static int screen_render_invoke(bContext *C, wmOperator *op, const wmEvent *even rj->win = CTX_wm_window(C); rj->srl = srl; rj->camera_override = camera_override; - rj->lay = scene->lay; + rj->lay_override = 0; rj->anim = is_animation; rj->write_still = is_write_still && !is_animation; rj->iuser.scene = scene; @@ -659,15 +659,15 @@ static int screen_render_invoke(bContext *C, wmOperator *op, const wmEvent *even rj->reports = op->reports; if (v3d) { - if (rj->lay != v3d->lay) { - rj->lay = v3d->lay; + if (scene->lay != v3d->lay) { + rj->lay_override = v3d->lay; rj->v3d_override = true; } else if (camera_override && camera_override != scene->camera) rj->v3d_override = true; if (v3d->localvd) - rj->lay |= v3d->localvd->lay; + rj->lay_override = scene->lay | v3d->localvd->lay; } /* setup job */ diff --git a/source/blender/render/extern/include/RE_pipeline.h b/source/blender/render/extern/include/RE_pipeline.h index e154fd42119..73a89ad884f 100644 --- a/source/blender/render/extern/include/RE_pipeline.h +++ b/source/blender/render/extern/include/RE_pipeline.h @@ -225,8 +225,8 @@ void RE_init_threadcount(Render *re); void RE_TileProcessor(struct Render *re); /* only RE_NewRender() needed, main Blender render calls */ -void RE_BlenderFrame(struct Render *re, struct Main *bmain, struct Scene *scene, struct SceneRenderLayer *srl, struct Object *camera_override, unsigned int lay, int frame, const short write_still); -void RE_BlenderAnim(struct Render *re, struct Main *bmain, struct Scene *scene, struct Object *camera_override, unsigned int lay, int sfra, int efra, int tfra); +void RE_BlenderFrame(struct Render *re, struct Main *bmain, struct Scene *scene, struct SceneRenderLayer *srl, struct Object *camera_override, unsigned int lay_override, int frame, const short write_still); +void RE_BlenderAnim(struct Render *re, struct Main *bmain, struct Scene *scene, struct Object *camera_override, unsigned int lay_override, int sfra, int efra, int tfra); #ifdef WITH_FREESTYLE void RE_RenderFreestyleStrokes(struct Render *re, struct Main *bmain, struct Scene *scene, int render); #endif diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c index 8ac69b101f4..6118d479cab 100644 --- a/source/blender/render/intern/source/pipeline.c +++ b/source/blender/render/intern/source/pipeline.c @@ -2389,7 +2389,7 @@ static void update_physics_cache(Render *re, Scene *scene, int UNUSED(anim_init) BKE_ptcache_bake(&baker); } /* evaluating scene options for general Blender render */ -static int render_initialize_from_main(Render *re, Main *bmain, Scene *scene, SceneRenderLayer *srl, Object *camera_override, unsigned int lay, int anim, int anim_init) +static int render_initialize_from_main(Render *re, Main *bmain, Scene *scene, SceneRenderLayer *srl, Object *camera_override, unsigned int lay_override, int anim, int anim_init) { int winx, winy; rcti disprect; @@ -2419,8 +2419,8 @@ static int render_initialize_from_main(Render *re, Main *bmain, Scene *scene, Sc re->scene = scene; re->scene_color_manage = BKE_scene_check_color_management_enabled(scene); re->camera_override = camera_override; - re->lay = lay; - re->i.localview = (lay & 0xFF000000) != 0; + re->lay = lay_override ? lay_override : scene->lay; + re->i.localview = (re->lay & 0xFF000000) != 0; /* not too nice, but it survives anim-border render */ if (anim) { @@ -2469,14 +2469,14 @@ 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, unsigned int lay, int frame, const short write_still) +void RE_BlenderFrame(Render *re, Main *bmain, Scene *scene, SceneRenderLayer *srl, Object *camera_override, unsigned int lay_override, int frame, const short write_still) { /* ugly global still... is to prevent preview events and signal subsurfs etc to make full resol */ G.is_rendering = TRUE; scene->r.cfra = frame; - if (render_initialize_from_main(re, bmain, scene, srl, camera_override, lay, 0, 0)) { + if (render_initialize_from_main(re, bmain, scene, srl, camera_override, lay_override, 0, 0)) { MEM_reset_peak_memory(); BLI_callback_exec(re->main, (ID *)scene, BLI_CB_EVT_RENDER_PRE); @@ -2625,14 +2625,14 @@ static int do_write_image_or_movie(Render *re, Main *bmain, Scene *scene, bMovie } /* saves images to disk */ -void RE_BlenderAnim(Render *re, Main *bmain, Scene *scene, Object *camera_override, unsigned int lay, int sfra, int efra, int tfra) +void RE_BlenderAnim(Render *re, Main *bmain, Scene *scene, Object *camera_override, unsigned int lay_override, int sfra, int efra, int tfra) { bMovieHandle *mh = BKE_movie_handle_get(scene->r.im_format.imtype); int cfrao = scene->r.cfra; int nfra, totrendered = 0, totskipped = 0; /* do not fully call for each frame, it initializes & pops output window */ - if (!render_initialize_from_main(re, bmain, scene, NULL, camera_override, lay, 0, 1)) + if (!render_initialize_from_main(re, bmain, scene, NULL, camera_override, lay_override, 0, 1)) return; /* ugly global still... is to prevent renderwin events and signal subsurfs etc to make full resol */ @@ -2677,7 +2677,7 @@ void RE_BlenderAnim(Render *re, Main *bmain, Scene *scene, Object *camera_overri char name[FILE_MAX]; /* only border now, todo: camera lens. (ton) */ - render_initialize_from_main(re, bmain, scene, NULL, camera_override, lay, 1, 0); + render_initialize_from_main(re, bmain, scene, NULL, camera_override, lay_override, 1, 0); if (nfra != scene->r.cfra) { /* |