diff options
author | Sergey Sharybin <sergey@blender.org> | 2021-09-15 10:05:46 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey@blender.org> | 2021-09-15 20:51:25 +0300 |
commit | e432ce12a8574f40c72d5d155a241bd80b05d93c (patch) | |
tree | 44d33e1286f1b32ca3570e2cc7b8544d6af83b65 /source/blender/makesrna | |
parent | 9d4824550807c1d373022370d7b45217b02aec02 (diff) |
Render: Introduce render_frame_finish RenderEngine callback
Allows to inform the engine that nothing else will be rendered for the
current frame and that the engine can perform post-processing of any
pending result.
For example, this allows the engine to free its memory, read all files
from disk and write them to Blender.
Currently no functional changes, just preparing API for the further
development of Cycles on-disk tile storage.
Differential Revision: https://developer.blender.org/D12502
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r-- | source/blender/makesrna/intern/rna_render.c | 34 |
1 files changed, 28 insertions, 6 deletions
diff --git a/source/blender/makesrna/intern/rna_render.c b/source/blender/makesrna/intern/rna_render.c index e716950867a..bfbfc6fc055 100644 --- a/source/blender/makesrna/intern/rna_render.c +++ b/source/blender/makesrna/intern/rna_render.c @@ -179,6 +179,22 @@ static void engine_render(RenderEngine *engine, Depsgraph *depsgraph) RNA_parameter_list_free(&list); } +static void engine_render_frame_finish(RenderEngine *engine) +{ + extern FunctionRNA rna_RenderEngine_render_frame_finish_func; + PointerRNA ptr; + ParameterList list; + FunctionRNA *func; + + RNA_pointer_create(NULL, engine->type->rna_ext.srna, engine, &ptr); + func = &rna_RenderEngine_render_frame_finish_func; + + RNA_parameter_list_create(&list, &ptr, func); + engine->type->rna_ext.call(NULL, &ptr, func, &list); + + RNA_parameter_list_free(&list); +} + static void engine_draw(RenderEngine *engine, const struct bContext *context, Depsgraph *depsgraph) { extern FunctionRNA rna_RenderEngine_draw_func; @@ -378,12 +394,13 @@ static StructRNA *rna_RenderEngine_register(Main *bmain, et->update = (have_function[0]) ? engine_update : NULL; et->render = (have_function[1]) ? engine_render : NULL; - et->draw = (have_function[2]) ? engine_draw : NULL; - et->bake = (have_function[3]) ? engine_bake : NULL; - et->view_update = (have_function[4]) ? engine_view_update : NULL; - et->view_draw = (have_function[5]) ? engine_view_draw : NULL; - et->update_script_node = (have_function[6]) ? engine_update_script_node : NULL; - et->update_render_passes = (have_function[7]) ? engine_update_render_passes : NULL; + et->render_frame_finish = (have_function[2]) ? engine_render_frame_finish : NULL; + et->draw = (have_function[3]) ? engine_draw : NULL; + et->bake = (have_function[4]) ? engine_bake : NULL; + et->view_update = (have_function[5]) ? engine_view_update : NULL; + et->view_draw = (have_function[6]) ? engine_view_draw : NULL; + et->update_script_node = (have_function[7]) ? engine_update_script_node : NULL; + et->update_render_passes = (have_function[8]) ? engine_update_render_passes : NULL; RE_engines_register(et); @@ -540,6 +557,11 @@ static void rna_def_render_engine(BlenderRNA *brna) parm = RNA_def_pointer(func, "depsgraph", "Depsgraph", "", ""); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); + func = RNA_def_function(srna, "render_frame_finish", NULL); + RNA_def_function_ui_description( + func, "Perform finishing operations after all view layers in a frame were rendered"); + RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE); + func = RNA_def_function(srna, "draw", NULL); RNA_def_function_ui_description(func, "Draw render image"); RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL); |