-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathDeletePivot.py
More file actions
41 lines (32 loc) · 1.15 KB
/
DeletePivot.py
File metadata and controls
41 lines (32 loc) · 1.15 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
38
39
40
from pxr import Usd
import omni.usd
import omni.kit.commands
# Get stage.
stage = omni.usd.get_context().get_stage()
# Get selection.
selection = omni.usd.get_context().get_selection()
paths = selection.get_selected_prim_paths()
# --------------------------------------------------.
# Delete pivot.
# --------------------------------------------------.
def _deletePivot(prim : Usd.Prim):
if prim == None:
return
path = f"{prim.GetPath().pathString}.xformOp:translate:pivot"
omni.kit.commands.execute("RemoveProperty", prop_path=path)
transformOrder = prim.GetAttribute("xformOpOrder").Get()
if transformOrder != None:
orderList = []
for sV in transformOrder:
if sV == "xformOp:translate:pivot" or sV == "!invert!xformOp:translate:pivot":
continue
orderList.append(sV)
prim.GetAttribute("xformOpOrder").Set(orderList)
# --------------------------------------------------.
for path in paths:
prim = stage.GetPrimAtPath(path)
if prim.IsValid() == True:
# Print prim name.
print(f'[ {prim.GetName()} ]')
# Delete pivot.
_deletePivot(prim)