diff options
author | Dalai Felinto <dalai@blender.org> | 2020-12-10 13:05:49 +0300 |
---|---|---|
committer | Dalai Felinto <dalai@blender.org> | 2020-12-10 13:05:49 +0300 |
commit | c5a17d5ea1ff786cb91cbcf3f12cd02f730c4143 (patch) | |
tree | f03a5935ee7dbc4c7ddabaee1c06570a26f698f9 /source/blender/makesrna/intern/rna_scene.c | |
parent | 390c4efa0c15b39e2d1971bc81464cffae56d102 (diff) | |
parent | e795ba1529a28ec276a5178fda2025e5ec071bbf (diff) |
Merge remote-tracking branch 'origin/master' into geometry-nodes
Diffstat (limited to 'source/blender/makesrna/intern/rna_scene.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_scene.c | 165 |
1 files changed, 150 insertions, 15 deletions
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 235042122e6..da03921bca6 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -390,7 +390,7 @@ const EnumPropertyItem rna_enum_image_color_mode_items[] = { "BW", 0, "BW", - "Images get saved in 8 bits grayscale (only PNG, JPEG, TGA, TIF)"}, + "Images get saved in 8-bit grayscale (only PNG, JPEG, TGA, TIF)"}, {R_IMF_PLANES_RGB, "RGB", 0, "RGB", "Images are saved with RGB (color) data"}, {R_IMF_PLANES_RGBA, "RGBA", @@ -408,12 +408,12 @@ const EnumPropertyItem rna_enum_image_color_mode_items[] = { const EnumPropertyItem rna_enum_image_color_depth_items[] = { /* 1 (monochrome) not used */ - {R_IMF_CHAN_DEPTH_8, "8", 0, "8", "8 bit color channels"}, - {R_IMF_CHAN_DEPTH_10, "10", 0, "10", "10 bit color channels"}, - {R_IMF_CHAN_DEPTH_12, "12", 0, "12", "12 bit color channels"}, - {R_IMF_CHAN_DEPTH_16, "16", 0, "16", "16 bit color channels"}, + {R_IMF_CHAN_DEPTH_8, "8", 0, "8", "8-bit color channels"}, + {R_IMF_CHAN_DEPTH_10, "10", 0, "10", "10-bit color channels"}, + {R_IMF_CHAN_DEPTH_12, "12", 0, "12", "12-bit color channels"}, + {R_IMF_CHAN_DEPTH_16, "16", 0, "16", "16-bit color channels"}, /* 24 not used */ - {R_IMF_CHAN_DEPTH_32, "32", 0, "32", "32 bit color channels"}, + {R_IMF_CHAN_DEPTH_32, "32", 0, "32", "32-bit color channels"}, {0, NULL, 0, NULL, NULL}, }; @@ -529,6 +529,12 @@ const EnumPropertyItem rna_enum_bake_pass_filter_type_items[] = { {0, NULL, 0, NULL, NULL}, }; +static const EnumPropertyItem rna_enum_view_layer_aov_type_items[] = { + {AOV_TYPE_COLOR, "COLOR", 0, "Color", ""}, + {AOV_TYPE_VALUE, "VALUE", 0, "Value", ""}, + {0, NULL, 0, NULL, NULL}, +}; + #ifndef RNA_RUNTIME static const EnumPropertyItem rna_enum_gpencil_interpolation_mode_items[] = { /* interpolation */ @@ -1779,6 +1785,27 @@ void rna_ViewLayer_pass_update(Main *bmain, Scene *activescene, PointerRNA *ptr) ntreeCompositUpdateRLayers(scene->nodetree); } + ViewLayer *view_layer = NULL; + if (ptr->type == &RNA_ViewLayer) { + view_layer = (ViewLayer *)ptr->data; + } + else if (ptr->type == &RNA_AOV) { + ViewLayerAOV *aov = (ViewLayerAOV *)ptr->data; + view_layer = BKE_view_layer_find_with_aov(scene, aov); + } + + if (view_layer) { + RenderEngineType *engine_type = RE_engines_find(scene->r.engine); + if (engine_type->update_render_passes) { + RenderEngine *engine = RE_engine_create(engine_type); + if (engine) { + BKE_view_layer_verify_aov(engine, scene, view_layer); + } + RE_engine_free(engine); + engine = NULL; + } + } + rna_Scene_glsl_update(bmain, activescene, ptr); } @@ -2397,6 +2424,28 @@ static void rna_ViewLayer_remove( } } +void rna_ViewLayer_active_aov_index_range( + PointerRNA *ptr, int *min, int *max, int *UNUSED(softmin), int *UNUSED(softmax)) +{ + ViewLayer *view_layer = (ViewLayer *)ptr->data; + + *min = 0; + *max = max_ii(0, BLI_listbase_count(&view_layer->aovs) - 1); +} + +int rna_ViewLayer_active_aov_index_get(PointerRNA *ptr) +{ + ViewLayer *view_layer = (ViewLayer *)ptr->data; + return BLI_findindex(&view_layer->aovs, view_layer->active_aov); +} + +void rna_ViewLayer_active_aov_index_set(PointerRNA *ptr, int value) +{ + ViewLayer *view_layer = (ViewLayer *)ptr->data; + ViewLayerAOV *aov = BLI_findlink(&view_layer->aovs, value); + view_layer->active_aov = aov; +} + /* Fake value, used internally (not saved to DNA). */ # define V3D_ORIENT_DEFAULT -1 @@ -3944,7 +3993,7 @@ static void rna_def_view_layer_eevee(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; srna = RNA_def_struct(brna, "ViewLayerEEVEE", NULL); - RNA_def_struct_ui_text(srna, "EEVEE Settings", "View layer settings for EEVEE"); + RNA_def_struct_ui_text(srna, "Eevee Settings", "View layer settings for Eevee"); prop = RNA_def_property(srna, "use_pass_volume_scatter", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "render_passes", EEVEE_RENDER_PASS_VOLUME_SCATTER); @@ -3963,6 +4012,33 @@ static void rna_def_view_layer_eevee(BlenderRNA *brna) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update"); } +static void rna_def_view_layer_aov(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + srna = RNA_def_struct(brna, "AOV", NULL); + RNA_def_struct_sdna(srna, "ViewLayerAOV"); + RNA_def_struct_ui_text(srna, "Shader AOV", ""); + + prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); + RNA_def_property_string_sdna(prop, NULL, "name"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + RNA_def_property_ui_text(prop, "Name", "Name of the AOV"); + RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update"); + RNA_def_struct_name_property(srna, prop); + + prop = RNA_def_property(srna, "is_valid", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", AOV_CONFLICT); + RNA_def_property_ui_text(prop, "Valid", "Is the name of the AOV conflicting"); + + prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "type"); + RNA_def_property_enum_items(prop, rna_enum_view_layer_aov_type_items); + RNA_def_property_enum_default(prop, AOV_TYPE_COLOR); + RNA_def_property_ui_text(prop, "Type", "Data type of the AOV"); + RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update"); +} + void rna_def_view_layer_common(StructRNA *srna, const bool scene) { PropertyRNA *prop; @@ -4012,7 +4088,65 @@ void rna_def_view_layer_common(StructRNA *srna, const bool scene) prop = RNA_def_property(srna, "eevee", PROP_POINTER, PROP_NONE); RNA_def_property_flag(prop, PROP_NEVER_NULL); RNA_def_property_struct_type(prop, "ViewLayerEEVEE"); - RNA_def_property_ui_text(prop, "EEVEE Settings", "View layer settings for EEVEE"); + RNA_def_property_ui_text(prop, "Eevee Settings", "View layer settings for Eevee"); + + prop = RNA_def_property(srna, "aovs", PROP_COLLECTION, PROP_NONE); + RNA_def_property_collection_sdna(prop, NULL, "aovs", NULL); + RNA_def_property_struct_type(prop, "AOV"); + RNA_def_property_ui_text(prop, "Shader AOV", ""); + + prop = RNA_def_property(srna, "active_aov", PROP_POINTER, PROP_NONE); + RNA_def_property_struct_type(prop, "AOV"); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Shader AOV", "Active AOV"); + + prop = RNA_def_property(srna, "active_aov_index", PROP_INT, PROP_UNSIGNED); + RNA_def_property_int_funcs(prop, + "rna_ViewLayer_active_aov_index_get", + "rna_ViewLayer_active_aov_index_set", + "rna_ViewLayer_active_aov_index_range"); + RNA_def_property_ui_text(prop, "Active AOV Index", "Index of active aov"); + RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); + + prop = RNA_def_property(srna, "use_pass_cryptomatte_object", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "cryptomatte_flag", VIEW_LAYER_CRYPTOMATTE_OBJECT); + RNA_def_property_ui_text( + prop, + "Cryptomatte Object", + "Render cryptomatte object pass, for isolating objects in compositing"); + RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update"); + + prop = RNA_def_property(srna, "use_pass_cryptomatte_material", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "cryptomatte_flag", VIEW_LAYER_CRYPTOMATTE_MATERIAL); + RNA_def_property_ui_text( + prop, + "Cryptomatte Material", + "Render cryptomatte material pass, for isolating materials in compositing"); + RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update"); + + prop = RNA_def_property(srna, "use_pass_cryptomatte_asset", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "cryptomatte_flag", VIEW_LAYER_CRYPTOMATTE_ASSET); + RNA_def_property_ui_text( + prop, + "Cryptomatte Asset", + "Render cryptomatte asset pass, for isolating groups of objects with the same parent"); + RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update"); + + prop = RNA_def_property(srna, "pass_cryptomatte_depth", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "cryptomatte_levels"); + RNA_def_property_int_default(prop, 6); + RNA_def_property_range(prop, 2.0, 16.0); + RNA_def_property_ui_text( + prop, "Cryptomatte Levels", "Sets how many unique objects can be distinguished per pixel"); + RNA_def_property_ui_range(prop, 2.0, 16.0, 2.0, 0.0); + RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update"); + + prop = RNA_def_property(srna, "use_pass_cryptomatte_accurate", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "cryptomatte_flag", VIEW_LAYER_CRYPTOMATTE_ACCURATE); + RNA_def_property_boolean_default(prop, true); + RNA_def_property_ui_text( + prop, "Cryptomatte Accurate", "Generate a more accurate cryptomatte pass"); + RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update"); } /* layer options */ @@ -5353,7 +5487,7 @@ static void rna_def_scene_image_format_data(BlenderRNA *brna) prop = RNA_def_property(srna, "use_zbuffer", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", R_IMF_FLAG_ZBUF); RNA_def_property_ui_text( - prop, "Z Buffer", "Save the z-depth per pixel (32 bit unsigned int z-buffer)"); + prop, "Z Buffer", "Save the z-depth per pixel (32-bit unsigned integer z-buffer)"); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); prop = RNA_def_property(srna, "use_preview", PROP_BOOLEAN, PROP_NONE); @@ -5589,26 +5723,26 @@ static void rna_def_scene_ffmpeg_settings(BlenderRNA *brna) prop = RNA_def_property(srna, "video_bitrate", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "video_bitrate"); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); - RNA_def_property_ui_text(prop, "Bitrate", "Video bitrate (kb/s)"); + RNA_def_property_ui_text(prop, "Bitrate", "Video bitrate (kbit/s)"); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); prop = RNA_def_property(srna, "minrate", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "rc_min_rate"); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); - RNA_def_property_ui_text(prop, "Min Rate", "Rate control: min rate (kb/s)"); + RNA_def_property_ui_text(prop, "Min Rate", "Rate control: min rate (kbit/s)"); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); prop = RNA_def_property(srna, "maxrate", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "rc_max_rate"); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); - RNA_def_property_ui_text(prop, "Max Rate", "Rate control: max rate (kb/s)"); + RNA_def_property_ui_text(prop, "Max Rate", "Rate control: max rate (kbit/s)"); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); prop = RNA_def_property(srna, "muxrate", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "mux_rate"); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_range(prop, 0, 100000000); - RNA_def_property_ui_text(prop, "Mux Rate", "Mux rate (bits/s(!))"); + RNA_def_property_ui_text(prop, "Mux Rate", "Mux rate (bits/second)"); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); prop = RNA_def_property(srna, "gopsize", PROP_INT, PROP_NONE); @@ -7289,7 +7423,7 @@ static void rna_def_scene_eevee(BlenderRNA *brna) prop = RNA_def_property(srna, "use_shadow_high_bitdepth", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", SCE_EEVEE_SHADOW_HIGH_BITDEPTH); - RNA_def_property_ui_text(prop, "High Bitdepth", "Use 32bit shadows"); + RNA_def_property_ui_text(prop, "High Bit Depth", "Use 32-bit shadows"); RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); @@ -7824,7 +7958,7 @@ void RNA_def_scene(BlenderRNA *brna) /* EEVEE */ prop = RNA_def_property(srna, "eevee", PROP_POINTER, PROP_NONE); RNA_def_property_struct_type(prop, "SceneEEVEE"); - RNA_def_property_ui_text(prop, "EEVEE", "EEVEE settings for the scene"); + RNA_def_property_ui_text(prop, "Eevee", "Eevee settings for the scene"); /* Grease Pencil */ prop = RNA_def_property(srna, "grease_pencil_settings", PROP_POINTER, PROP_NONE); @@ -7848,6 +7982,7 @@ void RNA_def_scene(BlenderRNA *brna) rna_def_display_safe_areas(brna); rna_def_scene_display(brna); rna_def_scene_eevee(brna); + rna_def_view_layer_aov(brna); rna_def_view_layer_eevee(brna); rna_def_scene_gpencil(brna); RNA_define_animate_sdna(true); |