Skip to content

Commit

Permalink
address feedback.
Browse files Browse the repository at this point in the history
  • Loading branch information
Hamed Sabri committed Apr 7, 2021
1 parent 0164510 commit 0b42a42
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 16 deletions.
30 changes: 14 additions & 16 deletions lib/mayaUsd/ufe/Utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -422,25 +422,23 @@ bool isAttributeEditAllowed(const PXR_NS::UsdAttribute& attr, std::string* errMs

bool isAttributeEditAllowed(const UsdPrim& prim, const TfToken& attrName)
{
if (prim.IsA<UsdGeomXformable>()) {

std::string errMsg;

// check for xformOp:tokenName in XformOpOrderAttr first
UsdGeomXformable xformable(prim);
if (!isAttributeEditAllowed(xformable.GetXformOpOrderAttr(), &errMsg)) {
MGlobal::displayError(errMsg.c_str());
return false;
} else {
// check for xformOp:tokenName
if (UsdGeomXformOp::IsXformOp(attrName)) {
if (!isAttributeEditAllowed(prim.GetAttribute(attrName), &errMsg)) {
MGlobal::displayError(errMsg.c_str());
return false;
}
std::string errMsg;

UsdGeomXformable xformable(prim);
if (xformable) {
if (UsdGeomXformOp::IsXformOp(attrName)) {
// check for the attribute in XformOpOrderAttr first
if (!isAttributeEditAllowed(xformable.GetXformOpOrderAttr(), &errMsg)) {
MGlobal::displayError(errMsg.c_str());
return false;
}
}
}
// check the attribute itself
if (!isAttributeEditAllowed(prim.GetAttribute(attrName), &errMsg)) {
MGlobal::displayError(errMsg.c_str());
return false;
}

return true;
}
Expand Down
1 change: 1 addition & 0 deletions test/lib/ufe/testAttributeBlock.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ def testAttributeBlocking3dCommonApi(self):
# authoring new transformation edit is allowed.
self.assertTrue(mayaUsdUfe.isAttributeEditAllowed(rotateAttr))

@unittest.skipUnless(ufeUtils.ufeFeatureSetVersion() >= 2, 'testAttributeBlocking3dMatrixOps only available in UFE v2 or greater.')
def testAttributeBlocking3dMatrixOps(self):
'''
Verify authoring transformation attribute(s) in weaker layer(s) are not permitted if there exist opinion(s)
Expand Down

0 comments on commit 0b42a42

Please sign in to comment.