Pass some data into custom Asset Resolver

   2594   4   2
User Avatar
Member
7 posts
Joined: Nov. 2019
Offline
Could you share some thoughts on possible options of setting some key-value pairs in Solaris to read them back in a custom Asset Resolver?

The data could be stored in some JSON files, addressed by the Resolver Context or in the environment variables, but I'd prefer some native (or custom) node-based solution if it does exist.

Thank you.
User Avatar
Member
7 posts
Joined: Nov. 2019
Offline
As there are no replies, I'll try to add my thoughts.

Currently I've come up with this solution: asset resolver gets its context path with a suffix:
/path/to/context/file.usd?key1=value1&key2;=value2...
Then in CreateDefaultContextForAsset I separate the context path ("/path/to/context/file.usd") and decode the key-value pairs into my context dictionary.

This solution is almost fine as I can encode my data and use configureStage node's "resolvercontextassetpath" parm to send this to my resolver.

Any other ideas?
User Avatar
Staff
4521 posts
Joined: July 2005
Offline
The "resolver context asset path" settings are basically arbitrary strings, I believe. The original concept (and the way it is used by Pixar) is to make it a path to a file on disk, but I don't think this is enforced in any way. I'd be curious to hear if you have found that it does in fact need to be a path.

Within Solaris you can set the resolver context in either the Configure Stage LOP, or on the LOP Network itself (which is a lot simpler and more convenient if you want to use the same setting for all the nodes within a LOP Network).
User Avatar
Member
14 posts
Joined: Aug. 2015
Offline
mtucker
Within Solaris you can set the resolver context in either the Configure Stage LOP
Can you explain how to do that for dummies?
I have ball_V01.usd and V02 i need always the last asset loaded
How can be implemented?
Thanks!
User Avatar
Staff
4521 posts
Joined: July 2005
Offline
That requires implementing a custom asset resolver, which is a huge topic that I wouldn't know how to summarize "simply". There is a _very_ simple custom asset resolver that ships with the HDK (it is really there only to show how to build USD plugins with the HDK). But there are some good open source asset resolvers you can look to as examples. Have a look at the links here: https://wiki.aswf.io/display/WGUSD/USD+Projects+and+Resources#USDProjectsandResources-AssetResolvers [wiki.aswf.io]
  • Quick Links