diff options
Diffstat (limited to 'source/blender/makesrna/intern/rna_render.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_render.c | 59 |
1 files changed, 44 insertions, 15 deletions
diff --git a/source/blender/makesrna/intern/rna_render.c b/source/blender/makesrna/intern/rna_render.c index 518c7efd915..69dea2a46c2 100644 --- a/source/blender/makesrna/intern/rna_render.c +++ b/source/blender/makesrna/intern/rna_render.c @@ -32,6 +32,8 @@ #include "BLI_utildefines.h" #include "BLI_path_util.h" +#include "DEG_depsgraph.h" + #include "RNA_define.h" #include "RNA_enum_types.h" @@ -146,7 +148,7 @@ static void engine_unbind_display_space_shader(RenderEngine *UNUSED(engine)) IMB_colormanagement_finish_glsl_draw(); } -static void engine_update(RenderEngine *engine, Main *bmain, Scene *scene) +static void engine_update(RenderEngine *engine, Main *bmain, Depsgraph *graph, Scene *scene) { extern FunctionRNA rna_RenderEngine_update_func; PointerRNA ptr; @@ -158,24 +160,25 @@ static void engine_update(RenderEngine *engine, Main *bmain, Scene *scene) RNA_parameter_list_create(&list, &ptr, func); RNA_parameter_set_lookup(&list, "data", &bmain); + RNA_parameter_set_lookup(&list, "depsgraph", &graph); RNA_parameter_set_lookup(&list, "scene", &scene); engine->type->ext.call(NULL, &ptr, func, &list); RNA_parameter_list_free(&list); } -static void engine_render(RenderEngine *engine, struct Scene *scene) +static void engine_render_to_image(RenderEngine *engine, struct Depsgraph *depsgraph) { - extern FunctionRNA rna_RenderEngine_render_func; + extern FunctionRNA rna_RenderEngine_render_to_image_func; PointerRNA ptr; ParameterList list; FunctionRNA *func; RNA_pointer_create(NULL, engine->type->ext.srna, engine, &ptr); - func = &rna_RenderEngine_render_func; + func = &rna_RenderEngine_render_to_image_func; RNA_parameter_list_create(&list, &ptr, func); - RNA_parameter_set_lookup(&list, "scene", &scene); + RNA_parameter_set_lookup(&list, "depsgraph", &depsgraph); engine->type->ext.call(NULL, &ptr, func, &list); RNA_parameter_list_free(&list); @@ -226,15 +229,15 @@ static void engine_view_update(RenderEngine *engine, const struct bContext *cont RNA_parameter_list_free(&list); } -static void engine_view_draw(RenderEngine *engine, const struct bContext *context) +static void engine_render_to_view(RenderEngine *engine, const struct bContext *context) { - extern FunctionRNA rna_RenderEngine_view_draw_func; + extern FunctionRNA rna_RenderEngine_render_to_view_func; PointerRNA ptr; ParameterList list; FunctionRNA *func; RNA_pointer_create(NULL, engine->type->ext.srna, engine, &ptr); - func = &rna_RenderEngine_view_draw_func; + func = &rna_RenderEngine_render_to_view_func; RNA_parameter_list_create(&list, &ptr, func); RNA_parameter_set_lookup(&list, "context", &context); @@ -261,6 +264,23 @@ static void engine_update_script_node(RenderEngine *engine, struct bNodeTree *nt RNA_parameter_list_free(&list); } +static void engine_collection_settings_create(RenderEngine *engine, struct IDProperty *props) +{ + extern FunctionRNA rna_RenderEngine_collection_settings_create_func; + PointerRNA ptr; + ParameterList list; + FunctionRNA *func; + + RNA_pointer_create(NULL, engine->type->ext.srna, engine, &ptr); + func = &rna_RenderEngine_collection_settings_create_func; + + RNA_parameter_list_create(&list, &ptr, func); + RNA_parameter_set_lookup(&list, "props", &props); + engine->type->ext.call(NULL, &ptr, func, &list); + + RNA_parameter_list_free(&list); +} + /* RenderEngine registration */ static void rna_RenderEngine_unregister(Main *UNUSED(bmain), StructRNA *type) @@ -281,7 +301,7 @@ static StructRNA *rna_RenderEngine_register(Main *bmain, ReportList *reports, vo RenderEngineType *et, dummyet = {NULL}; RenderEngine dummyengine = {NULL}; PointerRNA dummyptr; - int have_function[6]; + int have_function[7]; /* setup dummy engine & engine type to store static properties in */ dummyengine.type = &dummyet; @@ -318,13 +338,14 @@ static StructRNA *rna_RenderEngine_register(Main *bmain, ReportList *reports, vo RNA_struct_blender_type_set(et->ext.srna, et); et->update = (have_function[0]) ? engine_update : NULL; - et->render = (have_function[1]) ? engine_render : NULL; + et->render_to_image = (have_function[1]) ? engine_render_to_image : NULL; et->bake = (have_function[2]) ? engine_bake : NULL; et->view_update = (have_function[3]) ? engine_view_update : NULL; - et->view_draw = (have_function[4]) ? engine_view_draw : NULL; + et->render_to_view = (have_function[4]) ? engine_render_to_view : NULL; et->update_script_node = (have_function[5]) ? engine_update_script_node : NULL; + et->collection_settings_create = (have_function[6]) ? engine_collection_settings_create : NULL; - BLI_addtail(&R_engines, et); + RE_engines_register(bmain, et); return et->ext.srna; } @@ -441,12 +462,13 @@ static void rna_def_render_engine(BlenderRNA *brna) RNA_def_function_ui_description(func, "Export scene data for render"); RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE); RNA_def_pointer(func, "data", "BlendData", "", ""); + RNA_def_pointer(func, "depsgraph", "Depsgraph", "", ""); RNA_def_pointer(func, "scene", "Scene", "", ""); - func = RNA_def_function(srna, "render", NULL); + func = RNA_def_function(srna, "render_to_image", NULL); RNA_def_function_ui_description(func, "Render scene into an image"); RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE); - RNA_def_pointer(func, "scene", "Scene", "", ""); + RNA_def_pointer(func, "desgraph", "Depsgraph", "", ""); func = RNA_def_function(srna, "bake", NULL); RNA_def_function_ui_description(func, "Bake passes"); @@ -477,7 +499,7 @@ static void rna_def_render_engine(BlenderRNA *brna) RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE); RNA_def_pointer(func, "context", "Context", "", ""); - func = RNA_def_function(srna, "view_draw", NULL); + func = RNA_def_function(srna, "render_to_view", NULL); RNA_def_function_ui_description(func, "Draw viewport render"); RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL); RNA_def_pointer(func, "context", "Context", "", ""); @@ -489,6 +511,13 @@ static void rna_def_render_engine(BlenderRNA *brna) parm = RNA_def_pointer(func, "node", "Node", "", ""); RNA_def_parameter_flags(parm, 0, PARM_RNAPTR); + /* per-collection engine settings initialization */ + func = RNA_def_function(srna, "collection_settings_create", NULL); + RNA_def_function_ui_description(func, "Create the per collection settings for the engine"); + RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE); + parm = RNA_def_pointer(func, "collection_settings", "LayerCollectionSettings", "", ""); + RNA_def_parameter_flags(parm, 0, PARM_RNAPTR); + /* tag for redraw */ func = RNA_def_function(srna, "tag_redraw", "engine_tag_redraw"); RNA_def_function_ui_description(func, "Request redraw for viewport rendering"); |