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

Implement and test setMatrixCmd() for single matrix op prims. #1102

Merged
merged 5 commits into from
Feb 5, 2021

Conversation

ppt-adsk
Copy link
Collaborator

No description provided.

@ppt-adsk ppt-adsk requested a review from kxl-adsk January 22, 2021 19:13
@@ -16,7 +16,6 @@

#include <mayaUsd/undo/UsdUndoBlock.h>
#include <mayaUsd/undo/UsdUndoManager.h>
#include <mayaUsd/undo/UsdUndoableItem.h>
Copy link
Collaborator Author

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.
Copy link
Collaborator Author

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
Copy link
Collaborator Author

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
Copy link
Collaborator Author

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.

Copy link
Contributor

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:


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.

Copy link
Collaborator Author

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.

Copy link
Contributor

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. :)

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
Copy link
Collaborator Author

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
Copy link
Collaborator Author

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.

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):
Copy link
Collaborator Author

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.

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);

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.

Copy link
Collaborator Author

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

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

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):

Choose a reason for hiding this comment

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

Leading by example!

@kxl-adsk kxl-adsk added the ufe-usd Related to UFE-USD plugin in Maya-Usd label Jan 23, 2021
Copy link

@kxl-adsk kxl-adsk left a 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 ppt-adsk added the ready-for-merge Development process is finished, PR is ready for merge label Jan 27, 2021
@kxl-adsk
Copy link

@ppt-adsk Removing ready-for-merge label for now, since we still have to understand this test failure with the last Maya PR.

@kxl-adsk kxl-adsk removed the ready-for-merge Development process is finished, PR is ready for merge label Jan 28, 2021
@kxl-adsk
Copy link

kxl-adsk commented Feb 5, 2021

The only failure comes from our signing server hang. Marking this as ready for merge.

@kxl-adsk kxl-adsk added the ready-for-merge Development process is finished, PR is ready for merge label Feb 5, 2021
@kxl-adsk
Copy link

kxl-adsk commented Feb 5, 2021

Also, the remaining test failures were fixed by 4a6c729

@kxl-adsk kxl-adsk merged commit c6179c0 into dev Feb 5, 2021
@kxl-adsk kxl-adsk deleted the tremblp/MAYA-108692/parent_absolute_single_matrix branch February 5, 2021 11:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-for-merge Development process is finished, PR is ready for merge ufe-usd Related to UFE-USD plugin in Maya-Usd
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants