diff --git a/resources/Materials/TestSuite/stdlib/texture/tokenGraph.mtlx b/resources/Materials/TestSuite/stdlib/texture/tokenGraph.mtlx new file mode 100644 index 0000000000..de32b2368a --- /dev/null +++ b/resources/Materials/TestSuite/stdlib/texture/tokenGraph.mtlx @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/source/MaterialXCore/Element.cpp b/source/MaterialXCore/Element.cpp index 7e301ea77d..8adc7621be 100644 --- a/source/MaterialXCore/Element.cpp +++ b/source/MaterialXCore/Element.cpp @@ -434,6 +434,9 @@ StringResolverPtr Element::createStringResolver(const string& geom) const // Add element tokens addTokens(resolver); + // Add element tokens + addTokens(resolver); + return resolver; } @@ -447,6 +450,16 @@ void Element::addTokens(StringResolverPtr& resolver) const } } +void Element::addTokens(StringResolverPtr& resolver) const +{ + // Check for any sibling token Elements + ConstElementPtr parent = getParent(); + if (parent) + { + parent->addTokens(resolver); + } +} + string Element::asString() const { string res = "<" + getCategory();