Skip to content

Commit

Permalink
Merge pull request #3509 from Autodesk/gamaj/LOOKDEVX-2266/fix_multi_…
Browse files Browse the repository at this point in the history
…node_graph_connections

LOOKDEVX-2266 - Fix multiple NodeGraph connections.
  • Loading branch information
seando-adsk authored Dec 12, 2023
2 parents edb92d8 + 9026d4d commit dd8a48c
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/mayaUsd/render/MaterialXGenOgsXml/ShaderGenUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -386,9 +386,9 @@ void TopoNeutralGraph::cloneNodeGraphConnection(
++_outputIndex;
_outputMap.insert({ outputKey, graphOutput });
graphOutput->setConnectedNode(destConnectedNode);
auto destInput = destNode.addInput(sourceInput.getName(), sourceInput.getType());
destInput->setConnectedOutput(graphOutput);
}
auto destInput = destNode.addInput(sourceInput.getName(), sourceInput.getType());
destInput->setConnectedOutput(graphOutput);
}

} // namespace ShaderGenUtil
Expand Down
28 changes: 28 additions & 0 deletions test/lib/mayaUsd/utils/materialx_test_data/MultiConnect1_topo.mtlx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0"?>
<materialx version="1.38">
<surfacematerial name="N0" type="material" nodedef="ND_surfacematerial">
<input name="surfaceshader" type="surfaceshader" nodename="N1" />
</surfacematerial>
<standard_surface name="N1" type="surfaceshader" nodedef="ND_standard_surface_surfaceshader">
<input name="base" type="float" output="O0" nodegraph="NG0" />
<input name="base_color" type="color3" output="O1" nodegraph="NG0" />
<input name="transmission" type="float" output="O0" nodegraph="NG0" />
<input name="subsurface" type="float" output="O2" nodegraph="NG0" />
<input name="opacity" type="color3" output="O1" nodegraph="NG0" />
</standard_surface>
<nodegraph name="NG0">
<constant name="N2" type="float" nodedef="ND_constant_float">
<input name="value" type="float" value="0.5" />
</constant>
<output name="O0" type="float" nodename="N2" />
<constant name="N3" type="color3" nodedef="ND_constant_color3">
<input name="value" type="color3" value="0.263273, 0.263273, 0.263273" />
</constant>
<output name="O1" type="color3" nodename="N3" />
<add name="N4" type="float" nodedef="ND_add_float">
<input name="in1" type="float" nodename="N2" />
<input name="in2" type="float" nodename="N2" />
</add>
<output name="O2" type="float" nodename="N4" />
</nodegraph>
</materialx>
21 changes: 21 additions & 0 deletions test/lib/mayaUsd/utils/materialx_test_data/topology_tests.mtlx
Original file line number Diff line number Diff line change
Expand Up @@ -158,4 +158,25 @@
<input name="surfaceshader" type="surfaceshader" nodename="Surf10" />
</surfacematerial>

<surfacematerial name="MultiConnect1" type="material" nodedef="ND_surfacematerial" topo="MultiConnect1_topo.mtlx">
<input name="surfaceshader" type="surfaceshader" nodename="Surf11" />
</surfacematerial>
<standard_surface name="Surf11" type="surfaceshader" nodedef="ND_standard_surface_surfaceshader">
<input name="base_color" type="color3" nodename="constant11a" />
<input name="opacity" type="color3" nodename="constant11a" />
<input name="subsurface" type="float" nodename="add11" />
<input name="transmission" type="float" nodename="constant11b" />
<input name="base" type="float" nodename="constant11b" />
</standard_surface>
<constant name="constant11a" type="color3" nodedef="ND_constant_color3">
<input name="value" type="color3" value="0.263273, 0.263273, 0.263273" />
</constant>
<constant name="constant11b" type="float" nodedef="ND_constant_float">
<input name="value" type="float" value="0.5" />
</constant>
<add name="add11" type="float" nodedef="ND_add_float">
<input name="in1" type="float" nodename="constant11b" />
<input name="in2" type="float" nodename="constant11b" />
</add>

</materialx>

0 comments on commit dd8a48c

Please sign in to comment.