Fix T74254: EEVEE Render Passes Availability

When disabling AO or BLOOM in the render tab, when the pass is shown in
a 3d viewport the pass wasn't reset. This resulted in showing a black
texture and a not filled UI render pass in the shading popover.

This patch will by default reset to the combined pass. It is intended
that the render_pass in the 3d shading struct isn't set to combined as
people could have disabled AO/bloom by mistake and it could reset
viewports that aren't visible.
This commit is contained in:
Jeroen Bakker 2020-02-27 12:15:33 +01:00
parent 01162f756a
commit f24a4750bd
Notes: blender-bot 2023-02-14 09:38:57 +01:00
Referenced by issue #74254, EEVEE: Switch To Combined Render Pass when a Render Pass isn't Available Anymore in the Viewport.
2 changed files with 28 additions and 2 deletions

View File

@ -88,7 +88,17 @@ void EEVEE_renderpasses_init(EEVEE_Data *vedata)
View3D *v3d = draw_ctx->v3d;
if (v3d) {
g_data->render_passes = v3d->shading.render_pass;
const Scene *scene = draw_ctx->scene;
eViewLayerEEVEEPassType render_pass = v3d->shading.render_pass;
if (render_pass == EEVEE_RENDER_PASS_AO &&
((scene->eevee.flag & SCE_EEVEE_GTAO_ENABLED) == 0)) {
render_pass = EEVEE_RENDER_PASS_COMBINED;
}
else if (render_pass == EEVEE_RENDER_PASS_BLOOM &&
((scene->eevee.flag & SCE_EEVEE_BLOOM_ENABLED) == 0)) {
render_pass = EEVEE_RENDER_PASS_COMBINED;
}
g_data->render_passes = render_pass;
}
else {
eViewLayerEEVEEPassType enabled_render_passes = view_layer->eevee.render_passes;

View File

@ -1283,6 +1283,21 @@ static const EnumPropertyItem *rna_3DViewShading_render_pass_itemf(bContext *C,
*r_free = true;
return result;
}
static int rna_3DViewShading_render_pass_get(PointerRNA *ptr)
{
View3DShading *shading = (View3DShading *)ptr->data;
eViewLayerEEVEEPassType result = shading->render_pass;
Scene *scene = rna_3DViewShading_scene(ptr);
if (result == EEVEE_RENDER_PASS_AO && ((scene->eevee.flag & SCE_EEVEE_GTAO_ENABLED) == 0)) {
result = EEVEE_RENDER_PASS_COMBINED;
}
if (result == EEVEE_RENDER_PASS_BLOOM && ((scene->eevee.flag & SCE_EEVEE_BLOOM_ENABLED) == 0)) {
result = EEVEE_RENDER_PASS_COMBINED;
}
return result;
}
static void rna_SpaceView3D_use_local_collections_update(bContext *C, PointerRNA *ptr)
{
@ -3379,7 +3394,8 @@ 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_enum_funcs(
prop, "rna_3DViewShading_render_pass_get", NULL, "rna_3DViewShading_render_pass_itemf");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
}