Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MAYA-105368: set the edittarget to default into RootLayer instead of SessionLayer #661

Merged
merged 5 commits into from
Aug 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/mayaUsd/nodes/proxyShapeBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion lib/mayaUsd/nodes/stageNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
12 changes: 12 additions & 0 deletions test/lib/testMayaUsdProxyAccessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -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())
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kxl-adsk thanks for the patch that you gave me earlier.


# Current limitation requires access plugs to be created before we start manipulating and keying
translatePlug = pa.getOrCreateAccessPlug(ufeItemParent, usdAttrName='xformOp:translate')
Expand Down
20 changes: 0 additions & 20 deletions test/lib/ufe/testParentCmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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())
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kxl-adsk merged in dev into my branch and fixed the parenting test failures accordingly.


# The sphere is not a child of the cylinder
Expand Down
21 changes: 7 additions & 14 deletions test/lib/ufe/testRename.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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`
Expand Down Expand Up @@ -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
Expand Down