diff options
author | Miguel Pozo <pragma37> | 2021-02-01 20:24:15 +0300 |
---|---|---|
committer | Brecht Van Lommel <brecht@blender.org> | 2021-02-02 16:19:04 +0300 |
commit | 14285445283ecc8890f7e1c4b4eb92cef3f0a8ed (patch) | |
tree | 27e83dbb1f3184068531f7d13202e0dcdd9f85fa /source/blender/render/intern/pipeline.c | |
parent | e3c8363ce03818fde1ef0d9d7c9f13016b34ca54 (diff) |
Python API: option for render engines to delegate Freestyle render to Eevee
Eevee is now used for Freestyle rendering by default, since other engines are
unlikely to have support for this. Workbench and Cycles do their own rendering.
RenderEngine add-ons can do their own Freestyle rendering by setting
bl_use_custom_freestyle = True.
Differential Revision: https://developer.blender.org/D8335
Diffstat (limited to 'source/blender/render/intern/pipeline.c')
-rw-r--r-- | source/blender/render/intern/pipeline.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/source/blender/render/intern/pipeline.c b/source/blender/render/intern/pipeline.c index 320f8b8ed03..8567835f55c 100644 --- a/source/blender/render/intern/pipeline.c +++ b/source/blender/render/intern/pipeline.c @@ -2007,13 +2007,38 @@ void RE_RenderFrame(Render *re, G.is_rendering = false; } +static void change_renderdata_engine(Render *re, const char *new_engine) +{ + if (!STREQ(re->r.engine, new_engine)) { + if (re->engine) { + RE_engine_free(re->engine); + re->engine = NULL; + } + BLI_strncpy(re->r.engine, new_engine, sizeof(re->r.engine)); + } +} + #ifdef WITH_FREESTYLE +static bool use_eevee_for_freestyle_render(Render *re) +{ + RenderEngineType *type = RE_engines_find(re->r.engine); + return !(type->flag & RE_USE_CUSTOM_FREESTYLE); +} + void RE_RenderFreestyleStrokes(Render *re, Main *bmain, Scene *scene, int render) { re->result_ok = 0; if (render_init_from_main(re, &scene->r, bmain, scene, NULL, NULL, 0, 0)) { if (render) { + char scene_engine[32]; + BLI_strncpy(scene_engine, re->r.engine, sizeof(scene_engine)); + if (use_eevee_for_freestyle_render(re)) { + change_renderdata_engine(re, RE_engine_id_BLENDER_EEVEE); + } + do_render_3d(re); + + change_renderdata_engine(re, scene_engine); } } re->result_ok = 1; |