diff --git a/resources/Materials/TestSuite/stdlib/nodegraph_inputs/top_level_input.mtlx b/resources/Materials/TestSuite/stdlib/nodegraph_inputs/top_level_input.mtlx
new file mode 100644
index 0000000000..d92eae7f19
--- /dev/null
+++ b/resources/Materials/TestSuite/stdlib/nodegraph_inputs/top_level_input.mtlx
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/source/MaterialXCore/Interface.cpp b/source/MaterialXCore/Interface.cpp
index 3a93a384c2..b733d3a4c7 100644
--- a/source/MaterialXCore/Interface.cpp
+++ b/source/MaterialXCore/Interface.cpp
@@ -305,7 +305,7 @@ InputPtr Input::getInterfaceInput() const
{
if (hasInterfaceName())
{
- ConstNodeGraphPtr graph = getAncestorOfType();
+ ConstGraphElementPtr graph = getAncestorOfType();
if (graph)
{
return graph->getInput(getInterfaceName());
diff --git a/source/MaterialXGenShader/ShaderNode.cpp b/source/MaterialXGenShader/ShaderNode.cpp
index c923e4be57..3eb750f1ff 100644
--- a/source/MaterialXGenShader/ShaderNode.cpp
+++ b/source/MaterialXGenShader/ShaderNode.cpp
@@ -381,7 +381,17 @@ void ShaderNode::initialize(const Node& node, const NodeDef& nodeDef, GenContext
ShaderInput* input = getInput(nodeValue->getName());
if (input)
{
- input->setPath(nodeValue->getNamePath());
+ string path = nodeValue->getNamePath();
+ InputPtr nodeInput = nodeValue->asA();
+ if (nodeInput)
+ {
+ InputPtr interfaceInput = nodeInput->getInterfaceInput();
+ if (interfaceInput)
+ {
+ path = interfaceInput->getNamePath();
+ }
+ }
+ input->setPath(path);
}
}