Disable loading of payloads during layer creation

Hi,

In our pipeline we have a tool which builds our layer stack and adds content to each layer dynamically. So each time a user wants something they generate a stage on the fly so a Usd.Stage.CreateNew() is called and then sublayers are generated, prims are created, variant sets / variants added and references / payloads are added to prims.

We now have some very large usd files at the moment and we want to disable loading of these heavy files during the creation of the stage. I’ve not been successful so far trying to disable these files. We need to add the payload but do not want to incur the cost of loading it at build time.

Thoughts?

If you really want performance and don’t care about what the stages you’re building together looks like you may be much better of going through the lower level Sdf API instead of the Usd API.

@LucaScheller explained that pretty well in his USD Survival Guide and offers some great examples and other performance tips.

Far from perfect, but at least somewhat of ‘production code’ by a small studio (don’t blame me; even though most of this is just me!) can be seen here which I believe also tries to use the Sdf API as much as possible.

I’m not entirely sure whether if you do Usd.Stage.CreateNew with the initial load set to have disabled payloads would influence adding the payloads and how it updates the stage then - I suspect it’d still incur the load cost - which you definitely don’t have via Sdf.

If you create a Stage with an initialLoadSet = LoadNone, then no added payloads will get loaded. You can achieve very granular control by crafting a LoadState over which parts of the stage will get “auto loaded”!

1 Like

Hey,

thanks to both of you - I ended up re-writing the core of our layer generation using the Sdf api instead and its much much faster!

1 Like