Created
February 3, 2022 16:14
-
-
Save spatial-bit/da90ecd235c3bf8307af40b95421cb77 to your computer and use it in GitHub Desktop.
USD get prim starts_with #USD #OMNIVERSE
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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