obj loader script
Posted: Fri Jan 03, 2014 4:52 am
A script that loads obj files from a directory and hook them up to an geo group node.
/David
/David
- Code: Select all
path = "C:\\your path\\"
cmd = "dir " .. path .. " /b /a"
objFile = {}
nObj = 0;
for dir in io.popen(cmd):lines() do
s = string.lower(string.sub(dir, -4))
if(s == ".obj") then
nObj = nObj + 1
objFile[nObj] = dir
print(objFile[nObj])
end
end
root = octane.nodegraph.getRootGraph()
group = octane.node.create{type=octane.NT_GEO_GROUP, name="Group", groupOwner=root, position={400,300}}
group:setAttribute(octane.A_PIN_COUNT, nObj, true)
for i=1,nObj do
mesh = octane.node.create{type=octane.NT_GEO_MESH , name=objFile[i], groupOwner=group , position={300 + i*50,230}}
mesh:setAttribute(octane.A_FILENAME, path .. objFile[i], true)
group:connectToIx(i, mesh)
end