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

MAYA-106079 Skip Looks scopes #985

Merged
merged 3 commits into from
Dec 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion lib/usd/translators/scopeReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <pxr/pxr.h>
#include <pxr/usd/usd/prim.h>
#include <pxr/usd/usdGeom/scope.h>
#include <pxr/usd/usdShade/connectableAPI.h>

#include <maya/MObject.h>

Expand All @@ -27,7 +28,23 @@ PXR_NAMESPACE_OPEN_SCOPE
PXRUSDMAYA_DEFINE_READER(UsdGeomScope, args, context)
{
const UsdPrim& usdPrim = args.GetUsdPrim();
MObject parentNode = context->GetMayaNode(usdPrim.GetPath().GetParentPath(), true);

// If this scope contains only UsdShade nodes, just skip.
bool hasShadingData = false;
bool hasNonShadingData = false;
for (const auto& child : usdPrim.GetChildren()) {
if (UsdShadeConnectableAPI(child)) {
hasShadingData = true;
} else {
hasNonShadingData = true;
break;
}
}
if (hasShadingData && !hasNonShadingData) {
return false;
}

MObject parentNode = context->GetMayaNode(usdPrim.GetPath().GetParentPath(), true);

MStatus status;
MObject mayaNode;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,11 @@ def testUsdPreviewSurfaceRoundtrip(self):
"pSphere1Shape",
isMember="USD_Materials:usdPreviewSurface1SG"))

# Check that we have no spurious "Looks" transform
expectedTr = set(['front', 'persp', 'side', 'top', 'pSphere1', 'pSphere2'])
allTr = set(cmds.ls(tr=True))
self.assertEqual(allTr, expectedTr)

# Check connections:
self.assertEqual(
cmds.connectionInfo("usdPreviewSurface2.outColor", dfs=True),
Expand Down