Merging Implicit Layers

   2530   2   1
User Avatar
Member
4 posts
Joined: Oct. 2013
Offline
Is there a way (outside of running a USD ROP with "Flatten Implicit Layers") to flatten implicit layers on the "live / anonymous" stage?

The implementation I'm trying to achieve is to sublayer the output of a final "Configure Layer" into a specific index of a different layer stack.

/
LayerA
configurelayer
LayerB
LayerC


The problem I'm facing is when the output of the "Configure Layer" looks like this:

/
configurelayer (Explicit)
tempLayerA (Implicit)
templayerB (Implicit)

Sublayering the output of the "Configure Layer" into the layer stack results in this:

/
LayerA
configurelayer
tempLayerA
tempLayerB
LayerB
LayerC

Resulting in the configurelayer considering those implicit layers as sublayers.

I realize I can sublayer the file output of the configurelayer, once it has been output in conjunction with "Flatten Implicit Layers", but that would seem to require an intermediary save before the results lower in the graph are accurately represented.

Could it be possible to introduce a node (or perhaps a new mode for the "Merge" node) that follows the same logic / operation as the USD ROP "Flatten Implicit Layers"?
User Avatar
Member
4 posts
Joined: Oct. 2013
Offline
Managed to deal with my implementation problem using the Python script node with an immediate layer break before it. It's an indiscriminate merge, but it works for my use case. The solution surprised me a bit, as I didn't expect the USD ROP to save anything above the layer break, but it does somehow? I guess because I'm merging things in from above the layer break, including the HoudiniLayerInfo prim. Anyhow, maybe this helps somebody else..

I still think it'd be nice to have the flatten implicit available outside the USD ROP output.

from pxr import UsdUtils
node = hou.pwd()
source_input = node.input(0).input(0)  # Skip over immediate layerbreak
layers = list()
for i in reversed(range(source_input.sourceLayerCount())):
    layers.append(source_input.sourceLayer(i))
target_layer = node.editableLayer()
[UsdUtils.StitchLayers(target_layer, layer) for layer in layers]
User Avatar
Staff
4560 posts
Joined: July 2005
Offline
There is currently no way to do this. We haven't provided such a mechanism because it will be quite expensive (generally requiring a complete refresh of every primitive in the viewport), and yet the output of the operation will be indistinguishable from the stage before this flattening. And the USD ROP can do this flattening at save time, when it really matters... So if you decide to submit an RFE for this, please describe the requirement that is motivating the request. Thanks!
  • Quick Links