Created
March 30, 2011 05:13
-
-
Save shihongzhi/893896 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import maya.cmds as cmds | |
| f1 = open(r"C:\Users\shihongzhi\Desktop\newproject\test\sparse3dpoint-absolute.txt") | |
| i = 0 | |
| for line in f1.readlines()[40:]: | |
| if i%6 == 0: | |
| point = [float(t) for t in line[:-2].split(" ")] | |
| #cmds.spaceLocator(p=(point[0],point[1],point[2])) | |
| cmds.sphere(p=point,r=0.01) | |
| elif i%6 == 1: | |
| colors = [float(t)/255 for t in line[:-2].split(" ")] | |
| cmds.colorIndex(1,colors[0],colors[1],colors[2]) #这里颜色有问题,只能显示为第一个颜色 | |
| cmds.color('nurbsSphereShape%d'%(i/6+1),ud=1) #ud's range is [1-8] | |
| i = i + 1 | |
| f2 = open(r"C:\Users\shihongzhi\Desktop\newproject\test\camera-absolute.txt") | |
| i = 0 | |
| cameraName = cmds.camera() | |
| for line in f2.readlines()[38:]: | |
| temp = [float(t) for t in line.split(" ")] | |
| if i%5==0: | |
| l = [] | |
| else: | |
| l.extend(temp) | |
| if i%5==4: | |
| cmds.xform(cameraName,m=l) | |
| cmds.xform(cameraName,s=[0.1,0.1,0.1]) | |
| cmds.setKeyframe(cameraName,t=float(i)) | |
| i = i + 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment