def connectDevice(): serverAddress = KinectTest_TextFieldGrp_ServerAddress.getText() serverAddress = serverAddress + ":" + str(KinectTest_IntFieldGrp_Port.getValue1()) pm.defineDataServer(s=serverAddress,d='KinectCapture') #melGlobals.initVar( 'string[]', 'KinectSkelNames' ) i=0 for i in range(0,24): pm.attachDeviceAttr((KinectSkelNames[i] + ".translateX"),ax=(KinectSkelNames[i] + "_POS:X"),d="KinectCapture") pm.setAttrMapping(ax=(KinectSkelNames[i] + "_POS:X"),scale=-0.01,d="KinectCapture",at=(KinectSkelNames[i] + ".translateX")) pm.attachDeviceAttr((KinectSkelNames[i] + ".translateY"),ax=(KinectSkelNames[i] + "_POS:Y"),d="KinectCapture") pm.setAttrMapping(ax=(KinectSkelNames[i] + "_POS:Y"),scale=+0.01,d="KinectCapture",at=(KinectSkelNames[i] + ".translateY")) pm.attachDeviceAttr((KinectSkelNames[i] + ".translateZ"),ax=(KinectSkelNames[i] + "_POS:Z"),d="KinectCapture") pm.setAttrMapping(ax=(KinectSkelNames[i] + "_POS:Z"),scale=-0.01,d="KinectCapture",at=(KinectSkelNames[i] + ".translateZ")) pm.attachDeviceAttr((KinectSkelNames[i] + ".rotateX"),ax=(KinectSkelNames[i] + "_ORI:X"),d="KinectCapture") pm.setAttrMapping(ax=(KinectSkelNames[i] + "_ORI:X"),scale=-1.0,d="KinectCapture",at=(KinectSkelNames[i] + ".rotateX")) pm.attachDeviceAttr((KinectSkelNames[i] + ".rotateY"),ax=(KinectSkelNames[i] + "_ORI:Y"),d="KinectCapture") pm.setAttrMapping(ax=(KinectSkelNames[i] + "_ORI:Y"),scale=-1.0,d="KinectCapture",at=(KinectSkelNames[i] + ".rotateY")) pm.attachDeviceAttr((KinectSkelNames[i] + ".rotateZ"),ax=(KinectSkelNames[i] + "_ORI:Z"),d="KinectCapture") pm.setAttrMapping(ax=(KinectSkelNames[i] + "_ORI:Z"),scale=-1.0,d="KinectCapture",at=(KinectSkelNames[i] + ".rotateZ")) pm.attachDeviceAttr("KINECT_HAND.translateX",ax="HAND_POS:X",d="KinectCapture") pm.setAttrMapping(ax="HAND_POS:X",scale=1.3,d="KinectCapture",at="KINECT_HAND.translateX") pm.attachDeviceAttr("KINECT_HAND.translateY",ax="HAND_POS:Y",d="KinectCapture") pm.setAttrMapping(ax="HAND_POS:Y",scale=1.3,d="KinectCapture",at="KINECT_HAND.translateY") pm.attachDeviceAttr("KINECT_HAND.translateZ",ax="HAND_POS:Z",d="KinectCapture") pm.setAttrMapping(ax="HAND_POS:Z",scale=1.3,d="KinectCapture",at="KINECT_HAND.translateZ") Recording = True print Recording
def connectDevice(): serverAddress = KinectTest_TextFieldGrp_ServerAddress.getText() serverAddress = serverAddress + ":" + str( KinectTest_IntFieldGrp_Port.getValue1()) pm.defineDataServer(s=serverAddress, d='KinectCapture') #melGlobals.initVar( 'string[]', 'KinectSkelNames' ) i = 0 for i in range(0, 24): pm.attachDeviceAttr((KinectSkelNames[i] + ".translateX"), ax=(KinectSkelNames[i] + "_POS:X"), d="KinectCapture") pm.setAttrMapping(ax=(KinectSkelNames[i] + "_POS:X"), scale=-0.01, d="KinectCapture", at=(KinectSkelNames[i] + ".translateX")) pm.attachDeviceAttr((KinectSkelNames[i] + ".translateY"), ax=(KinectSkelNames[i] + "_POS:Y"), d="KinectCapture") pm.setAttrMapping(ax=(KinectSkelNames[i] + "_POS:Y"), scale=+0.01, d="KinectCapture", at=(KinectSkelNames[i] + ".translateY")) pm.attachDeviceAttr((KinectSkelNames[i] + ".translateZ"), ax=(KinectSkelNames[i] + "_POS:Z"), d="KinectCapture") pm.setAttrMapping(ax=(KinectSkelNames[i] + "_POS:Z"), scale=-0.01, d="KinectCapture", at=(KinectSkelNames[i] + ".translateZ")) pm.attachDeviceAttr((KinectSkelNames[i] + ".rotateX"), ax=(KinectSkelNames[i] + "_ORI:X"), d="KinectCapture") pm.setAttrMapping(ax=(KinectSkelNames[i] + "_ORI:X"), scale=-1.0, d="KinectCapture", at=(KinectSkelNames[i] + ".rotateX")) pm.attachDeviceAttr((KinectSkelNames[i] + ".rotateY"), ax=(KinectSkelNames[i] + "_ORI:Y"), d="KinectCapture") pm.setAttrMapping(ax=(KinectSkelNames[i] + "_ORI:Y"), scale=-1.0, d="KinectCapture", at=(KinectSkelNames[i] + ".rotateY")) pm.attachDeviceAttr((KinectSkelNames[i] + ".rotateZ"), ax=(KinectSkelNames[i] + "_ORI:Z"), d="KinectCapture") pm.setAttrMapping(ax=(KinectSkelNames[i] + "_ORI:Z"), scale=-1.0, d="KinectCapture", at=(KinectSkelNames[i] + ".rotateZ")) pm.attachDeviceAttr("KINECT_HAND.translateX", ax="HAND_POS:X", d="KinectCapture") pm.setAttrMapping(ax="HAND_POS:X", scale=1.3, d="KinectCapture", at="KINECT_HAND.translateX") pm.attachDeviceAttr("KINECT_HAND.translateY", ax="HAND_POS:Y", d="KinectCapture") pm.setAttrMapping(ax="HAND_POS:Y", scale=1.3, d="KinectCapture", at="KINECT_HAND.translateY") pm.attachDeviceAttr("KINECT_HAND.translateZ", ax="HAND_POS:Z", d="KinectCapture") pm.setAttrMapping(ax="HAND_POS:Z", scale=1.3, d="KinectCapture", at="KINECT_HAND.translateZ") Recording = True print Recording
def SwitchPerspective(): print "SwitchPerpective" #Attach attribute and set mapping of camera's position("SKEL_HEAD") and orientation("SKEL_NECK") pm.attachDeviceAttr(("camera1" + ".translateX"),ax=("SKEL_HEAD" + "_POS:X"),d="KinectCapture") pm.setAttrMapping(ax=("SKEL_HEAD" + "_POS:X"),scale=-0.01,d="KinectCapture",at=("camera1" + ".translateX")) pm.attachDeviceAttr(("camera1" + ".translateY"),ax=("SKEL_HEAD" + "_POS:Y"),d="KinectCapture") pm.setAttrMapping(ax=("SKEL_HEAD" + "_POS:Y"),scale=+0.01,d="KinectCapture",at=("camera1" + ".translateY")) pm.attachDeviceAttr(("camera1" + ".translateZ"),ax=("SKEL_HEAD" + "_POS:Z"),d="KinectCapture") pm.setAttrMapping(ax=("SKEL_HEAD" + "_POS:Z"),scale=-0.01,d="KinectCapture",at=("camera1" + ".translateZ")) pm.attachDeviceAttr(("camera1"+".rotateX"),ax=("SKEL_HEAD" + "_ORI:X"),d="KinectCapture") pm.setAttrMapping(ax=("SKEL_HEAD" + "_ORI:X"),scale=-1.0,d="KinectCapture",at=("camera1"+".rotateX")) pm.attachDeviceAttr(("camera1"+".rotateY"),ax=("SKEL_HEAD" + "_ORI:Y"),d="KinectCapture") pm.setAttrMapping(ax=("SKEL_HEAD" + "_ORI:Y"),scale=1.0,d="KinectCapture",at=("camera1"+".rotateY")) pm.attachDeviceAttr(("camera1"+".rotateZ"),ax=("SKEL_HEAD" + "_ORI:Z"),d="KinectCapture") pm.setAttrMapping(ax=("SKEL_HEAD" + "_ORI:Z"),scale=-1.0,d="KinectCapture",at=("camera1"+".rotateZ")) '''
def SwitchPerspective(): print "SwitchPerpective" #Attach attribute and set mapping of camera's position("SKEL_HEAD") and orientation("SKEL_NECK") pm.attachDeviceAttr(("camera1" + ".translateX"), ax=("SKEL_HEAD" + "_POS:X"), d="KinectCapture") pm.setAttrMapping(ax=("SKEL_HEAD" + "_POS:X"), scale=-0.01, d="KinectCapture", at=("camera1" + ".translateX")) pm.attachDeviceAttr(("camera1" + ".translateY"), ax=("SKEL_HEAD" + "_POS:Y"), d="KinectCapture") pm.setAttrMapping(ax=("SKEL_HEAD" + "_POS:Y"), scale=+0.01, d="KinectCapture", at=("camera1" + ".translateY")) pm.attachDeviceAttr(("camera1" + ".translateZ"), ax=("SKEL_HEAD" + "_POS:Z"), d="KinectCapture") pm.setAttrMapping(ax=("SKEL_HEAD" + "_POS:Z"), scale=-0.01, d="KinectCapture", at=("camera1" + ".translateZ")) pm.attachDeviceAttr(("camera1" + ".rotateX"), ax=("SKEL_HEAD" + "_ORI:X"), d="KinectCapture") pm.setAttrMapping(ax=("SKEL_HEAD" + "_ORI:X"), scale=-1.0, d="KinectCapture", at=("camera1" + ".rotateX")) pm.attachDeviceAttr(("camera1" + ".rotateY"), ax=("SKEL_HEAD" + "_ORI:Y"), d="KinectCapture") pm.setAttrMapping(ax=("SKEL_HEAD" + "_ORI:Y"), scale=1.0, d="KinectCapture", at=("camera1" + ".rotateY")) pm.attachDeviceAttr(("camera1" + ".rotateZ"), ax=("SKEL_HEAD" + "_ORI:Z"), d="KinectCapture") pm.setAttrMapping(ax=("SKEL_HEAD" + "_ORI:Z"), scale=-1.0, d="KinectCapture", at=("camera1" + ".rotateZ")) '''