-
Notifications
You must be signed in to change notification settings - Fork 1
/
pcCreateRigAlt00IRecord.py
35 lines (29 loc) · 1.22 KB
/
pcCreateRigAlt00IRecord.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
import maya.cmds as mc
import pymel.core.runtime as pyml
# thanks to http://www.scatena.tv/blog/2016/06/03/maya-tips--tricks---mouse-capture/
class pcCreateRigAlt00IRecord(object):
def __init__(self, deleteRight=False):
mshChar = 'GEO_woman'
self.tgpMakeBC(mshChar, deleteRight)
def tgpMakeBC(self, mshChar, deleteRight):
startFrame = mc.playbackOptions(query=True, minTime=True)
mc.currentTime(startFrame)
mySel = mc.ls(sl=True)[0] # my current selection
mc.cutKey(mySel, s=True) # delete key command
# return
records = ['tx', 'ty', 'tz', 'rx', 'ry', 'rz']
for i in range(len(records)):
name = "record{0}".format(i + 1)
if mc.objExists(name):
mc.delete(name)
try:
mc.setAttr("{0}.{1}".format(mySel, records[i]), 0)
except:
print("{0}.{1} could not be set".format(mySel, records[i]))
# pyml.SetKeyTranslate()
pyml.SetKey()
currentUnitAngle = mc.currentUnit(q=True, a=True)
mc.currentUnit(a="rad")
mc.recordAttr(at=records)
mc.play(record=True)
mc.currentUnit(a=currentUnitAngle)