Skip to content

Instantly share code, notes, and snippets.

View spatial-bit's full-sized avatar

spatial spatial-bit

View GitHub Profile
@spatial-bit
spatial-bit / snippet.py
Created January 13, 2022 19:04
USD create camera #USD #OMNIVERSE
# USD create camera and set attributes
import omni.usd
from pxr import UsdGeom, Gf, Usd, UsdGeom, Vt, Sdf
stage = omni.usd.get_context().get_stage()
camera = UsdGeom.Camera.Define(stage, f'/Motions/my_camera0')
camera.CreateClippingRangeAttr().Set((1,1000000)) # e.g. (1, 1000000)
# camera.AddTransformOp().Set(tx)
@spatial-bit
spatial-bit / snippet.py
Last active January 13, 2022 19:05
USD add references to stage #USD #OMNIVERSE
# how to do references to multiple files
import omni.usd
from pxr import UsdGeom
stage = omni.usd.get_context().get_stage()
sphere = stage.OverridePrim('/my_prim')
sphere.GetReferences().AddReference('./HelloWorld0.usda')
sphere.GetReferences().AddReference('./HelloWorld1.usda')