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

add UFE contextOps for working set management (loading and unloading) #823

Conversation

mattyjams
Copy link
Contributor

This adds contextOps items for "Load", "Load with Descendants", and "Unload" based on the load set of the prim's stage, the loadable paths at or below that prim's path, and whether the prim has a payload.

These items map to undoable commands that call UsdStage::Load() (with the appropriate UsdLoadPolicy) or UsdStage::Unload() with the prim's path.

See the "Working Set Management" section of the USD docs on UsdStage for more discussion of load and unload rules:
https://graphics.pixar.com/usd/docs/api/class_usd_stage.html

This adds contextOps items for "Load", "Load with Descendants", and "Unload"
based on the load set of the prim's stage, the loadable paths at or below that
prim's path, and whether the prim has a payload.

These items map to undoable commands that call UsdStage::Load() (with the
appropriate UsdLoadPolicy) or UsdStage::Unload() with the prim's path.

See the "Working Set Management" section of the USD docs on UsdStage for more
discussion of load and unload rules:
https://graphics.pixar.com/usd/docs/api/class_usd_stage.html
This will enable testing of the working set management UFE contextOps ("Load",
"Load with Descendants", and "Unload").

Note that the Ball asset's shading variants have been lofted to the near side
of the payload so that they can be queried for and selections can be made
without having to load the payload.
@kxl-adsk kxl-adsk requested review from ppt-adsk and wtelford October 8, 2020 19:17
@kxl-adsk kxl-adsk added ufe-usd Related to UFE-USD plugin in Maya-Usd workflows Related to in-context workflows labels Oct 8, 2020
@wtelford
Copy link
Contributor

wtelford commented Oct 8, 2020

This is great to see. Could you attach an image showing how this appears in the context menu. This is specific to payload loading only correct?

@mattyjams
Copy link
Contributor Author

This is great to see. Could you attach an image showing how this appears in the context menu. This is specific to payload loading only correct?

Sure thing. Here are a few screenshots using the Maya scene from the unit test:

  • Everything loaded, showing items for Ball_1:
    all_loaded-Ball_1_items

  • Ball_1 was unloaded, showing items for Ball_1, which has its own payload, and could potentially introduce child prims with payloads, so we show both flavors of "Load":
    Ball_1_unloaded-Ball_1_items

  • Ball_1 still unloaded, showing items for Props, which does not have its own payload. There are both loaded and unloaded things below it though, so we show "Load with Descendants" and "Unload":
    Ball_1_unloaded-Props_items

  • Props was unloaded, which unloaded the payloads for all the Balls, so only their top-level prims appear. Props does not have its own payload, so we only show "Load with Descendants" for it:
    all_unloaded-Props_items

And as far as being payload-only, I intentionally didn't explicitly use the word "Payload" in any user-visible strings, but that is effectively what's being managed here. The context ops map to UsdStage::Load(<primPath>) and UsdStage::Unload(<primPath>) calls which currently manage payload inclusion rules. If those were extended in the future to encompass some other concept of loading in addition to payloads, we'd pick that up here as well.

@wtelford
Copy link
Contributor

wtelford commented Oct 9, 2020

Looking at the load/Unload rules in the docs, I'm curious how you are handling the following two rules.
Are you preventing the menu entries from showing?

  • Specifying a path to an inactive prim is an error.
  • Specifying a path to a master prim or a prim within a master is an
    error.

Also, do you present "unload" and "load with descendants" items on the proxyShape right-click as well to apply to all root level prims?

@mattyjams
Copy link
Contributor Author

Looking at the load/Unload rules in the docs, I'm curious how you are handling the following two rules.
Are you preventing the menu entries from showing?

  • Specifying a path to an inactive prim is an error.
  • Specifying a path to a master prim or a prim within a master is an
    error.

Yes, those cases are handled. We don't present any context items for inactive prims or prims within a prototype. The code for that is here:
https://github.com/Autodesk/maya-usd/pull/823/files#diff-3fb4a94e0a781c0c1ee67a66b8d69519R337

Also, do you present "unload" and "load with descendants" items on the proxyShape right-click as well to apply to all root level prims?

I did not add context items for the proxy shape itself, since that functionality was already provided by the "Load Payloads" attribute on the proxy shape. When you make it back up to the proxy shape, you're back in Maya data model land, so there's a lot of Maya-side stuff in the right-click context menu. I didn't want to clutter that up further with "Load with Descendants" and "Unload".

@ppt-adsk
Copy link
Collaborator

ppt-adsk commented Oct 9, 2020

Hey Matt, this looks wonderful, will have a look at it ASAP. However, the next Maya Preview Release code complete deadline is breathing down my neck, and we have Canadian Thanksgiving on Monday, so I might not be as responsive as I'd like to be. Hope that's O.K.

@mattyjams
Copy link
Contributor Author

@ppt-adsk: No problem, thanks for the heads up! There's no rush with this one.

Enjoy the holiday!

Copy link
Contributor

@wtelford wtelford left a comment

Choose a reason for hiding this comment

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

I did not review the code, but I did review the imagery submitted along with our design team. Looks good from a UI and workflow perspective. I'll leave it to Pierre to do the code-review.

@seando-adsk seando-adsk requested review from seando-adsk and removed request for ppt-adsk October 14, 2020 15:07
Copy link
Collaborator

@seando-adsk seando-adsk left a comment

Choose a reason for hiding this comment

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

I reviewed the code changes and everything looks good. The new test cases are great. Thanks.

@seando-adsk seando-adsk added the ready-for-merge Development process is finished, PR is ready for merge label Oct 14, 2020
@kxl-adsk kxl-adsk merged commit a388f16 into Autodesk:dev Oct 14, 2020
@mattyjams mattyjams deleted the pr/add_UFE_contextOps_for_working_set_management branch October 14, 2020 16:25
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 workflows Related to in-context workflows
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants