Having trouble modifying an AssetPath and resolving correctly

I’m trying modify the inputs:file value of some materials and I’m not able to resolve the paths. My specific intention is to load UDIMs and based on this, it seems that it might be a bit difficult, but i’m not even getting there.

Even doing something like
original_path = inputs_file.Get().path inputs_file = Sdf.AssetPath(original_path)
is not resolving it correctly. I get an empty string.
I’m using Houdini and in the scene tree the AssetPaths are exactly the same, with @…@ formatting but it does not resolve.
I tried some versions of Ar.GetResolver.Resolve() but nothing seems to be doing the trick.

ETA: I’m doing this on a python node. Do I need to initialize the AR with the stage path so it ‘knows’ how to resolve those relative paths? If so, how?

Any pointers on what I might be doing wrong are appreciated.
Thanks!

Hey @dsurka,

One thing to be aware of is that whenever you author scene description in Houdini, you are doing so on an anonymous (in-memory) layer. Since anonymous layers do not have real paths, they can’t meaningfully be used to anchor relative paths. For this reason whenever you use a Load Layer for Editing node, Houdini will make all of the relative paths in the layer absolute. Similarly, the default behavior of the USD ROP has the “Use Relative Paths” output processor enabled which attempts to convert any absolute paths to relative when writing the layer(s) to disk. I mention this because, as far as I can tell, you should only author relative paths in Houdini using an output processor.

With regards to resolving UDIM paths specifically, I think that the thread you linked is probably the best reference:

USD itself doesn’t have a UDIM resolver so the empty string is due to failed resolution.

The one thing I would add is that USD 23.05 introduced UsdShadeUdimUtils which includes some utilities for handling UDIMs that you may find helpful.

Hi! YES! thanks.
I figured it out this morning that that was probably the case and remembered I had already solved that issue in other case where I would modify the absolute path and have the output processor deal with the relativization of the path at save time.

Not sure if this is the best solution and I’m still not sure how this will run on other apps but at least I’m getting the correct tiles using in Houdini/Karma. Will need to do some more testing later.
Thanks for the info on the utils, I’ll check them out.

1 Like