Skip to content

Commit

Permalink
Merge pull request #985 from Autodesk/t_gamaj/MAYA-106079/skip_looks
Browse files Browse the repository at this point in the history
MAYA-106079 Skip Looks scopes
  • Loading branch information
Krystian Ligenza authored Dec 9, 2020
2 parents f154eb6 + 595fb77 commit 1439297
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
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

0 comments on commit 1439297

Please sign in to comment.