getavalon / core

The safe post-production pipeline - https://getavalon.github.io/2.0
MIT License
213 stars 48 forks source link

Implement an Avalon ArResolver for USD #478

Open BigRoy opened 4 years ago

BigRoy commented 4 years ago

Issue

The USD API allows to implement a custom Asset Resolution Resolver known as a ArResolver.

What is Asset Resolution?

Asset resolution is the process by which an asset identifier is translated into the location of a consumable resource. We use the general term "resource", though in reality parts of USD currently assume resolved assets are files. USD provides a plugin point for asset resolution, the ArResolver interface, which clients can implement to resolve assets discovered in a USD scene, using whatever logic and external inputs they require. Because USD itself always calls into the ArResolver plugin to resolve an identifier before consuming it, the plugin provides an opportunity for clients to fetch resources and make them into files for USD's consumption, so that they can work around the assumption of resource-as-file until such time as we may be able to remove it.

To benefit from Avalon's publish versioning we'd need to implement a custom resolver as USD itself allows no 'embedded urls' to be changed, thus you can't update an embedded version to the version you'd like. Instead USD does allow a custom resolver to "resolve a specific url" to a specific file on disk, as such that would also allow to load updated embedded versions.

The ArResolver interface can be customized per USD installation, allowing, for example, site-specific naming conventions to be resolved, and for dynamic versioning control to be applied. Source

Having an Avalon ArResolver would mean that paths would be set to something like:

avalon:?project=Alita&asset=characters_hero&subset=modelDefault?version=1

(The exact implementation is to be discussed)

Then as USD loads the scene it resolves the URI to a path on disk and loads it from there. In other words, the ArResolver gives you an opportunity to intercept asset paths and translate them to a path on disk.

Notes on implementing an ArResolver

Ar does not support custom resolvers implemented in Python to avoid performance issues, especially for multi-threaded consumers. _Source_

References

Some reference ArResolver implementations:


This issue relates to #477 as it's part of a USD implementation for Avalon.

BigRoy commented 4 years ago

Adding this link as it has very good information about USD + Version Selection as used at Animal Logic with AL_USDMaya. Storing for future reference.

Adding another link for future reference: