diff --git a/lib/mayaUsd/fileio/primUpdaterManager.cpp b/lib/mayaUsd/fileio/primUpdaterManager.cpp index 75746c5357..8aa8b75002 100644 --- a/lib/mayaUsd/fileio/primUpdaterManager.cpp +++ b/lib/mayaUsd/fileio/primUpdaterManager.cpp @@ -1124,6 +1124,11 @@ bool PrimUpdaterManager::editAsMaya(const Ufe::Path& path, const VtDictionary& u return false; } + if (pulledPrim.IsInstanceProxy()) { + TF_WARN("Cannot edit a USD instance proxy."); + return false; + } + MayaUsd::ProgressBarScope progressBar(7, "Converting to Maya Data"); PushPullScope scopeIt(_inPushPull); @@ -1211,6 +1216,11 @@ bool PrimUpdaterManager::canEditAsMaya(const Ufe::Path& path) const return false; } + // USD refuses that we modify point instance proxies, so detect that. + if (prim.IsInstanceProxy()) { + return false; + } + VtDictionary userArgs; UsdMayaPrimUpdaterContext context(UsdTimeCode::Default(), prim.GetStage(), userArgs); diff --git a/test/lib/mayaUsd/fileio/testEditAsMaya.py b/test/lib/mayaUsd/fileio/testEditAsMaya.py index c4de5de591..9cb80d52d3 100644 --- a/test/lib/mayaUsd/fileio/testEditAsMaya.py +++ b/test/lib/mayaUsd/fileio/testEditAsMaya.py @@ -372,8 +372,19 @@ def testIllegalEditAsMaya(self): stage = mayaUsd.lib.GetPrim(proxyShapePathStr).GetStage() blendShape = stage.DefinePrim('/BlendShape1', 'BlendShape') scope = stage.DefinePrim('/Scope1', 'Scope') - scope = stage.DefinePrim('/Mesh1', 'Mesh') - scope = stage.DefinePrim('/Material1', 'Material') + self.assertIsNotNone(scope) + mesh = stage.DefinePrim('/Mesh1', 'Mesh') + self.assertIsNotNone(mesh) + mat = stage.DefinePrim('/Material1', 'Material') + self.assertIsNotNone(mat) + instanced = stage.DefinePrim('/Instanced', 'Xform') + self.assertIsNotNone(instanced) + proto = stage.DefinePrim('/Proto', 'Xform') + self.assertIsNotNone(proto) + protoMesh = stage.DefinePrim('/Proto/Mesh', 'Mesh') + self.assertIsNotNone(protoMesh) + instanced.GetReferences().AddInternalReference('/Proto') + instanced.SetInstanceable(True) blendShapePathStr = proxyShapePathStr + ',/BlendShape1' scopePathStr = proxyShapePathStr + ',/Scope1' @@ -398,6 +409,10 @@ def testIllegalEditAsMaya(self): # capability. self.assertFalse(mayaUsd.lib.PrimUpdaterManager.canEditAsMaya(proxyShapePathStr + ',/Material1')) + # Instance proxies cannot be edited as Maya: it explicitly disables this + # capability. + self.assertFalse(mayaUsd.lib.PrimUpdaterManager.canEditAsMaya(proxyShapePathStr + ',/Instanced/Proto/Mesh')) + def testSessionLayer(self): '''Verify that the edit gets on the sessionLayer instead of the editTarget layer.'''