Skip to content

Commit

Permalink
Fix version upgrade for ND_normalmap_vector2 (#2022)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
rafalSFX committed Sep 19, 2024
1 parent 777826c commit 0a5defa
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion source/MaterialXCore/Version.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand Down

0 comments on commit 0a5defa

Please sign in to comment.