diff --git a/lib/mayaUsd/nodes/proxyShapeBase.cpp b/lib/mayaUsd/nodes/proxyShapeBase.cpp index 6ad087ab48..221ab09094 100644 --- a/lib/mayaUsd/nodes/proxyShapeBase.cpp +++ b/lib/mayaUsd/nodes/proxyShapeBase.cpp @@ -581,7 +581,7 @@ MayaUsdProxyShapeBase::computeInStageDataCached(MDataBlock& dataBlock) loadSet); } - usdStage->SetEditTarget(usdStage->GetSessionLayer()); + usdStage->SetEditTarget(usdStage->GetRootLayer()); } else { // Create a new stage in memory with an anonymous root layer. diff --git a/lib/mayaUsd/nodes/stageNode.cpp b/lib/mayaUsd/nodes/stageNode.cpp index 6004d045c9..09d8fd75c6 100644 --- a/lib/mayaUsd/nodes/stageNode.cpp +++ b/lib/mayaUsd/nodes/stageNode.cpp @@ -128,7 +128,7 @@ UsdMayaStageNode::compute(const MPlug& plug, MDataBlock& dataBlock) usdStage = UsdStage::Open(rootLayer, ArGetResolver().GetCurrentContext()); - usdStage->SetEditTarget(usdStage->GetSessionLayer()); + usdStage->SetEditTarget(usdStage->GetRootLayer()); } SdfPath primPath; diff --git a/test/lib/testMayaUsdProxyAccessor.py b/test/lib/testMayaUsdProxyAccessor.py index 04a1293692..28443e02be 100644 --- a/test/lib/testMayaUsdProxyAccessor.py +++ b/test/lib/testMayaUsdProxyAccessor.py @@ -627,6 +627,12 @@ def validatePassivelyAffectedReset(self, cachingScope): ufeItemParent = makeUfePath(nodeDagPath,'/ParentA') selectUfeItems(ufeItemParent) + # We are going to manipulate animated prim. Let's make sure this opinion can be authored + # since currently UFE will author attribute values at default time which won't override + # attributes with time sampled data. Switching to session layer allows such manipulation + # to override time sampled data from root layer. + stage.SetEditTarget(stage.GetSessionLayer()) + # Current limitation requires access plugs to be created before we start manipulating and keying translatePlug = pa.getOrCreateAccessPlug(ufeItemParent, usdAttrName='xformOp:translate') rotatePlug = pa.getOrCreateAccessPlug(ufeItemParent, usdAttrName='xformOp:rotateXYZ') @@ -738,6 +744,12 @@ def validateKeyframeWithCommands(self, cachingScope): # Get UFE item and select it ufeItemParent = makeUfePath(nodeDagPath,'/ParentA') selectUfeItems(ufeItemParent) + + # We are going to manipulate animated prim. Let's make sure this opinion can be authored + # since currently UFE will author attribute values at default time which won't override + # attributes with time sampled data. Switching to session layer allows such manipulation + # to override time sampled data from root layer. + stage.SetEditTarget(stage.GetSessionLayer()) # Current limitation requires access plugs to be created before we start manipulating and keying translatePlug = pa.getOrCreateAccessPlug(ufeItemParent, usdAttrName='xformOp:translate') diff --git a/test/lib/ufe/testParentCmd.py b/test/lib/ufe/testParentCmd.py index c53c126681..b8e56b9915 100644 --- a/test/lib/ufe/testParentCmd.py +++ b/test/lib/ufe/testParentCmd.py @@ -89,11 +89,6 @@ def testParentRelative(self): stage = mayaUsd.ufe.getStage(str(shapeSegment)) # check GetLayerStack behavior - self.assertEqual(stage.GetLayerStack()[0], stage.GetSessionLayer()) - self.assertEqual(stage.GetEditTarget().GetLayer(), stage.GetSessionLayer()) - - # set the edit target to the root layer - stage.SetEditTarget(stage.GetRootLayer()) self.assertEqual(stage.GetEditTarget().GetLayer(), stage.GetRootLayer()) # The cube is not a child of the cylinder. @@ -184,11 +179,6 @@ def testParentAbsolute(self): stage = mayaUsd.ufe.getStage(str(shapeSegment)) # check GetLayerStack behavior - self.assertEqual(stage.GetLayerStack()[0], stage.GetSessionLayer()) - self.assertEqual(stage.GetEditTarget().GetLayer(), stage.GetSessionLayer()) - - # set the edit target to the root layer - stage.SetEditTarget(stage.GetRootLayer()) self.assertEqual(stage.GetEditTarget().GetLayer(), stage.GetRootLayer()) # The cube is not a child of the cylinder. @@ -275,11 +265,6 @@ def testParentToProxyShape(self): stage = mayaUsd.ufe.getStage(str(shapeSegment)) # check GetLayerStack behavior - self.assertEqual(stage.GetLayerStack()[0], stage.GetSessionLayer()) - self.assertEqual(stage.GetEditTarget().GetLayer(), stage.GetSessionLayer()) - - # set the edit target to the root layer - stage.SetEditTarget(stage.GetRootLayer()) self.assertEqual(stage.GetEditTarget().GetLayer(), stage.GetRootLayer()) # The sphere is not a child of the proxy shape. @@ -366,11 +351,6 @@ def testAlreadyChild(self): stage = mayaUsd.ufe.getStage(str(shapeSegment)) # check GetLayerStack behavior - self.assertEqual(stage.GetLayerStack()[0], stage.GetSessionLayer()) - self.assertEqual(stage.GetEditTarget().GetLayer(), stage.GetSessionLayer()) - - # set the edit target to the root layer - stage.SetEditTarget(stage.GetRootLayer()) self.assertEqual(stage.GetEditTarget().GetLayer(), stage.GetRootLayer()) # The sphere is not a child of the cylinder diff --git a/test/lib/ufe/testRename.py b/test/lib/ufe/testRename.py index a38e1dbff6..366ef0f845 100644 --- a/test/lib/ufe/testRename.py +++ b/test/lib/ufe/testRename.py @@ -132,9 +132,9 @@ def testRename(self): # get the USD stage stage = mayaUsd.ufe.getStage(str(mayaPathSegment)) - # set the edit target to the root layer - stage.SetEditTarget(stage.GetRootLayer()) + # by default edit target is set to the Rootlayer. self.assertEqual(stage.GetEditTarget().GetLayer(), stage.GetRootLayer()) + self.assertTrue(stage.GetRootLayer().GetPrimAtPath("/TreeBase")) # get default prim @@ -199,10 +199,9 @@ def testRenameUndo(self): # check GetLayerStack behavior self.assertEqual(stage.GetLayerStack()[0], stage.GetSessionLayer()) - self.assertEqual(stage.GetEditTarget().GetLayer(), stage.GetSessionLayer()) + self.assertEqual(stage.GetEditTarget().GetLayer(), stage.GetRootLayer()) - # set the edit target to the root layer - stage.SetEditTarget(stage.GetRootLayer()) + # by default edit target is set to the Rootlayer. self.assertEqual(stage.GetEditTarget().GetLayer(), stage.GetRootLayer()) # rename @@ -263,7 +262,7 @@ def testRenameRestrictionSameLayerDef(self): # check GetLayerStack behavior self.assertEqual(stage.GetLayerStack()[0], stage.GetSessionLayer()) - self.assertEqual(stage.GetEditTarget().GetLayer(), stage.GetSessionLayer()) + self.assertEqual(stage.GetEditTarget().GetLayer(), stage.GetRootLayer()) # expect the exception happens with self.assertRaises(RuntimeError): @@ -336,8 +335,7 @@ def testRenameUniqueName(self): # get the USD stage stage = mayaUsd.ufe.getStage(str(mayaPathSegment)) - # set the edit target to the root layer - stage.SetEditTarget(stage.GetRootLayer()) + # by default edit target is set to the Rootlayer. self.assertEqual(stage.GetEditTarget().GetLayer(), stage.GetRootLayer()) # rename `/TreeBase/trunk` to `/TreeBase/leavesXform` @@ -372,12 +370,7 @@ def testRenameSpecialCharacter(self): # get the USD stage stage = mayaUsd.ufe.getStage(str(mayaPathSegment)) - # check GetLayerStack behavior - self.assertEqual(stage.GetLayerStack()[0], stage.GetSessionLayer()) - self.assertEqual(stage.GetEditTarget().GetLayer(), stage.GetSessionLayer()) - - # set the edit target to the root layer - stage.SetEditTarget(stage.GetRootLayer()) + # by default edit target is set to the Rootlayer. self.assertEqual(stage.GetEditTarget().GetLayer(), stage.GetRootLayer()) # rename with special chars