-
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-128599 fixing pivot command #3110
Merged
Merged
Changes from all commits
Commits
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
# USD Transforms Stack | ||
|
||
## Take Aways | ||
|
||
- Understand the USD transform stack (xformOp) | ||
- Know the available USD transform ops | ||
- Know the structure of the USD transform stack | ||
- Know how it maps to UFE | ||
- Know the various implementations of xformOp in MayaUSD | ||
|
||
## What is a USD Transform stack | ||
|
||
- Control the 3D position of a USD prim | ||
- It is an ordered list of transform operations (xformOp): | ||
translation, rotation, scale, 4x4 matrix | ||
- USD supports any number of xformOp, in any order | ||
- An individual xformOp is kept in a USD attribute | ||
- All transform-related attributes begin with the "xformOp:" prefix | ||
- An xformOp attribute name has two or three parts: | ||
- "xformOp:" | ||
- the transform type | ||
- optional suffix | ||
- For example: "xformOp:translate:pivot" | ||
- The xformOp order is kept in a special attribute: "xformOpOrder" | ||
|
||
## Quick Recap on Pivot | ||
|
||
Pivots... | ||
|
||
- ... are generally neutral: they don't move the prim | ||
- ... come as a pair of opposite translations, sandwhiching other transforms | ||
- ... are used in DCC to position the center of rotation and center of scaling | ||
|
||
## Quick Recap on Transform Maths | ||
|
||
- A single matrix is equivalent to any number of chained transforms | ||
- The inverse is not true | ||
- Some matrices cannot be expressed with translation, rotation and scaling... | ||
- ... but they are generally considered degenerate and are rarely seen | ||
- On the other hand, matrix cannot express pivot pairs, since they are neutral | ||
- In general, except for pivots, all transform representations are equivalent | ||
|
||
## USD Common Transform Stack | ||
|
||
- USD provides a recommended, simple transform stack it calls the "common API" | ||
- The goal is to have a baseline transform stack that all DCC should support | ||
- The USD common stack structure is: translate, pivot, rotate, scale | ||
- In particular, the pivot wraps both the rotation and scaling, unlike Maya | ||
|
||
## UFE Transforms | ||
|
||
UFE Transform3d ... | ||
|
||
- ... allows modifying a UFE scene item transforms | ||
- ... is created by the registered UFE Transform3dHandler | ||
- ... creates commands that when executed changes the transform | ||
- ... does *not* prescribe how the various transforms interact | ||
- ... is implicitly tied to Maya's view of how transforms are ordered | ||
|
||
## MayaUSD XformOp Implementations | ||
|
||
- MayaUSD provides multiple UFE Transform3d implementations | ||
- The implementations are: point instance, Maya stack, USD common API, 4x4 matrix and no comprendo + Maya stack | ||
- For the rest of the presentation, we will ignore point instance and no comprendo | ||
|
||
## MayaUSD XformOp Details | ||
|
||
- Only the Maya stack supports all the UFE commands. In particular, pivot commands | ||
- Which one is used is decided at the time of the creation of the Transform3d | ||
- Once decided, there is no turning back, we cannot switch dynamically | ||
- The decision is based on what is already authored on the prim | ||
- In case multiple implementations could be used, the priority order is: Maya stack, common API, matrix | ||
- The main goal was that we would privilege the Maya stack, but still support the others representations | ||
- One design decision is to *not* convert between representations |
Binary file not shown.
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
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 |
---|---|---|
|
@@ -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) | ||
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. These were printing error message when there were no stage loaded, which was annoying. |
||
return false; | ||
MFnDagNode dagNode(shapeObj, &status); | ||
CHECK_MSTATUS_AND_RETURN(status, false); | ||
if (!status) | ||
return false; | ||
|
||
if (const UsdMayaUsdPrimProvider* usdPrimProvider | ||
= dynamic_cast<const UsdMayaUsdPrimProvider*>(dagNode.userNode())) { | ||
|
@@ -303,7 +305,7 @@ void MayaSessionState::loadSelectedStage() | |
#if defined(WANT_UFE_BUILD) | ||
const std::string shapePath = MayaUsd::LayerManager::getSelectedStage(); | ||
StageEntry entry; | ||
if (getStageEntry(&entry, shapePath.c_str())) { | ||
if (!shapePath.empty() && getStageEntry(&entry, shapePath.c_str())) { | ||
setStageEntry(entry); | ||
} | ||
#endif | ||
|
Oops, something went wrong.
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.
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.