Script USDGeomXformable Placement and Visibility on Timeline

Hi,

I have a few questions and capabilities I’m curious about when it comes to scripting prim placement and visibility in Omniverse.

My goal is to toggle visibility (probably with omni.kit.commands as I do not know the direct Omniverse API that handles visibility toggles - please let me know what that is if you’re familiar) of certain objects in a scene at a certain frame number, and to have the visibility reset once the timeline resets. I would like all children to appear/disappear as well.

My other goal is to set the position of certain USD references based on the current frame number. This I believe I can do with raw USD via their timeline and xform.

The main point of concern for me is that the visibility toggle appears to be an Omniverse function and not something that I can find in base USD.

My questions are:

  1. Is omni.timeline interacting with the same timeline inherently part of a USD file? I looked at the docs and don’t quite understand how to achieve my goals with what’s documented there.

  2. What’s the best way to programmatically toggle the visibility of a prim and its children via python API?

  3. What’s the best way to create events or run scripts at a certain frame of play in Omniverse? Or just in pxr USD?

I appreciate any advice, thank you!

Hi @LMTraina99. This is actually all things that you can do with the USD API and encode directly into your USD data. To understand the frame-based attribute values, I recommend checking out this tutorial: Transformations, Time-sampled Animation, and Layer Offsets — Universal Scene Description 23.05 documentation

Visibility is actually a property and not Omniverse-specific. You can see it listed in the Property window. Once you’ve gone through that tutorial, visibility is a little tricky in that you need to use your Usd.Prim object to create a UsdGeom.Imageable object which has the API for setting visibility: Universal Scene Description: UsdGeomImageable Class Reference

1 Like

Hi Mati,

This is just what I was looking for. I will give it a look!

Thank you!

-Matthew