Hi,
Is there a way to keep the mute state of a USD layer, when writing out a Stage to file?
Let's say you sublayer in two USD files (fileA.usd and fileB.usd).
In the graph, you mute fileB.usd using the Configure Stage lop node.
Then you write out this composed stage to a new file myStage.usd.
When loading in myStage.usd both the fileA.usd and fileB.usd are active and it doesn't look like the muting of fileB.usd has been preserved.
Write mute state of layers to USD output
2860 4 3- jacobvfx
- Member
- 15 posts
- Joined: Dec. 2019
- Offline
- mtucker
- Staff
- 4523 posts
- Joined: July 2005
- Offline
Layer muting, population masks, and payload masks have no way to be expressed in the authored USD layers. If you flatten the USD stage to a single USD file these muting and masking decisions are essentially "baked in" to the resulting USD file, but obviously there are a lot of implications to flattening a stage that make it fairly unattractive for many workflows.
- jacobvfx
- Member
- 15 posts
- Joined: Dec. 2019
- Offline
So there's no, none destructive/flattening way, to disable/mute a layer in the Solaris graph and have that propagate to the resulting USD file, that will be passed to HUSK?
I guess a workflow could be to save the state of each USD layer as metadata within the Stage and use a pre-render script within HUSK to mute layers based on that.
I guess a workflow could be to save the state of each USD layer as metadata within the Stage and use a pre-render script within HUSK to mute layers based on that.
- AhmedHindy
- Member
- 136 posts
- Joined: Oct. 2020
- Offline
- AnimGraphLab
- Member
- 66 posts
- Joined: May 2019
- Offline
For me, muting only worked after using Python LOP which seems to have effect on the actual saved USD file, I guess (thanks to USD Survival Guide Layer Muting [lucascheller.github.io]):
Then to load those muted layers back I replaced
To be clear, I'm not sure how it is supposed to be yet. I decided to share experiments.
You can also add a checkbox parameter, read it using Python, and use the same node to hide/unhide the same USD layer paths.
from pxr import Sdf # List of layer paths layerPaths = [ "<absolute-path-to-layer-file>/usd/LAYERS/moss-scatter-MID-SIDE-layer.usd", "<absolute-path-to-layer-file>/usd/LAYERS/moss-scatter-RIGHT-SIDE-layer.usd", "<absolute-path-to-layer-file>/usd/LAYERS/moss-scatter-LEFT-SIDE-layer.usd" ] # Iterate over each layer path for l in layerPaths: # Open the layer using FindOrOpen layer = Sdf.Layer.FindOrOpen(str(l)) # Ensure l is treated as a string if layer: # Check if the layer was successfully opened Sdf.Layer.AddToMutedLayers(layer.identifier) else: print(f"Failed to open layer: {l}")
Then to load those muted layers back I replaced
Sdf.Layer.AddToMutedLayers(layer.identifier)
with Sdf.Layer.RemoveFromMutedLayers(layer.identifier)
To be clear, I'm not sure how it is supposed to be yet. I decided to share experiments.
You can also add a checkbox parameter, read it using Python, and use the same node to hide/unhide the same USD layer paths.
Edited by AnimGraphLab - Sept. 11, 2024 01:50:50
Generalist. Transforming still images to 3D animation 🔮
Socials: https://linktr.ee/AnimGraphLab [linktr.ee]
Socials: https://linktr.ee/AnimGraphLab [linktr.ee]
-
- Quick Links