diff options
author | Lukas Stockner <lukas.stockner@freenet.de> | 2017-05-03 01:21:18 +0300 |
---|---|---|
committer | Lukas Stockner <lukas.stockner@freenet.de> | 2017-05-03 17:44:52 +0300 |
commit | 4cf7fc3b3a4d032f0c0db632a46d40806e906cf1 (patch) | |
tree | 511e87033628608dd235ed352a007df4474234fa /source/blender/makesrna/intern/rna_scene.c | |
parent | 6bf4115c13962c99d1cdc97f2be92c4922f3fd33 (diff) |
Render API/Cycles: Identify Render Passes by their name instead of a type flag
Previously, every RenderPass would have a bitfield that specified its type. That limits the number of passes to 32, which was reached a while ago.
However, most of the code already supported arbitrary RenderPasses since they were also used to store Multilayer EXR images.
Therefore, this commit completely removes the passflag from RenderPass and changes all code to use the unique pass name for identification.
Since Blender Internal relies on hardcoded passes and to preserve compatibility, 32 pass names are reserved for the old hardcoded passes.
To support these arbitrary passes, the Render Result compositor node now adds dynamic sockets. For compatibility, the old hardcoded sockets are always stored and just hidden when the corresponding pass isn't available.
To use these changes, the Render Engine API now includes a function that allows render engines to add arbitrary passes to the render result. To be able to add options for these passes, addons can now add their own properties to SceneRenderLayers.
To keep the compositor input node updated, render engine plugins have to implement a callback that registers all the passes that will be generated.
From a user perspective, nothing should change with this commit.
Differential Revision: https://developer.blender.org/D2443
Differential Revision: https://developer.blender.org/D2444
Diffstat (limited to 'source/blender/makesrna/intern/rna_scene.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_scene.c | 38 |
1 files changed, 28 insertions, 10 deletions
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 899466f05df..dd30cb0d03f 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -448,6 +448,7 @@ EnumPropertyItem rna_enum_gpencil_interpolation_mode_items[] = { #include "BKE_colortools.h" #include "BKE_context.h" #include "BKE_global.h" +#include "BKE_idprop.h" #include "BKE_image.h" #include "BKE_main.h" #include "BKE_node.h" @@ -1608,6 +1609,18 @@ static void rna_Scene_use_view_map_cache_update(Main *UNUSED(bmain), Scene *UNUS #endif } +static IDProperty *rna_SceneRenderLayer_idprops(PointerRNA *ptr, bool create) +{ + SceneRenderLayer *srl = (SceneRenderLayer *)ptr->data; + + if (create && !srl->prop) { + IDPropertyTemplate val = {0}; + srl->prop = IDP_New(IDP_GROUP, &val, "SceneRenderLayer ID properties"); + } + + return srl->prop; +} + static void rna_SceneRenderLayer_name_set(PointerRNA *ptr, const char *value) { Scene *scene = (Scene *)ptr->id.data; @@ -1712,11 +1725,18 @@ static void rna_SceneRenderLayer_pass_update(Main *bmain, Scene *activescene, Po Scene *scene = (Scene *)ptr->id.data; if (scene->nodetree) - ntreeCompositForceHidden(scene->nodetree); - + ntreeCompositUpdateRLayers(scene->nodetree); + rna_Scene_glsl_update(bmain, activescene, ptr); } +static void rna_SceneRenderLayer_update_render_passes(ID *id) +{ + Scene *scene = (Scene*) id; + if (scene->nodetree) + ntreeCompositUpdateRLayers(scene->nodetree); +} + static void rna_Scene_use_nodes_update(bContext *C, PointerRNA *ptr) { Scene *scene = (Scene *)ptr->data; @@ -5072,14 +5092,20 @@ static void rna_def_scene_render_layer(BlenderRNA *brna) { StructRNA *srna; PropertyRNA *prop; + FunctionRNA *func; srna = RNA_def_struct(brna, "SceneRenderLayer", NULL); RNA_def_struct_ui_text(srna, "Scene Render Layer", "Render layer"); RNA_def_struct_ui_icon(srna, ICON_RENDERLAYERS); RNA_def_struct_path_func(srna, "rna_SceneRenderLayer_path"); + RNA_def_struct_idprops_func(srna, "rna_SceneRenderLayer_idprops"); rna_def_render_layer_common(srna, 1); + func = RNA_def_function(srna, "update_render_passes", "rna_SceneRenderLayer_update_render_passes"); + RNA_def_function_ui_description(func, "Requery the enabled render passes from the render engine"); + RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_NO_SELF); + /* Freestyle */ rna_def_freestyle_settings(brna); @@ -6742,14 +6768,6 @@ static void rna_def_scene_render_data(BlenderRNA *brna) RNA_def_property_struct_type(prop, "BakeSettings"); RNA_def_property_ui_text(prop, "Bake Data", ""); - /* Debugging settings. */ -#ifdef WITH_CYCLES_DEBUG - prop = RNA_def_property(srna, "debug_pass_type", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_items(prop, rna_enum_render_pass_debug_type_items); - RNA_def_property_ui_text(prop, "Debug Pass Type", "Type of the debug pass to use"); - RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); -#endif - /* Nestled Data */ /* *** Non-Animated *** */ RNA_define_animate_sdna(false); |