From 549bcbe4b8f0728bff62bab292a86748b54fd9f1 Mon Sep 17 00:00:00 2001 From: Hamed Sabri Date: Tue, 14 Jul 2020 23:23:18 -0400 Subject: [PATCH 1/4] MAYA-105368: set the edittarget to default into RootLayer instead of SessionLayer. --- lib/mayaUsd/nodes/proxyShapeBase.cpp | 2 +- lib/mayaUsd/nodes/stageNode.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/mayaUsd/nodes/proxyShapeBase.cpp b/lib/mayaUsd/nodes/proxyShapeBase.cpp index 614ac48d3b..925bafa825 100644 --- a/lib/mayaUsd/nodes/proxyShapeBase.cpp +++ b/lib/mayaUsd/nodes/proxyShapeBase.cpp @@ -580,7 +580,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; From 6b3c45c208fec40acb146108a5436e4dc9ece0d5 Mon Sep 17 00:00:00 2001 From: Hamed Sabri Date: Wed, 15 Jul 2020 17:57:35 -0400 Subject: [PATCH 2/4] Fix testRename failure. --- test/lib/ufe/testRename.py | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/test/lib/ufe/testRename.py b/test/lib/ufe/testRename.py index 51fd43b6c9..82ba9bfd02 100644 --- a/test/lib/ufe/testRename.py +++ b/test/lib/ufe/testRename.py @@ -114,9 +114,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 @@ -181,10 +181,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 @@ -245,7 +244,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): @@ -318,8 +317,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` @@ -354,12 +352,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 From 450eed6524b118f82acbb7fe08682a8d444e5a0a Mon Sep 17 00:00:00 2001 From: Hamed Sabri Date: Tue, 4 Aug 2020 19:09:57 -0400 Subject: [PATCH 3/4] Fix testMayaUsdProxyAccessor failure. --- test/lib/testMayaUsdProxyAccessor.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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') From 2bb3e16d332c5d03d192e0dd296b42a8474524cd Mon Sep 17 00:00:00 2001 From: Hamed Sabri Date: Tue, 4 Aug 2020 19:14:09 -0400 Subject: [PATCH 4/4] Fix testParentCmd failure. --- test/lib/ufe/testParentCmd.py | 20 -------------------- 1 file changed, 20 deletions(-) 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