Skip to content

Commit

Permalink
Merge pull request #3403 from Autodesk/azharia/EMSUSD-692/Add-Test-Ca…
Browse files Browse the repository at this point in the history
…ses-For-Material-FannedOut-File-Nodes

Add test cases for material fanned out file nodes
  • Loading branch information
seando-adsk authored Oct 26, 2023
2 parents 7e8a092 + 434b841 commit 179a79d
Show file tree
Hide file tree
Showing 4 changed files with 1,245 additions and 12 deletions.
17 changes: 5 additions & 12 deletions lib/mayaUsd/fileio/shading/shadingModeUseRegistry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,8 @@ class UseRegistryShadingModeExporter : public UsdMayaShadingModeExporter
return UsdShadeShader();
}

MObjectArray allowedNodes;
UsdMayaUtil::MObjectHandleUnorderedSet allowedNodes;

for (; !iterDepGraphNodeLevel.isDone(); iterDepGraphNodeLevel.next()) {
MObject currentNode = iterDepGraphNodeLevel.currentItem(&status);
if (status != MS::kSuccess) {
Expand All @@ -201,7 +202,8 @@ class UseRegistryShadingModeExporter : public UsdMayaShadingModeExporter
continue;
}

allowedNodes.append(currentNode);
MObjectHandle nodeHandle(currentNode);
allowedNodes.insert(nodeHandle);
}

MItDependencyGraph iterDepGraph(
Expand Down Expand Up @@ -282,16 +284,7 @@ class UseRegistryShadingModeExporter : public UsdMayaShadingModeExporter
continue;
}

bool allowedNode = false;
for (unsigned int j = 0; j < allowedNodes.length(); ++j) {
if (dstPlug.node() == allowedNodes[j]) {
allowedNode = true;
break;
}
}
// Only generate shader writers if the plug belongs to an allowed node
// that is needed.
if (!allowedNode) {
if (!allowedNodes.count(dstPlug.node())) {
continue;
}

Expand Down
1 change: 1 addition & 0 deletions test/lib/usd/translators/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ if (MAYA_APP_VERSION VERSION_GREATER 2022)
set(MTLX_TEST_SCRIPT_FILES
testUsdExportMaterialX.py
testUsdImportMaterialX.py
testUsdExportFannedOutFileNodesMaterial.py
)
foreach(script ${MTLX_TEST_SCRIPT_FILES})
mayaUsd_get_unittest_target(target ${script})
Expand Down
Loading

0 comments on commit 179a79d

Please sign in to comment.