We talked earlier about layering (as a verb) in the context of departments, but not layers (as a noun) within USD.
Anything you do in USD is implicitly in a layer, a layer being the broadest 'container' USD has. So when you make a primtive from scratch, it's put in a layer. When you load a reference, the reference is put in a layer.
You can load stuff from disk directly into a layer, skipping the reference style 'put this thing there' requirements. This simplest way of doing this is a sublayer lop, it just vomits the contents of a file on disk directly to the scene graph. Being the simplest way, its also the default way when you put down a file node.
This leads to a basic rule with layers; a layer should always be associated with a path on disk. If you load something with a sublayer, that's self evident, the path on disk is of course the usd file you loaded.
But what about when you use a sop create? That usd geo didn't come from disk, its been generated from nothing, so there's no save path defined. This can have an impact on USD Rops, hence you get control over this with save styles.
The rop 'save style' menu is to decide how layers should be saved. Obviously. The text within the menu choices is pretty self descriptive, but here's my loose paraphrasing. Say you've chained together a sublayer from disk, a reference on disk, and a sopcreate within lops. The save styles let you choose between:
- If you've loaded stuff from disk, leave them alone, just store any of the edits/overrides in the final usd file specified on the rop. OR:
- Take all the contents of all the inputs (except references), bake them into the usd specified in the rop. OR:
- Bake everything into the usd specified in the rop, so you have a big fat usd file, no external dependencies.
So what happens to the sopcreate if it doesn't have a path on disk, and you don't use the 'bake everything' mode?
Ideally, an error. In practice, a mess. A USD Rop will do this little process when you click 'save to disk':
- Scan all the incoming layers
- Identify layers that have been modified
- Save them to their own 'layer save path'
- Once all the layers are taken care of, write its own usd file.
In this case the sopcreate layer will have a pretend save path based on the houdini sop path, eg op:/obj/geo1/polyextrude. The preprocess step will do its best, save the layer to a not-very-helpful location like $HIP/obj/geo1/polyextrude.usd, generate a warning like 'you know i had to save that sopcreate layer to a stupid place right?', and you swear. Ugh.
To avoid this mess, look for a 'layer save path' parameter. It exists on sop create and sop modify. Enable it, give it a path (eg $HIP/geo/cool_fx_geo.usd).
Now when you click 'save' on the usd rop, the layer save preprocess will do the right thing. Hooray!
Why would you need this? Modularity and fine grained control, which USD excels at (arguably USD and Lops gives you too much fine grained control). You might have something like this chain of nodes:
- A sop import for building the set
- A sop import for doing an RBD sim
- A sop create for running fur,
- A USD Rop at the end with a save path of 'master.usd'.
With the appropriate layer save paths per sopimport/sopcreate, when you save the rop you'll get seperate set.usd, rbd.usd, fur.usd, which will all be references automatically by the tiny master.usd file.
In reality, this doesn't happen often with fx and lops. Any important external stuff will already be in external usd files, and you'll just be told 'yeah, just throw all your FX work into fx.usd please.'. In that case, just set the save style to 'flatten', job done.
Scene Graph Layers pane
If you want to keep track of your layers (and sooner or later you'll want to), there's a panel for this, Scene Graph Layers. Open it, see a tree-ish view of the active layers. This also lets you see the save paths at a glance per layer, handy to spot the one rogue layer which doesn't have a path set, or is trying to save to op:/obj/geo1/polyextrude.
You don't have to configure 'layer save path' straight away on a sopcreate/sopimport. A 'configure layer' node also lets you do this, handy if you want to bundle your operations, eg keeping all the rops and save-path related nodes close together at the bottom of your node network.