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; they 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. Strictly speaking this disk path should be defined straight away, but in practice Lops lets you go without it, as it doesn't matter to much.
Well, until you try and save stuff with a USD Rop, at which point, yes it matters quite a lot!
The rop 'save style' menu is to decide what layers should do. 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. The layer will have a pretend save path based on the houdini sop path, eg op:/obj/geo1/polyextrude. If you save you'll likely get a warning, and a subfolder like $HIP/obj/geo1/polyextrude.usd containing the sopcreate geo. Ugh.
To avoid this mess, there's usually a 'layer save path' parameter lurking somewhere. It exists on sop create and sop modify. Enable it, give it a path (eg $HIP/geo/sopcreategeo.usd).
When you click 'save' on the usd rop, it will detect any layers that also need to be saved, look at that save path, and save them there.
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 doinng 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.