-
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
MAYA-114979 MAYA-114731 Fix correctness issues #1937
MAYA-114979 MAYA-114731 Fix correctness issues #1937
Conversation
This fixes #1834 for the last correctness problems mentioned - Use a separate varnameStr for MaterialX since the type is not compatible with the varname used in UsdPreviewSurface - Shared place2dTexture nodes are now shared on MaterialX export - NodeGraph is used instead of Scope to isolate shaders by type in multi-material export - NodeGraph boundaries are not skipped anymore by shader connections - Cleaned-up code producing empty NodeGraphs
@@ -135,6 +129,15 @@ MtlxUsd_PreviewSurfaceWriter::MtlxUsd_PreviewSurfaceWriter( | |||
|
|||
// All connections go directly to the node graph: | |||
if (attrPlug.isConnected()) { | |||
if (!nodegraphSchema) { |
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.
Just-in-time creation to reduce number of empty NodeGraph generated.
} | ||
SdfPath primvarReaderPath = _GetPlace2DTexturePath(depNodeFn); | ||
|
||
if (!GetUsdStage()->GetPrimAtPath(primvarReaderPath)) { |
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.
Mostly indentation since we now detect shared place2dTexture nodes. Similar to what was done in usdFileTextureWriter.cpp in the first PR of the series.
// easy specialization based on UV mappings to geometries: | ||
UsdPrim materialPrim = primvarReaderSchema.GetPrim().GetParent(); | ||
UsdShadeMaterial materialSchema(materialPrim); | ||
while (!materialSchema && materialPrim) { |
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.
Here we make sure to properly connect the NodeGraph.
materialSchema = UsdShadeMaterial(GetUsdStage()->GetPrimAtPath(materialPath)); | ||
UsdPrim materialPrim = primvarReaderShaderSchema.GetPrim().GetParent(); | ||
UsdShadeMaterial materialSchema(materialPrim); | ||
while (!materialSchema && materialPrim) { |
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.
Connect all intermediate NodeGraphs.
// Connect the output of the primvar reader to the texture coordinate | ||
// input of the UV texture. | ||
texSchema.CreateInput(TrMtlxTokens->texcoord, SdfValueTypeNames->Float2) | ||
.ConnectToSource(primvarReaderOutput); |
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.
Line 206-212 could be taken out of the if/else block instead of having a duplication of code.
Fantastic - thank you so much! |
This fixes #1834 for the last correctness problems mentioned