从文本文件MaxScript导入对象位置

时间:2014-01-06 12:56:10

标签: scripting 3dsmax maxscript

如何在MaxScript中从纺织品中读取/导入对象位置数据(对于场景中的每个对象/模型)?

我的TextFile: X,Y,Z,MODELNAME

感谢。

1 个答案:

答案 0 :(得分:1)

每条记录的新行?

(
    file = memStreamMgr.openFile @"C:\sample.ext"

    while NOT file.eos() do
    (
        local line = filterString (file.readLine()) ", "
        if line.count == 4 AND isValidNode (local obj = getNodeByName line[4]) do
            obj.pos = [line[1] as float, line[2] as float, line[3] as float]
    )
    memStreamMgr.close file
)