Skip to content
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

Merged
merged 1 commit into from
Apr 6, 2022

Conversation

JGamache-autodesk
Copy link
Collaborator

  • 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());
Copy link
Collaborator Author

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());
Copy link
Collaborator Author

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
Copy link
Collaborator Author

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.

@JGamache-autodesk JGamache-autodesk added ready-for-merge Development process is finished, PR is ready for merge and removed ready-for-merge Development process is finished, PR is ready for merge labels Apr 1, 2022
@seando-adsk seando-adsk merged commit 41c0c26 into dev Apr 6, 2022
@seando-adsk seando-adsk deleted the t_gamaj/MAYA-MAYA-121534/mtlx_cleanups branch April 6, 2022 14:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-for-merge Development process is finished, PR is ready for merge vp2renderdelegate Related to VP2RenderDelegate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants