BigRoy / usd-qtpy

Python Qt components for building custom USD tools.
MIT License
59 stars 9 forks source link

Support Asset Resolver workflows #7

Open BigRoy opened 10 months ago

BigRoy commented 10 months ago

I'm not entirely sure what would be needed for studios to easily adopt these interfaces for their own tooling with e.g. a custom USD Asset Resolver.

Resolving should be as simple as:

from pxr import Ar

Ar.GetResolver().Resolve(usdFilePath)

And I believe loading a Usd.Stage itself already goes through its own resolving, etc. Since the Widgets are currently focused on operating on Usd.Stage (or Sdf.Layer) we might already be supporting most workflows.

However, there could be the possibility that e.g. the layer saving/exporting might need certain pre-export or post-import chasers to support certain behaviors.

I'm merely creating this issue to discuss what might be needed for complex workflows. It could be that by design what's there (in the current rough form) would already work well with the asset resolvers in production.

Input is welcome!

BigRoy commented 10 months ago

@LucaScheller is this by any chance something you might be able to provide more details for? And maybe even test as well? :)

LucaScheller commented 10 months ago

Resolver wise you'd need to expose creating the resolver context (as Houdini does by letting you specify a file path (+ in H20 Resolver Context from string creation)). On stage open/create, you'd then need to simply pass in that context. You can create the context of a specific resolver by calling the Create....Context(e.g. CreateDefaultContextForAsset) methods on the resolver.

I think a pre-export output chaser like Houdini's output processors might be nice. Should be easy to implement via the UsdUtils.ModifyAssetPaths(layer, some processing function)Docs method. You could wrap it similar to how Houdini does it.