diff --git a/lib/mayaUsd/ufe/Utils.cpp b/lib/mayaUsd/ufe/Utils.cpp index 5c527e82ce..3b7caba6dd 100644 --- a/lib/mayaUsd/ufe/Utils.cpp +++ b/lib/mayaUsd/ufe/Utils.cpp @@ -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()) { - - 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; } diff --git a/test/lib/ufe/testAttributeBlock.py b/test/lib/ufe/testAttributeBlock.py index a5dfc40550..41cd679d52 100644 --- a/test/lib/ufe/testAttributeBlock.py +++ b/test/lib/ufe/testAttributeBlock.py @@ -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)