When I use Python to open .usd, it was empty and lost all the content

I am trying to open a USD using Python, but I found some issues with it.

I made some 3D resource materials and exported to the USD model resource material (the first picture uploaded by I uploaded “Stool_mesh_3.usd) through” Collect Asset ".

I want to repeat this material and repeat it in my my_scene.usd (“my_scene.usd” production method is: “file → new”, and put in my material stool_mesh_3, file → save as → my_scene).

I then used the code to open it, but it was wrong. It lost Stool_Mesh_3, which was empty. I don’t know how this problem is solved, and I want to seek some help. Thank you so much.

import asyncio
import carb
import omni.usd

async def open_stage():
        result, error = await omni.usd.get_context().open_stage_async("D:/OM/my_scene/my_scene.usd", load_set=omni.usd.UsdContextInitialLoadSet.LOAD_NONE)
        stage = omni.usd.get_context().get_stage()
        carb.log_info(f"Opened stage {stage} with result {result}")

@fsb0147 personally, i got a bit confused by your description. but not sure if the snippet below helps:

you can either create or add the payload depending on your needs. if you aren’t looking to specify the Prim Path in the script, you will just want to make sure the source USD contains a defaultPrim (usually is the World xform)


Thank you very much for your prompt reply. I gave it a try as soon as possible. My understanding is that it has created a new Scene and put all the USD I need into it. Meanwhile, unfortunately, I discovered a new issue while using it.

This method did indeed bring my USD into the new stage, but it lost its Postprocessing.

I’m not sure if there’s any way to add PostProcessing together to the new Stage.

jusr thinking outloud - you could consider saving the postprocess as a preset then loading it in the new stage.

@Simplychenable I’m so sorry that my reply was late because I was trying. But luckily, I found a very simple way. My understanding is incorrect, I shouldn’t “open usd”, I should “open stage”, so it solves the problem of opening the local USD file.

import omni.usd
result = omni.usd.get_context().open_stage(“D:/OM/Home/71/Home_71.usd”)

This allows for some scene switching

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.