-
Notifications
You must be signed in to change notification settings - Fork 203
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix MaterialX not working with AMD material lib #2236
Conversation
JGamache-autodesk
commented
Apr 1, 2022
- Fixed a bug where a folded constant was mistook for a renamed variable
- Fixed a bug where constant nodes had incorrect input name
- Cleaned up unnecessary MaterialX data copied by addInputFromNodeDef
- Fixed a bug where a folded constant was mistook for a renamed variable - Fixed a bug where constant nodes had incorrect input name - Cleaned up unnecessary MaterialX data copied by addInputFromNodeDef
@@ -484,11 +486,11 @@ void _AddMissingTexcoordReaders(mx::DocumentPtr& mtlxDoc) | |||
_mtlxTokens->geompropvalue.GetString(), | |||
_mtlxTokens->ST_reader.GetString(), | |||
_mtlxTokens->vector2.GetString()); | |||
mx::ValueElementPtr prpInput | |||
= stReader->addInputFromNodeDef(_mtlxTokens->geomprop.GetString()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
addInputFromNodeDef will copy all properties from the NodeDef. We only need name and type.
passthruNode->addInputFromNodeDef(_mtlxTokens->in.GetString()); | ||
passthruNode->setConnectedNodeName(_mtlxTokens->in.GetString(), newSource->getName()); | ||
passthruNode->addInput( | ||
_mtlxTokens->value.GetString(), _mtlxTokens->vector3.GetString()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bugfix: the input of a constant node is called "value", not "in".
MString uniqueName(input.c_str()); | ||
while (!input.empty() && path.back() != input.back()) { | ||
input.pop_back(); | ||
// If a digit was added, we should be able to find the last path element inside the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We want to fix N2_color renamed to N2_color1 because color is a reserved keyword. There was a bug where a constant node N3_value would be folded into N6_in1. This caused a crash because we could not fix the name correctly, and we should not even try to fix the name.