From 0afee246ea6b41b9466eeb0e0ded4a4bb0c152f4 Mon Sep 17 00:00:00 2001 From: Alaska Date: Fri, 12 Jul 2024 22:44:01 +0200 Subject: [PATCH] Fix #124593: Reorder EEVEE material shadow versioning Caused by 983e4a75432600e700019be3e7a59dd225014bea Bail out case should be at the top Pull Request: https://projects.blender.org/blender/blender/pulls/124600 --- source/blender/blenloader/intern/versioning_400.cc | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/source/blender/blenloader/intern/versioning_400.cc b/source/blender/blenloader/intern/versioning_400.cc index f2be6b9f8ca..4e5d8f93294 100644 --- a/source/blender/blenloader/intern/versioning_400.cc +++ b/source/blender/blenloader/intern/versioning_400.cc @@ -359,6 +359,14 @@ static void versioning_eevee_material_shadow_none(Material *material) return; } + bNodeSocket *existing_out_sock = blender::bke::nodeFindSocket(output_node, SOCK_IN, "Surface"); + bNodeSocket *volume_sock = blender::bke::nodeFindSocket(output_node, SOCK_IN, "Volume"); + if (existing_out_sock->link == nullptr && volume_sock->link) { + /* Don't apply versioning to a material that only has a volumetric input as this makes the + * object surface opaque to the camera, hiding the volume inside. */ + return; + } + if (output_node->custom1 == SHD_OUTPUT_ALL) { /* We do not want to affect Cycles. So we split the output into two specific outputs. */ output_node->custom1 = SHD_OUTPUT_CYCLES; @@ -387,12 +395,6 @@ static void versioning_eevee_material_shadow_none(Material *material) } bNodeSocket *out_sock = blender::bke::nodeFindSocket(output_node, SOCK_IN, "Surface"); - bNodeSocket *volume_sock = blender::bke::nodeFindSocket(output_node, SOCK_IN, "Volume"); - if (out_sock->link == nullptr && volume_sock->link) { - /* Don't apply versioning to a material that only has a volumetric input as this makes the - * object surface opaque to the camera, hiding the volume inside. */ - return; - } bNode *mix_node = blender::bke::nodeAddNode(nullptr, ntree, "ShaderNodeMixShader"); STRNCPY(mix_node->label, "Disable Shadow");