diff options
Diffstat (limited to 'source/blender/makesrna/intern/rna_render.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_render.c | 86 |
1 files changed, 65 insertions, 21 deletions
diff --git a/source/blender/makesrna/intern/rna_render.c b/source/blender/makesrna/intern/rna_render.c index 360b8831f8c..0a6ed2e1ea2 100644 --- a/source/blender/makesrna/intern/rna_render.c +++ b/source/blender/makesrna/intern/rna_render.c @@ -33,6 +33,8 @@ #include "BLI_utildefines.h" #include "BLI_path_util.h" +#include "DEG_depsgraph.h" + #include "BKE_scene.h" #include "RNA_define.h" @@ -143,7 +145,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; @@ -155,24 +157,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); @@ -223,15 +226,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); @@ -258,6 +261,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); +} + static void engine_update_render_passes(RenderEngine *engine, struct Scene *scene, struct SceneRenderLayer *srl) { extern FunctionRNA rna_RenderEngine_update_render_passes_func; @@ -296,7 +316,7 @@ static StructRNA *rna_RenderEngine_register(Main *bmain, ReportList *reports, vo RenderEngineType *et, dummyet = {NULL}; RenderEngine dummyengine = {NULL}; PointerRNA dummyptr; - int have_function[7]; + int have_function[8]; /* setup dummy engine & engine type to store static properties in */ dummyengine.type = &dummyet; @@ -336,14 +356,15 @@ 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->update_render_passes = (have_function[6]) ? engine_update_render_passes : NULL; + et->collection_settings_create = (have_function[7]) ? engine_collection_settings_create : NULL; - BLI_addtail(&R_engines, et); + RE_engines_register(bmain, et); return et->ext.srna; } @@ -374,6 +395,16 @@ static PointerRNA rna_RenderEngine_render_get(PointerRNA *ptr) } } +static PointerRNA rna_RenderEngine_scene_layer_get(PointerRNA *ptr) +{ + RenderEngine *engine = (RenderEngine *)ptr->data; + if (engine->re != NULL) { + SceneLayer* scene_layer = RE_engine_get_scene_layer(engine->re); + return rna_pointer_inherit_refine(ptr, &RNA_SceneLayer, scene_layer); + } + return rna_pointer_inherit_refine(ptr, &RNA_SceneLayer, NULL); +} + static PointerRNA rna_RenderEngine_camera_override_get(PointerRNA *ptr) { RenderEngine *engine = (RenderEngine *)ptr->data; @@ -472,12 +503,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"); @@ -508,7 +540,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", "", ""); @@ -520,6 +552,19 @@ static void rna_def_render_engine(BlenderRNA *brna) parm = RNA_def_pointer(func, "node", "Node", "", ""); RNA_def_parameter_flags(parm, 0, PARM_RNAPTR); + func = RNA_def_function(srna, "update_render_passes", NULL); + RNA_def_function_ui_description(func, "Update the render passes that will be generated"); + RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE); + parm = RNA_def_pointer(func, "scene", "Scene", "", ""); + parm = RNA_def_pointer(func, "renderlayer", "SceneRenderLayer", "", ""); + + /* 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"); @@ -528,12 +573,6 @@ static void rna_def_render_engine(BlenderRNA *brna) func = RNA_def_function(srna, "tag_update", "engine_tag_update"); RNA_def_function_ui_description(func, "Request update call for viewport rendering"); - func = RNA_def_function(srna, "update_render_passes", NULL); - RNA_def_function_ui_description(func, "Update the render passes that will be generated"); - RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE); - parm = RNA_def_pointer(func, "scene", "Scene", "", ""); - parm = RNA_def_pointer(func, "renderlayer", "SceneRenderLayer", "", ""); - func = RNA_def_function(srna, "begin_result", "RE_engine_begin_result"); RNA_def_function_ui_description(func, "Create render result to write linear floating point render layers and passes"); parm = RNA_def_int(func, "x", 0, 0, INT_MAX, "X", "", 0, INT_MAX); @@ -717,6 +756,11 @@ static void rna_def_render_engine(BlenderRNA *brna) prop = RNA_def_enum(func, "type", render_pass_type_items, SOCK_FLOAT, "Type", ""); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); + prop = RNA_def_property(srna, "scene_layer", PROP_POINTER, PROP_NONE); + RNA_def_property_struct_type(prop, "SceneLayer"); + RNA_def_property_pointer_funcs(prop, "rna_RenderEngine_scene_layer_get", NULL, NULL, NULL); + RNA_def_property_ui_text(prop, "Scene layer", ""); + /* registration */ prop = RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE); |