Is there a Python way to get and / or set the USD Root Layer path for a scene?

I notice this value is different for every project.

Thanks, I need this to create a Physics Scene automatically. The commands Window shows the value of the current project, but to reuse the code I need the current scene’s value.

try this?

from pxr import Usd

stage = omni.usd.get_context().get_stage()
layer = stage.GetRootLayer()

it’s different each time because the file was never saved. so they become ‘temp’ files, or ‘anon’ in memory each time you do file > new, i think. once saved, the layer path will become the path of the USD file.

Thank you, I will try it shortly.

That worked! And you are correct, once saved the Root Layer path becomes the path to the USD project.

Many thanks.

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