-
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
T bailp/maya 112769/usd prim selectability #1673
Merged
Merged
Conversation
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
- If set to "unselectable" then it is not selectable. - Per-prim, sub-prim can be selected. - Metadata is registered via plugInfo.json, registered at plugin initialization. - place the plugInfo.json in the render library.
- Moved selectability code to its own file. - Declared selectability state enum. - Declared the metadata and value tokens. - Added C++ functions to get and compute selectability. - Use it in the proxy render delegate.
Add tests for a single prim having different selectability in different USD layers and that the result is correct.
…bility state names The cache is cleared at the beginning of each selection to avoid the always thorny problem of cache invalidation. The cache accelerate the verification of selectability in bug scene of thousands of prims being all region-selected. Change "selectable" to "on", Change "unselectable" to "off". This makes the state more generic in case we ant to add other inheritable metadata. They will be able to follow the same naming convention: metadata-name = "on" | off" | "inherit"
This makes teh name more compatible with how the Maya Attribute Editor convert metadata names to UI labels. It removes underscores but adds a space before uppercase letter. Thus the new name result in a UI label "Maya Selectability" which is more readable than "mayaselectability".
Move the code and metadata declarations in the utils folder. Use correct ifdef in the header file.
pierrebai-adsk
added
core
Related to core library
enhancement
New feature or request
vp2renderdelegate
Related to VP2RenderDelegate
labels
Aug 31, 2021
williamkrick
approved these changes
Aug 31, 2021
pierrebai-adsk
added
the
ready-for-merge
Development process is finished, PR is ready for merge
label
Aug 31, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
core
Related to core library
enhancement
New feature or request
ready-for-merge
Development process is finished, PR is ready for merge
vp2renderdelegate
Related to VP2RenderDelegate
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.
Add control over the selectability of USD prims in the Maya viewport. The
selectability is controlled by a metadata USD token on the prim, named
"mayaSelectability". The name was chosen to display nicely in teh attribute editor which will convert it to "Maya Selectability".
The metadata can have three states: "on", off" or "inherit". If the metadata is
missing, the default is "inherit". The reason to have an explicit "inherit"
state is to allow a USD layer to override the setting on a prim.
A prim is selectable if "on" or "inherit" under an "on" ancestor. Similarly, it
is unselectable if "off" or if inheriting "off" from an ancestor. An explicit
state always override ancestors, so a prim can be selectable under and
unselectable prim.
Using these names for the states makes them generic in case we want to add
other inheritable metadata. They will be able to follow the same naming
convention.
The selectability computation is kept in its own C++ file and class:
"selectability.h", "selectability.cpp" and Selectability. The class provides three static functions:
prepareForSelection(), isSelectable() and getLocalState(). The first is called before doing multiple
calls to isSelectable(). The function isSelectable() is the core of the
functionality and returns true or false for a given prim. The getLocalState()
function gets the state on a given prim without checking inheritance. The
Selectability class also declares a selectability state enum and the metadata
and value tokens.
The Selectability class is used in the Maya USD proxy render delegate class, in the render library.
The metadata is registered via plugInfo.json, registered at plugin
initialization. The plugInfo.json file in under the utils library.
Internally, a cache is used to speed up the computation of multiple calls to isSelectable(), since
most prim will be in the "inherit" state and will have to check their parent
prim. This cache is cleared when preprareForSelection() is called. The cache
accelerates the verification of selectability in big scenes of thousands of
prims, for example when they are all being selected. Throwing away the cache at
the beginning of each batch of selections does not costs much performance and
avoids the always thorny problem of cache invalidation.
There are units tests for: