-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathGetDoubleSided.py
More file actions
30 lines (24 loc) · 897 Bytes
/
GetDoubleSided.py
File metadata and controls
30 lines (24 loc) · 897 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
30
from pxr import UsdGeom
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()
for path in paths:
# Get prim.
prim = stage.GetPrimAtPath(path)
if not prim.IsValid():
continue
try:
gprim = UsdGeom.Gprim(prim)
doubleSidedAttr = gprim.GetDoubleSidedAttr()
if doubleSidedAttr != None and doubleSidedAttr.IsValid():
# Get doubleSided (True/False).
# The Omniverse Viewport does not reflect "doubleSided", but "singleSided".
if doubleSidedAttr.Get() != None:
print(f"[{prim.GetName()}] doubleSided : {doubleSidedAttr.Get()}")
# Set DoubleSided.
#doubleSidedAttr.Set(True)
except Exception as e:
print(e)