Skip to content

Instantly share code, notes, and snippets.

@spatial-bit
Created February 3, 2022 16:14
Show Gist options
  • Save spatial-bit/da90ecd235c3bf8307af40b95421cb77 to your computer and use it in GitHub Desktop.
Save spatial-bit/da90ecd235c3bf8307af40b95421cb77 to your computer and use it in GitHub Desktop.
USD get prim starts_with #USD #OMNIVERSE
import omni.usd
from pxr import UsdGeom, Usd, UsdGeom
def get_prims_startswith(stage, root_path, starts_with):
matching_prims = []
root_prim = stage.GetPrimAtPath(root_path)
for prim in Usd.PrimRange(root_prim):
if prim.GetName().startswith(starts_with):
matching_prims.append(prim)
return matching_prims
#stage = Usd.Stage.Open('stage.usda')
stage = omni.usd.get_context().get_stage()
prims = get_prims_startswith(stage, '/Motions', 'traj_')
print(prims)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment