diff --git a/resources/Materials/TestSuite/stdlib/defaultgeomprop/defaultgeomprop.mtlx b/resources/Materials/TestSuite/stdlib/defaultgeomprop/defaultgeomprop.mtlx
new file mode 100644
index 0000000000..86bddc9650
--- /dev/null
+++ b/resources/Materials/TestSuite/stdlib/defaultgeomprop/defaultgeomprop.mtlx
@@ -0,0 +1,41 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/source/MaterialXCore/Interface.cpp b/source/MaterialXCore/Interface.cpp
index 24d3ccfe0d..1c12e38ded 100644
--- a/source/MaterialXCore/Interface.cpp
+++ b/source/MaterialXCore/Interface.cpp
@@ -295,7 +295,7 @@ bool Input::validate(string* message) const
if (hasDefaultGeomPropString())
{
- validateRequire(parent->isA(), res, message, "Invalid defaultgeomprop on non-definition input");
+ validateRequire(parent->isA() || parent->isA(), res, message, "Invalid defaultgeomprop on non-definition and non-nodegraph input");
validateRequire(getDefaultGeomProp() != nullptr, res, message, "Invalid defaultgeomprop string");
}
if (parent->isA())
diff --git a/source/MaterialXGenShader/ShaderGraph.cpp b/source/MaterialXGenShader/ShaderGraph.cpp
index 0f39b46c32..e9a3b50b79 100644
--- a/source/MaterialXGenShader/ShaderGraph.cpp
+++ b/source/MaterialXGenShader/ShaderGraph.cpp
@@ -81,7 +81,7 @@ void ShaderGraph::createConnectedNodes(const ElementPtr& downstreamElement,
ElementPtr connectingElement,
GenContext& context)
{
- // Create the node if it doesn't exists
+ // Create the node if it doesn't exist.
NodePtr upstreamNode = upstreamElement->asA();
if (!upstreamNode)
{
@@ -95,6 +95,22 @@ void ShaderGraph::createConnectedNodes(const ElementPtr& downstreamElement,
newNode = createNode(upstreamNode, context);
}
+ // Handle interface inputs with default geometric properties.
+ for (InputPtr activeInput : upstreamNode->getActiveInputs())
+ {
+ if (!activeInput->hasInterfaceName() || activeInput->getConnectedNode())
+ {
+ continue;
+ }
+
+ InputPtr graphInput = activeInput->getInterfaceInput();
+ if (graphInput && graphInput->hasDefaultGeomPropString())
+ {
+ ShaderInput* shaderInput = getNode(upstreamNode->getName())->getInput(activeInput->getName());
+ addDefaultGeomNode(shaderInput, *graphInput->getDefaultGeomProp(), context);
+ }
+ }
+
//
// Make connections
//