Skip to content

Commit

Permalink
Rename ND_normalmap to ND_normalmap_float in 1.39 (#1677)
Browse files Browse the repository at this point in the history
Renaming ND_normalmap -> ND_normalmap_float

Added upgrade mechanism to handle the node definition rename.
  • Loading branch information
ld-kerley authored Jan 31, 2024
1 parent f4c84a6 commit 779f346
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 6 deletions.
3 changes: 1 addition & 2 deletions libraries/stdlib/genglsl/stdlib_genglsl_impl.mtlx
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,9 @@
</implementation>

<!-- <normalmap> -->
<implementation name="IM_normalmap_float_genglsl" nodedef="ND_normalmap" file="mx_normalmap.glsl" function="mx_normalmap_float" target="genglsl" />
<implementation name="IM_normalmap_float_genglsl" nodedef="ND_normalmap_float" file="mx_normalmap.glsl" function="mx_normalmap_float" target="genglsl" />
<implementation name="IM_normalmap_vector2_genglsl" nodedef="ND_normalmap_vector2" file="mx_normalmap.glsl" function="mx_normalmap_vector2" target="genglsl" />


<!-- ======================================================================== -->
<!-- Procedural nodes -->
<!-- ======================================================================== -->
Expand Down
2 changes: 1 addition & 1 deletion libraries/stdlib/genmdl/stdlib_genmdl_impl.mtlx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
<!-- <triplanarprojection> -->

<!-- <normalmap> -->
<implementation name="IM_normalmap_float_genmdl" nodedef="ND_normalmap" sourcecode="mx::stdlib::mx_normalmap_float(mxp_in:{{in}}, mxp_space:{{space}}, mxp_scale:{{scale}}, mxp_normal:{{normal}}, mxp_tangent:{{tangent}})" target="genmdl" />
<implementation name="IM_normalmap_float_genmdl" nodedef="ND_normalmap_float" sourcecode="mx::stdlib::mx_normalmap_float(mxp_in:{{in}}, mxp_space:{{space}}, mxp_scale:{{scale}}, mxp_normal:{{normal}}, mxp_tangent:{{tangent}})" target="genmdl" />
<implementation name="IM_normalmap_vector2_genmdl" nodedef="ND_normalmap_vector2" sourcecode="mx::stdlib::mx_normalmap_vector2(mxp_in:{{in}}, mxp_space:{{space}}, mxp_scale:{{scale}}, mxp_normal:{{normal}}, mxp_tangent:{{tangent}})" target="genmdl" />

<!-- ======================================================================== -->
Expand Down
2 changes: 1 addition & 1 deletion libraries/stdlib/genmsl/stdlib_genmsl_impl.mtlx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
</implementation>

<!-- <normalmap> -->
<implementation name="IM_normalmap_float_genmsl" nodedef="ND_normalmap" file="mx_normalmap.metal" function="mx_normalmap_float" target="genmsl" />
<implementation name="IM_normalmap_float_genmsl" nodedef="ND_normalmap_float" file="mx_normalmap.metal" function="mx_normalmap_float" target="genmsl" />
<implementation name="IM_normalmap_vector2_genmsl" nodedef="ND_normalmap_vector2" file="mx_normalmap.metal" function="mx_normalmap_vector2" target="genmsl" />

<!-- ======================================================================== -->
Expand Down
2 changes: 1 addition & 1 deletion libraries/stdlib/genosl/stdlib_genosl_impl.mtlx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
<!-- <triplanarprojection> -->

<!-- <normalmap> -->
<implementation name="IM_normalmap_float_genosl" nodedef="ND_normalmap" file="mx_normalmap.osl" function="mx_normalmap_float" target="genosl" />
<implementation name="IM_normalmap_float_genosl" nodedef="ND_normalmap_float" file="mx_normalmap.osl" function="mx_normalmap_float" target="genosl" />
<implementation name="IM_normalmap_vector2_genosl" nodedef="ND_normalmap_vector2" file="mx_normalmap.osl" function="mx_normalmap_vector2" target="genosl" />

<!-- ======================================================================== -->
Expand Down
2 changes: 1 addition & 1 deletion libraries/stdlib/stdlib_defs.mtlx
Original file line number Diff line number Diff line change
Expand Up @@ -2497,7 +2497,7 @@
Node: <normalmap>
Transform a normal vector from object or tangent space into "world" space.
-->
<nodedef name="ND_normalmap" node="normalmap" nodegroup="math">
<nodedef name="ND_normalmap_float" node="normalmap" nodegroup="math">
<input name="in" type="vector3" value="0.5, 0.5, 1.0" />
<input name="space" type="string" value="tangent" enum="tangent, object" uniform="true" />
<input name="scale" type="float" value="1.0" />
Expand Down
6 changes: 6 additions & 0 deletions source/MaterialXCore/Document.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1426,6 +1426,7 @@ void Document::upgradeVersion()
continue;
}
const string& nodeCategory = node->getCategory();
const string& nodeDef = node->getNodeDefString();
if (nodeCategory == "atan2")
{
// rename input ports
Expand Down Expand Up @@ -1465,6 +1466,11 @@ void Document::upgradeVersion()
}
}
}
else if (nodeDef == "ND_normalmap")
{
// ND_normalmap was renamed to ND_normalmap_float
node->setNodeDefString("ND_normalmap_float");
}
}

removeNodeDef("ND_thin_film_bsdf");
Expand Down

0 comments on commit 779f346

Please sign in to comment.