-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathCheckLightPrim.py
More file actions
37 lines (28 loc) · 1.17 KB
/
CheckLightPrim.py
File metadata and controls
37 lines (28 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
from pxr import Usd, UsdLux
import omni.usd
# Get stage.
stage = omni.usd.get_context().get_stage()
# Get selection.
selection = omni.usd.get_context().get_selection()
paths = selection.get_selected_prim_paths()
# Check if prim is Light.
def checkLight(prim : Usd.Prim):
if prim.IsA(UsdLux.DistantLight) or prim.IsA(UsdLux.CylinderLight) or \
prim.IsA(UsdLux.DiskLight) or prim.IsA(UsdLux.DomeLight) or \
prim.IsA(UsdLux.RectLight) or prim.IsA(UsdLux.SphereLight):
lightAPI = UsdLux.LightAPI(prim)
if lightAPI:
print(f"intensity : {lightAPI.GetIntensityAttr().Get()}")
print(f"color : {lightAPI.GetColorAttr().Get()}")
print(f"exposure : {lightAPI.GetExposureAttr().Get()}")
shapingAPI = UsdLux.ShapingAPI(prim)
if shapingAPI:
print(f"cone angle : {shapingAPI.GetShapingConeAngleAttr().Get()}")
print(f"cone softness : {shapingAPI.GetShapingConeSoftnessAttr().Get()}")
return True
return False
for path in paths:
# Get prim.
prim = stage.GetPrimAtPath(path)
if checkLight(prim):
print(f"[ {prim.GetPath().pathString} ] : {prim.GetTypeName()}")