diff options
Diffstat (limited to 'source/blender/makesrna/intern/rna_space.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_space.c | 59 |
1 files changed, 51 insertions, 8 deletions
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index fdea081d8f1..975a3bdaf2e 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -382,14 +382,32 @@ static const EnumPropertyItem rna_enum_studio_light_items[] = { }; static const EnumPropertyItem rna_enum_view3dshading_render_pass_type_items[] = { - {SCE_PASS_COMBINED, "COMBINED", 0, "Combined", ""}, - /* {SCE_PASS_Z, "Z", 0, "Z", ""},*/ - {SCE_PASS_AO, "AO", 0, "Ambient Occlusion", ""}, - {SCE_PASS_NORMAL, "NORMAL", 0, "Normal", ""}, - {SCE_PASS_MIST, "MIST", 0, "Mist", ""}, - {SCE_PASS_SUBSURFACE_DIRECT, "SUBSURFACE_DIRECT", 0, "Subsurface Direct", ""}, - /* {SCE_PASS_SUBSURFACE_INDIRECT, "SUBSURFACE_INDIRECT", 0, "Subsurface Indirect", ""}, */ - {SCE_PASS_SUBSURFACE_COLOR, "SUBSURFACE_COLOR", 0, "Subsurface Color", ""}, + {0, "", ICON_NONE, "General", ""}, + {EEVEE_RENDER_PASS_COMBINED, "COMBINED", 0, "Combined", ""}, + {EEVEE_RENDER_PASS_EMIT, "EMISSION", 0, "Emission", ""}, + {EEVEE_RENDER_PASS_ENVIRONMENT, "ENVIRONMENT", 0, "Environment", ""}, + {EEVEE_RENDER_PASS_AO, "AO", 0, "Ambient Occlusion", ""}, + {EEVEE_RENDER_PASS_SHADOW, "SHADOW", 0, "Shadow", ""}, + + {0, "", ICON_NONE, "Light", ""}, + {EEVEE_RENDER_PASS_DIFFUSE_LIGHT, "DIFFUSE_LIGHT", 0, "Diffuse Light", ""}, + {EEVEE_RENDER_PASS_DIFFUSE_COLOR, "DIFFUSE_COLOR", 0, "Diffuse Color", ""}, + {EEVEE_RENDER_PASS_SPECULAR_LIGHT, "SPECULAR_LIGHT", 0, "Specular Light", ""}, + {EEVEE_RENDER_PASS_SPECULAR_COLOR, "SPECULAR_COLOR", 0, "Specular Color", ""}, + {EEVEE_RENDER_PASS_VOLUME_TRANSMITTANCE, + "VOLUME_TRANSMITTANCE", + 0, + "Volume Transmittance", + ""}, + {EEVEE_RENDER_PASS_VOLUME_SCATTER, "VOLUME_SCATTER", 0, "Volume Scattering", ""}, + + {0, "", ICON_NONE, "Effects", ""}, + {EEVEE_RENDER_PASS_BLOOM, "BLOOM", 0, "Bloom", ""}, + + {0, "", ICON_NONE, "Data", ""}, + {EEVEE_RENDER_PASS_NORMAL, "NORMAL", 0, "Normal", ""}, + {EEVEE_RENDER_PASS_MIST, "MIST", 0, "Mist", ""}, + {0, NULL, 0, NULL, NULL}, }; @@ -1242,6 +1260,30 @@ static const EnumPropertyItem *rna_View3DShading_studio_light_itemf(bContext *UN return item; } +static const EnumPropertyItem *rna_3DViewShading_render_pass_itemf(bContext *C, + PointerRNA *UNUSED(ptr), + PropertyRNA *UNUSED(prop), + bool *r_free) +{ + Scene *scene = CTX_data_scene(C); + + const bool ao_enabled = scene->eevee.flag & SCE_EEVEE_GTAO_ENABLED; + const bool bloom_enabled = scene->eevee.flag & SCE_EEVEE_BLOOM_ENABLED; + + int totitem = 0; + EnumPropertyItem *result = NULL; + for (int i = 0; rna_enum_view3dshading_render_pass_type_items[i].identifier != NULL; i++) { + const EnumPropertyItem *item = &rna_enum_view3dshading_render_pass_type_items[i]; + if (!((!ao_enabled && item->value == EEVEE_RENDER_PASS_AO) || + (!bloom_enabled && + (item->value == EEVEE_RENDER_PASS_BLOOM || STREQ(item->name, "Effects"))))) { + RNA_enum_item_add(&result, &totitem, item); + } + } + *r_free = true; + return result; +} + static void rna_SpaceView3D_use_local_collections_update(bContext *C, PointerRNA *ptr) { Main *bmain = CTX_data_main(C); @@ -3328,6 +3370,7 @@ static void rna_def_space_view3d_shading(BlenderRNA *brna) RNA_def_property_enum_sdna(prop, NULL, "render_pass"); RNA_def_property_enum_items(prop, rna_enum_view3dshading_render_pass_type_items); RNA_def_property_ui_text(prop, "Render Pass", "Render Pass to show in the viewport"); + RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_3DViewShading_render_pass_itemf"); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); } |