forked from sidmehraajm/Eternal_Code
-
Notifications
You must be signed in to change notification settings - Fork 1
/
ZeroOut.py
41 lines (31 loc) · 914 Bytes
/
ZeroOut.py
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
41
#zeroout
slc = cmds.ls(sl=True,tr=1)
selList = []
try:
parentt=cmds.listRelatives(p=True)
sz= len(parentt)
if sz>0:
for each in slc:
newName = each.replace(parentt[0]+'|','')
selList.append(newName)
print newName
else:
pass
except:
pass
print 'passed parent ftn'
for i in slc:
tmploc = cmds.spaceLocator()
cmds.delete(cmds.parentConstraint(i,tmploc))
pos = cmds.xform(tmploc, q=True, t=True, ws=True)
rot = cmds.xform(tmploc, q=True, ro=True, ws=True)
try:
name = i.replace(parentt[0]+'|','')
except:
name = i
offgrp = cmds.createNode('transform',n=(name+'_ZO_Grp'))
cmds.xform(offgrp, translation=pos, ws=True)
cmds.xform(offgrp, rotation=rot, ws=True)
cmds.delete(tmploc)
cmds.parent(i,offgrp)
cmds.select(cl=True)