Baking all external Asset Paths

I’m looking for a C++ API way to bake down all external asset paths within a USD stage to an absolute path.
Does such an API exist? It’s not too onerous to write, but I feel like there are common edge cases that would benefit from having a shared implementation.

I see some useful methods like UsdUtilsModifyAssetPaths which I can give a functor, but thought I’d check first to see if I’m missing anything more obvious. Universal Scene Description: pxr/usd/usdUtils/dependencies.h File Reference

Nope, no-such shipping utility, and yes, ModifyAssetPaths would be the way to go!

Thanks, Spiff. Would you know if there’s an equivalent to ModifyAssetPaths that works on the USD stage instead of the SdfLayer? I didn’t see one.

My worry is that if I wanted to override the paths to absolute ones, that I have to modify each layer and replace their uses throughout any composition arcs as well.

In this scenario it would likely be best to work off the composed stage and put overs on the highest priority or root layer.

No, but if you’re just overriding the currently composed stage, that’s a pretty simple traversal to write? I guess processing dictionaries is an extra bit, but still? But I think this speaks to the fact that “doing it at stage level” could mean many different things, and depends on load-state, variant selections, etc, and might mean something different for different contexts?

Yeah it’s a fairly trivial traversal, but I just wanted to avoid rewriting a traversal if it existed since one would have to account for dictionaries if just doing textures, but also refs/payloads/clips etc for references.

Anyway easy enough to write for my purposes. Thanks for clarifying I wasn’t missing something!

But you can’t non-destructively edit references and payloads, like you can other metadata and properties. Well, you can try, but it won’t have the effect you’re looking for. I figured you were foregoing that, or assumed that had already been done.

In this case, I’d be handling the changes needed to individual layers after (since as you say just changing it wouldn’t give the desired result) , but just needed a good way to analyze the composed result first.

But either way, it’s fairly trivial to write.