-
Notifications
You must be signed in to change notification settings - Fork 1
/
maya_python_original.py
30 lines (25 loc) · 1.13 KB
/
maya_python_original.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
import maya.cmds as mc
import maya.mel as mm
melproc = """
global proc portData(string $arg){
python(("portData(\\"" + $arg + "\\")"));
}
"""
mm.eval(melproc)
def portData(arg):
"""
Read the 'serial' data passed in from the commandPort
"""
arg = arg.split(",")
print "From Vicon: ", arg
mc.setKeyframe('head', attribute='rotateX', t=float(arg[1]), v=float(arg[4]))
mc.setKeyframe('head', attribute='rotateY', t=float(arg[1]), v=float(arg[5]))
mc.setKeyframe('head', attribute='rotateZ', t=float(arg[1]), v=float(arg[6]))
mc.setKeyframe('EyeL', attribute='rotateX', t=float(arg[1]), v=float(arg[11]))
mc.setKeyframe('EyeL', attribute='rotateY', t=float(arg[1]), v=float(arg[12]))
mc.setKeyframe('EyeR', attribute='rotateX', t=float(arg[1]), v=float(arg[15]))
mc.setKeyframe('EyeR', attribute='rotateY', t=float(arg[1]), v=float(arg[16]))
mc.commandPort(name="198.21.234.139:7777", echoOutput=False, noreturn=False,
prefix="portData", returnNumCommands=True)
mc.commandPort(name=":7777", echoOutput=False, noreturn=False,
prefix="portData", returnNumCommands=True)