-
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
Implement and test setMatrixCmd() for single matrix op prims. #1102
Implement and test setMatrixCmd() for single matrix op prims. #1102
Conversation
@@ -16,7 +16,6 @@ | |||
|
|||
#include <mayaUsd/undo/UsdUndoBlock.h> | |||
#include <mayaUsd/undo/UsdUndoManager.h> | |||
#include <mayaUsd/undo/UsdUndoableItem.h> |
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.
Cleanup.
// our UsdTransform3dBaseHandler base class does not know how to edit the | ||
// argument either. Simply delegate to the next handler in the list. | ||
return _nextHandler->transform3d(item); | ||
// Remove code duplication with editTransform3d(). PPT, 21-Jan-2021. |
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.
Copy-paste from editTransform3d() a bit of a shame, hopefully can fix later.
@@ -162,21 +162,13 @@ createTransform3d(const Ufe::SceneItem::Ptr& item, NextTransform3dFn nextTransfo | |||
return stackOps.empty() ? nextTransform3dFn() : UsdTransform3dMayaXformStack::create(usdItem); | |||
} | |||
|
|||
// Class for setMatrixCmd() implementation. Should be rolled into a future | |||
// command class with full undo / redo support | |||
// Class for setMatrixCmd() implementation. UsdUndoBlock data member and |
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.
Changed to use new undo / redo framework.
@@ -26,6 +26,8 @@ | |||
|
|||
#include <memory> | |||
|
|||
PXR_NAMESPACE_USING_DIRECTIVE |
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.
Was relying on UsdUndoableItem.h to define this, but UsdUndoableItem.h doesn't need this definition and was removed.
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.
Hey @ppt-adsk! I noticed this pattern in some of the other UFE classes and I actually intentionally avoided doing the same here when I added this command in #1094. This macro effectively resolves to a using namespace ...
statement which it seems like we would want to avoid in headers:
https://github.com/PixarAnimationStudios/USD/blob/dc710925675f7f58f7a37f6c18d046a687b09271/pxr/pxr.h.in#L52
Instead I had attempted to resolve the symbols by prefixing all of the USD types with PXR_NS::
, but looks like I probably missed a few. Reading through that class again, I would guess it's at least these in the header:
UsdPrim _prim; |
TfToken _kind; |
And maybe this in the implementation:
UsdModelAPI(_prim).SetKind(_kind); |
Though I think using the PXR_NAMESPACE_USING_DIRECTIVE
macro in a .cpp file would be fair game if we wanted to do that instead.
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.
Makes perfect sense, fully agree with you. Let me wait until a bit more feedback builds up and I'll fix this.
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.
Sounds good, thanks! And sorry for leaving that trap for you. :)
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.
Are we ready to set a course on getting rid of all using
directives from the header files in the core modules? That would be fantastic.
@@ -14,16 +14,14 @@ | |||
// limitations under the License. | |||
// | |||
|
|||
#ifndef MAYAUSD_UNDO_UNDOABLE_BLOCK_H |
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.
Fixed copy-paste damage... Was causing really, really weird compilation errors for my local changes...
|
||
#include <mayaUsd/base/api.h> | ||
|
||
#include <functional> | ||
#include <vector> | ||
|
||
PXR_NAMESPACE_USING_DIRECTIVE |
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.
No Pixar namespace declarations or definitions here, removed.
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.
love it
@@ -244,6 +244,136 @@ def testParentAbsolute(self): | |||
cylChildren = cylHier.children() | |||
self.assertEqual(len(cylChildren), 1) | |||
|
|||
def testParentAbsoluteSingleMatrixOp(self): |
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.
Test written with TDD approach: failed initially, now passes.
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.
Leading by example!
// Remove code duplication with editTransform3d(). PPT, 21-Jan-2021. | ||
UsdSceneItem::Ptr usdItem = std::dynamic_pointer_cast<UsdSceneItem>(item); | ||
#if !defined(NDEBUG) | ||
assert(usdItem); |
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.
I haven't really heard any good reason yet why to use these naked asserts over a rich number of possibilities to raise an error/warning via Tf diagnostic macros. Please switch over.
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.
Agreed, this is simply a copy-paste of older code.
@@ -26,6 +26,8 @@ | |||
|
|||
#include <memory> | |||
|
|||
PXR_NAMESPACE_USING_DIRECTIVE |
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.
Are we ready to set a course on getting rid of all using
directives from the header files in the core modules? That would be fantastic.
|
||
#include <mayaUsd/base/api.h> | ||
|
||
#include <functional> | ||
#include <vector> | ||
|
||
PXR_NAMESPACE_USING_DIRECTIVE |
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.
love it
@@ -244,6 +244,136 @@ def testParentAbsolute(self): | |||
cylChildren = cylHier.children() | |||
self.assertEqual(len(cylChildren), 1) | |||
|
|||
def testParentAbsoluteSingleMatrixOp(self): |
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.
Leading by example!
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.
Looks like the parent test is failing with PR122
FAIL: testParentAbsolute (testParentCmd.ParentCmdTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File "testParentCmd.py", line 225, in testParentAbsolute
self, cubeWorldListPre, matrixToList(cubeWorld), places=6)
File "E:\Dev\usd\_workspaces_latest\Maya_USD_PR_PR\build\RelWithDebInfo\test\python\testUtils.py", line 31, in assertVectorAlmostEqual
testCase.assertAlmostEqual(va, vb, places)
AssertionError: 0.8660254037844389 != 2.0762759672369597 within 6 places
======================================================================
FAIL: testParentAbsoluteSingleMatrixOp (testParentCmd.ParentCmdTestCase)
Test parent -absolute on prim with a single matrix op.
----------------------------------------------------------------------
Traceback (most recent call last):
File "testParentCmd.py", line 367, in testParentAbsoluteSingleMatrixOp
self, cubeWorldListPre, matrixToList(cubeWorld), places=6)
File "E:\Dev\usd\_workspaces_latest\Maya_USD_PR_PR\build\RelWithDebInfo\test\python\testUtils.py", line 31, in assertVectorAlmostEqual
testCase.assertAlmostEqual(va, vb, places)
AssertionError: 0.8660254037844389 != 2.0762759672369597 within 6 places
======================================================================
FAIL: testParentToProxyShape (testParentCmd.ParentCmdTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File "testParentCmd.py", line 437, in testParentToProxyShape
self, sphereWorldListPre, matrixToList(sphereWorld), places=6)
File "E:\Dev\usd\_workspaces_latest\Maya_USD_PR_PR\build\RelWithDebInfo\test\python\testUtils.py", line 31, in assertVectorAlmostEqual
testCase.assertAlmostEqual(va, vb, places)
AssertionError: 0.0 != -3.745325503251487 within 6 places
----------------------------------------------------------------------
Ran 9 tests in 1.947s
FAILED (failures=3)
@ppt-adsk Removing |
The only failure comes from our signing server hang. Marking this as ready for merge. |
Also, the remaining test failures were fixed by 4a6c729 |
No description provided.