-
Notifications
You must be signed in to change notification settings - Fork 202
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-108691 - USD: undoing transform will not update manipulator #1266
Merged
Merged
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -93,6 +93,35 @@ def checkWorldSpaceXform(testCase, objects): | |
usdWorld = [y for x in t3d.inclusiveMatrix().matrix for y in x] | ||
assertVectorAlmostEqual(testCase, mayaWorld, usdWorld) | ||
|
||
class TestObserver(ufe.Observer): | ||
def __init__(self): | ||
super(TestObserver, self).__init__() | ||
self._transform3d = 0 | ||
self._valueChanged = 0 | ||
|
||
def __call__(self, notification): | ||
if (ufeUtils.ufeFeatureSetVersion() >= 2): | ||
if isinstance(notification, ufe.AttributeValueChanged): | ||
self._valueChanged += 1 | ||
if isinstance(notification, ufe.Transform3dChanged): | ||
self._transform3d += 1 | ||
|
||
@property | ||
def nbValueChanged(self): | ||
return self._valueChanged | ||
|
||
@property | ||
def nbTransform3d(self): | ||
return self._transform3d | ||
|
||
@property | ||
def notifications(self): | ||
return self._valueChanged + self._transform3d | ||
|
||
def reset(self): | ||
self._transform3d = 0 | ||
self._valueChanged = 0 | ||
|
||
class ComboCmdTestCase(testTRSBase.TRSTestCaseBase): | ||
'''Verify the Transform3d UFE interface, for multiple runtimes. | ||
|
||
|
@@ -812,6 +841,67 @@ def testFallback(self): | |
checkPivotsAndCompensations(self, mayaObj, usdSphere3d) | ||
checkPivotsAndCompensations(self, mayaObj, usdFallbackSphere3d) | ||
|
||
@unittest.skipUnless(ufeUtils.ufeFeatureSetVersion() >= 2, 'testPrimPropertyPathNotifs only available in UFE v2 or greater.') | ||
def testPrimPropertyPathNotifs(self): | ||
Comment on lines
+844
to
+845
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. New test to verify that these new are received. |
||
import mayaUsd_createStageWithNewLayer | ||
proxyShape = mayaUsd_createStageWithNewLayer.createStageWithNewLayer() | ||
proxyShapePath = ufe.PathString.path(proxyShape) | ||
proxyShapeItem = ufe.Hierarchy.createItem(proxyShapePath) | ||
proxyShapeContextOps = ufe.ContextOps.contextOps(proxyShapeItem) | ||
proxyShapeContextOps.doOp(['Add New Prim', 'Capsule']) | ||
|
||
# Select the capsule | ||
capPath = ufe.PathString.path('%s,/Capsule1' % proxyShape) | ||
capItem = ufe.Hierarchy.createItem(capPath) | ||
ufe.GlobalSelection.get().clear() | ||
ufe.GlobalSelection.get().append(capItem) | ||
|
||
# No notifications yet. | ||
obs = TestObserver() | ||
ufe.Attributes.addObserver(capItem, obs) | ||
ufe.Transform3d.addObserver(capItem, obs) | ||
self.assertEqual(obs.notifications, 0) | ||
|
||
# Move the capsule | ||
cmds.move(0, 10, 10) | ||
|
||
# Verify that we got both ValueChanged and Transform3d notifs. | ||
# Note: we should get notifs on both the "xformOp:translate" and | ||
# "xformOpOrder" attributes. We don't care how many, just that | ||
# we are getting both of these notifs kinds on both the move | ||
# and undo. | ||
self.assertTrue(obs.nbValueChanged > 0) | ||
self.assertTrue(obs.nbTransform3d > 0) | ||
|
||
# Reset observer and then undo and again verify notifs. | ||
obs.reset() | ||
self.assertEqual(obs.notifications, 0) | ||
cmds.undo() | ||
self.assertTrue(obs.nbValueChanged > 0) | ||
self.assertTrue(obs.nbTransform3d > 0) | ||
|
||
# Reset and test same thing with Rotate. | ||
obs.reset() | ||
cmds.rotate(10, 0, 0) | ||
self.assertTrue(obs.nbValueChanged > 0) | ||
self.assertTrue(obs.nbTransform3d > 0) | ||
obs.reset() | ||
self.assertEqual(obs.notifications, 0) | ||
cmds.undo() | ||
self.assertTrue(obs.nbValueChanged > 0) | ||
self.assertTrue(obs.nbTransform3d > 0) | ||
|
||
# Reset and test same thing with Scale. | ||
obs.reset() | ||
cmds.scale(2, 2, 2) | ||
self.assertTrue(obs.nbValueChanged > 0) | ||
self.assertTrue(obs.nbTransform3d > 0) | ||
obs.reset() | ||
self.assertEqual(obs.notifications, 0) | ||
cmds.undo() | ||
self.assertTrue(obs.nbValueChanged > 0) | ||
self.assertTrue(obs.nbTransform3d > 0) | ||
|
||
|
||
if __name__ == '__main__': | ||
unittest.main(verbosity=2) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As we discussed, make sure to send extra UFE notifs for USD prim property path notifs on xformop.