-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathGetTransform.py
More file actions
28 lines (20 loc) · 921 Bytes
/
GetTransform.py
File metadata and controls
28 lines (20 loc) · 921 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
from pxr import Usd, UsdGeom, UsdPhysics, UsdShade, Sdf, Gf, Tf
# Get stage.
stage = omni.usd.get_context().get_stage()
# Get selection.
selection = omni.usd.get_context().get_selection()
paths = selection.get_selected_prim_paths()
for path in paths:
prim = stage.GetPrimAtPath(path)
if prim.IsValid() == True:
# Print prim name.
print('[ ' + prim.GetName() + ' ]')
# Order of Transform elements.
transformOrder = prim.GetAttribute('xformOpOrder')
if transformOrder.IsValid() and transformOrder.Get() != None:
print(f" TransformOrder : {transformOrder.Get()}")
for transV in transformOrder.Get():
# 'xformOp:scale', 'xformOp:rotateXYZ', 'xformOp:translate', etc.
tV = prim.GetAttribute(transV)
if tV.IsValid():
print(f" {transV} ( {tV.GetTypeName()} ) : {tV.Get()}")