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..2857138e11 100644
--- a/source/MaterialXGenShader/ShaderGraph.cpp
+++ b/source/MaterialXGenShader/ShaderGraph.cpp
@@ -95,6 +95,24 @@ void ShaderGraph::createConnectedNodes(const ElementPtr& downstreamElement,
newNode = createNode(upstreamNode, context);
}
+ //
+ // Handle defaultgeomprops
+ //
+
+ const vector activeInputs = upstreamNode->getActiveInputs();
+ for (const InputPtr& activeInput : activeInputs)
+ {
+ if (!activeInput->hasInterfaceName() || activeInput->getConnectedNode()) {
+ continue;
+ }
+ const auto graphInput = activeInput->getInterfaceInput();
+ // We have an input connected to an interface. See if it has defaultgeomprop
+ if (graphInput && graphInput->hasDefaultGeomPropString()) {
+ ShaderInput* shaderInput = getNode(upstreamNode->getName())->getInput(activeInput->getName());
+ addDefaultGeomNode(shaderInput, *graphInput->getDefaultGeomProp(), context);
+ }
+ }
+
//
// Make connections
//