When creating a keyframed animation (e.g. rotation), USD Composer creates a pushgraph instead of setting time sampled data.
When Applying textures, they are referenced assets when collected instead of part of the USD scene.
In comparison, when I apply materials and keyframe animation in 3DS Max, then use the 3ds max usd exporter, it puts everything into the single USD file.
You need to bake out the animation to time sampled data, using the STAGE RECORDER. This will write all of your time sampled data out to a separate usd file. Then you can bring it back in as a layer, separate from the actual objects. Then you can use the “save flattened as” to merged the two usd files back to one. Check out this video. Omniverse Stage Recorder for Baking Animations (youtube.com)
You can either manually repath the usd file or you can use the “Collect Tool” to collect everything into a local referenced folder. You can even do a “save flattened as” for usd which will further reduce it down to a simple file.
Hi @Richard3D,
I’m trying to create a self contained USD file that includes materials.
The “Save Flattened As” doesn’t seem to do that. How can I achieve that?
I would like to do it actually by API also. Here’s my code snippet but it doesn’t include materials.
How can I do that?
Thanks,
Robert
Get the active stage
stage = omni.usd.get_context().get_stage()
if not stage:
logger.error("No valid USD stage open.")
return
logger.warning("Flattening the stage...")
# FLATTEN the stage to resolve references, payloads, etc.
flattened_stage = omni.usd.get_context().get_stage().Flatten()
if not flattened_stage:
logger.error("Failed to flatten the stage.")
return
logger.warning(f"Exporting flattened stage to {output_usd_file}")
# Export the flattened stage
flattened_stage.Export(output_usd_file)
I understand you are trying to create a self-contained file, with all the materials included. This is called a USDZ file. The Z stands for zipped. When you do the command, “save flattened as”, it just crushes down to the USD code into a single file, but it does not include the materials.
To save a USDZ file, simply go to Export and select the USDZ file option. That should create it. But make sure you are using the latest version. The older version on Launcher may not support this.