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-128599 fixing pivot command #3110

Merged
merged 1 commit into from
May 26, 2023
Merged

Conversation

pierrebai-adsk
Copy link
Collaborator

In order to be able to apply some Maya more sophisticated transformations on USD prim that already use the USD common xform stack, we need to be able to use the Maya xform stack UFE Transformer3d. But that only accepted to be use if the existing USD form stack matched the Maya one. Unfortunately, the USD common API pivot ws not found in teh Maya stack.

Adding the common pivot to the Maya stack allows using the Maya transferm 3d on the USD common stack, allowing more complex operations on the pivot.

The real problem is that the chain of responsibility design pattern locks which xform-editor is used and thus what can be applied on the xform based on what opinions are already authored. Once chosen, the xform editor cannot be changed. This means some Maya operations cannot ever be applied on that prim.

The real solution would be to allow conversions between differnt xform representations. These conversions would be triggered when an operation not supported by the current xform representation need to be applied.

Concretely, instead of having multiple classes dereived from UFE Transform3d and which is used chosen at the time the Transform3d is created, we would have a single Transform3d class which would contain multiple implementations of the API and which implementation is used could change dynamically, with the USD xform representation converted from one to the other. It would be more of a hierarchy of more and more complex and complete representation of xform, with conversion from simpler forms to more complex forms.

Also:

  • Remove spurious error generated by MayaSessionState.
  • Add a unit test for center pivot command
  • Fix unit test that expect that Maya stack cannot handle a custom xform stack: make the xform names really unique. The new change was able to handle the stack unit by the test.

@pierrebai-adsk pierrebai-adsk requested a review from vlasovi May 19, 2023 19:13
@pierrebai-adsk pierrebai-adsk added bug Something isn't working adsk Related to Autodesk plugin labels May 19, 2023
if (foundTokenIdxPairIter == _sharedData->m_attrNamesToIdxs.end()) {
// Couldn't find the xformop in our stack, abort
// TF_WARN("Cannot find xform op %s", opName.GetText());
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Note: I left these debug print in comments behind because I found them useful to understand what was going on, so They will be there for teh next dev that need to investigate problem with this complex code.

@@ -82,9 +82,11 @@ bool MayaSessionState::getStageEntry(StageEntry* out_stageEntry, const MString&

MObject shapeObj;
MStatus status = UsdMayaUtil::GetMObjectByName(shapePath, shapeObj);
CHECK_MSTATUS_AND_RETURN(status, false);
if (!status)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

These were printing error message when there were no stage loaded, which was annoying.

vlasovi
vlasovi previously approved these changes May 23, 2023
Copy link
Collaborator

@vlasovi vlasovi left a comment

Choose a reason for hiding this comment

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

Looks good

vlasovi
vlasovi previously approved these changes May 23, 2023
In order to be able to apply some Maya more sophisticated transformations on USD prim that already use the USD common xform stack, we need to be able to use the Maya xform stack UFE Transformer3d. But that only accepted to be use if the existing USD form stack matched the Maya one. Unfortunately, the USD common API pivot ws not found in teh Maya stack.

Adding the common pivot to the Maya stack allows using the Maya transferm 3d on the USD common stack, allowing more complex operations on the pivot.

The real problem is that the chain of responsibility design pattern locks which xform-editor is used and thus what can be applied on the xform based on what opinions are already authored. Once chosen, the xform editor cannot be changed. This means some Maya operations cannot ever be applied on that prim.

The real solution would be to allow conversions between differnt xform representations. These conversions would be triggered when an operation not supported by the current xform representation need to be applied.

Concretely, instead of having multiple classes dereived from UFE Transform3d and which is used chosen at the time the Transform3d is created, we would have a single Transform3d class which would contain multiple implementations of the API and which implementation is used could change dynamically, with the USD xform representation converted from one to the other. It would be more of a hierarchy of more and more complex and complete representation of xform, with conversion from simpler forms to more complex forms.

Also:
- Remove spurious error generated by MayaSessionState.
- Add a unit test for center pivot command
- Fix unit test that expect that Maya stack cannot handle a custom xform stack: make the xform names really unique. The new change was able to handle the stack unit by the test.
- Add documentations about transforms
@pierrebai-adsk
Copy link
Collaborator Author

Sorry, rebased on latest dev after UFE refactor just to make sure.

@pierrebai-adsk pierrebai-adsk added the ready-for-merge Development process is finished, PR is ready for merge label May 25, 2023
@seando-adsk seando-adsk merged commit 1aa0646 into dev May 26, 2023
@seando-adsk seando-adsk deleted the bailp/MAYA-128599/modify-pivot branch May 26, 2023 13:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
adsk Related to Autodesk plugin bug Something isn't working ready-for-merge Development process is finished, PR is ready for merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants