我有一个大型数据集:
1479661:-1,1,-1,-898,-769,0.00;-1,2,-1,-96,-1402,0.00;-1,3,-1,117,-1397,0.00;-1,4,-1,-4,-2420,0.00;4,5,-1,5570,4395,0.00;4,6,-1,5570,4395,0.00;4,7,-1,5570,4395,0.00;4,8,-1,5570,4395,0.00;4,9,-1,5570,4395,0.00;4,10,-1,5570,4395,0.00;4,11,-1,5570,4395,0.00;4,12,-1,5570,4395,0.00;4,13,-1,5570,4395,0.00;4,14,-1,5570,4395,0.00;-1,15,-1,913,-3533,0.00;4,16,-1,5570,4395,0.00;4,17,-1,5570,4395,0.00;4,18,-1,5570,4395,0.00;4,19,-1,5570,4395,0.00;4,20,-1,5570,4395,0.00;4,21,-1,5570,4395,0.00;4,22,-1,5570,4395,0.00;4,23,-1,5570,4395,0.00;4,24,-1,5570,4395,0.00;4,25,-1,5570,4395,0.00;4,26,-1,5570,4395,0.00;4,27,-1,5570,4395,0.00;4,28,-1,5570,4395,0.00;4,29,-1,5570,4395,0.00;:117,-1397,7,7.00,A,Dead;:
数组中有29个对象分隔;每个对象都包含一个xyz。我在maxfile中有29个对象如何将xyz分配给每个对象并记录关键帧然后移动到3ds max中的下一个关键帧并记录29个对象的下一个数据集(xyz):
1479662:-1,1,-1,-898,-769,0.00;-1,2,-1,-96,-1402,0.00;-1,3,-1,117,-1392,0.00;-1,4,-1,-6,-2419,0.00;4,5,-1,5570,4395,0.00;4,6,-1,5570,4395,0.00;4,7,-1,5570,4395,0.00;4,8,-1,5570,4395,0.00;4,9,-1,5570,4395,0.00;4,10,-1,5570,4395,0.00;4,11,-1,5570,4395,0.00;4,12,-1,5570,4395,0.00;4,13,-1,5570,4395,0.00;4,14,-1,5570,4395,0.00;-1,15,-1,913,-3533,0.00;4,16,-1,5570,4395,0.00;4,17,-1,5570,4395,0.00;4,18,-1,5570,4395,0.00;4,19,-1,5570,4395,0.00;4,20,-1,5570,4395,0.00;4,21,-1,5570,4395,0.00;4,22,-1,5570,4395,0.00;4,23,-1,5570,4395,0.00;4,24,-1,5570,4395,0.00;4,25,-1,5570,4395,0.00;4,26,-1,5570,4395,0.00;4,27,-1,5570,4395,0.00;4,28,-1,5570,4395,0.00;4,29,-1,5570,4395,0.00;:117,-1392,7,7.07,A,Dead;:
数据以每秒25帧的速度存储在* .dat文件中
目标是将整个数据主要用于xyz corodinates到每个对象并将位置记录到关键帧
答案 0 :(得分:0)
我不确定我是否理解你的文件格式,但是这样的话:
stream = openFile "file.dat"
data = readLine stream
objs = filterString data ";" --split text for sepparate lines, each per object
objData = objs[1]
for objData in objs do --for all objects
(
data = filterString objData ":" --split line for object into name and coords
obj = getnodebyname data[1] --select object by name
coords = filterString data[2] "," --get all coords as plain array x1, y1, z1, x2, y2, z2 ...
keysCount = coords.count / 3 --compute keys count
with animate on
(
for i = 0 to keysCount-1 do --for all keys
(
at time i obj.pos.controller.x_position = coords[i*3 + 1] as float
at time i obj.pos.controller.y_position = coords[i*3 + 2] as float
at time i obj.pos.controller.z_position = coords[i*3 + 3] as float --read and set position
)
)
)