From 0a5defaf4773a1fbf100182368324023cdd2a38b Mon Sep 17 00:00:00 2001 From: Rafal Jaroszkiewicz Date: Thu, 19 Sep 2024 17:24:07 -0400 Subject: [PATCH] Fix version upgrade for ND_normalmap_vector2 (#2022) The upgrade code for the normalmap node was indiscriminately renaming all node definitions to "ND_normalmap_float". This included "ND_normalmap_vecto2" nodes, whose nodedef should not be renamed. This commit fixes that, limiting the renaming only to "ND_normalmap", based on the type of the "scale" input, which is the only differentiating factor between the two definitions. --- source/MaterialXCore/Version.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/source/MaterialXCore/Version.cpp b/source/MaterialXCore/Version.cpp index 34d9b3b02c..62f83a5660 100644 --- a/source/MaterialXCore/Version.cpp +++ b/source/MaterialXCore/Version.cpp @@ -1317,7 +1317,13 @@ void Document::upgradeVersion() else if (nodeCategory == "normalmap") { // ND_normalmap was renamed to ND_normalmap_float - node->setNodeDefString("ND_normalmap_float"); + NodeDefPtr nodeDef = getShaderNodeDef(node); + InputPtr scaleInput = node->getInput("scale"); + if ((nodeDef && nodeDef->getName() == "ND_normalmap") || + (scaleInput && scaleInput->getType() == "float")) + { + node->setNodeDefString("ND_normalmap_float"); + } node->removeInput("space");