-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathGetMaterialInputs.py
More file actions
31 lines (22 loc) · 860 Bytes
/
GetMaterialInputs.py
File metadata and controls
31 lines (22 loc) · 860 Bytes
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
from pxr import UsdShade
# Get stage.
stage = omni.usd.get_context().get_stage()
selection = omni.usd.get_context().get_selection()
paths = selection.get_selected_prim_paths()
for path in paths:
prim = stage.GetPrimAtPath(path)
if not prim.IsA(UsdShade.Material):
continue
print(f"[ {prim.GetPath().pathString} ]")
# Get Shader of Material and input parameters.
pChildren = prim.GetChildren()
for cPrim in pChildren:
if cPrim.IsA(UsdShade.Shader):
shaderPrim = UsdShade.Shader(cPrim)
mInputs = shaderPrim.GetInputs()
for inputV in mInputs:
baseName = inputV.GetBaseName()
typeName = inputV.GetTypeName()
print(f" [{baseName}] ({typeName})")
v = inputV.Get()
print(f" {type(v)} ==> {v}")