File tree Expand file tree Collapse file tree 1 file changed +17
-19
lines changed
source/MaterialXBuildTools/buildLibrary Expand file tree Collapse file tree 1 file changed +17
-19
lines changed Original file line number Diff line number Diff line change @@ -67,28 +67,26 @@ void replaceNamedValues(mx::DocumentPtr doc, mx::ConstDocumentPtr stdlib)
6767 continue ;
6868 }
6969
70- if (!port->hasValueString ())
71- {
72- continue ;
73- }
74-
75- auto valueStr = port->getValueString ();
76- if (mx::stringStartsWith (valueStr, typeValuePrefix))
77- {
70+ mx::StringVec const & attributeNames = port->getAttributeNames ();
71+ for (std::string const & attrName: attributeNames) {
72+ std::string const & valueStr = port->getAttribute (attrName);
7873
79- auto typeDef = stdlib->getTypeDef (port->getType ());
80- if (!typeDef)
74+ if (mx::stringStartsWith (valueStr, typeValuePrefix))
8175 {
82- throw mx::Exception (" Unable to find typeDef '" +port->getType ()+" '" );
76+ auto typeDef = stdlib->getTypeDef (port->getType ());
77+ if (!typeDef)
78+ {
79+ throw mx::Exception (" Unable to find typeDef '" +port->getType ()+" '" );
80+ }
81+
82+ auto valueNameStr = valueStr.substr (typeValuePrefix.size ());
83+ if (!typeDef->hasAttribute (valueNameStr))
84+ {
85+ throw mx::Exception (" Unable to find named value '" +valueNameStr+" ' for type '" +typeDef->getName ()+" '" );
86+ }
87+
88+ port->setAttribute (attrName, typeDef->getAttribute (valueNameStr));
8389 }
84-
85- auto valueNameStr = valueStr.substr (typeValuePrefix.size ());
86- if (!typeDef->hasAttribute (valueNameStr))
87- {
88- throw mx::Exception (" Unable to find named value '" +valueNameStr+" ' for type '" +typeDef->getName ()+" '" );
89- }
90-
91- port->setValueString (typeDef->getAttribute (valueNameStr));
9290 }
9391 }
9492}
You can’t perform that action at this time.
0 commit comments