How does "Resolver Context Asset Path" work?

   3172   1   1
User Avatar
Member
1 posts
Joined: Jan. 2015
Offline
The USD Render ROP indicates that you can pass context directly to the rendered stage, via the Resolver Context Asset Path [www.sidefx.com] parm. I'm just getting into this now but was hoping to get clarification on what the parm, in USD source code, is doing.

This some pseudo-code of what I was thinking "Resolver Context Asset Path" is doing:

context_string = node.parm("resolvercontext").eval()

if context_string:
    context = Ar.GetResolver().CreateContextFromString(context_string)
    stage = Usd.Stage.Open(node.stage().GetRootLayer().identifier, context)
else:
    stage = node.stage()

_do_the_render(stage)

Maybe something like that? I need to know roughly how "Resolver Context Asset Path" works to ensure a custom resolver implements the feature correctly.
Edited by korinkite - Sept. 1, 2022 12:16:31
User Avatar
Staff
4565 posts
Joined: July 2005
Offline
Copy/pasting the answer I gave on the question submitted to support, in case anyone else is interested:

Houdini passes that parameter to the "CreateDefaultContextForAsset" method. I must admit I don't have any hands on experience with how resolver contexts are created in Ar2.0. But I suspect, reading the documentation here (https://graphics.pixar.com/usd/release/api/class_ar_resolver.html#a5b0e0ea52ac80bb4a4b6d1f881331df1) that this will cause this method on your asset resolver to be called (not _CreateContextFromString). But this resolver context should be available to your custom resolver when resolving assets on the LOPs stage.
  • Quick Links