PDA

View Full Version : MaxScript



ZeeBoy
12-07-2000, 01:22 PM
Dose any one know of a good max script that can be used to export model vertecies along with the texture coordinates. I have a script which exports the vertecies but in doing so i loose the texture coordinates.

The Script also captures frame out put. The reason i am doing this is for fast loading and increased performance in my demos. I any one has a good script can u send it to me

e-mail: ZeeBoy@techillusion.co.uk

any help would me most appriciated

Thanxs


ZeeBoy

Nutty
12-08-2000, 08:12 AM
I used to use max scripts... heres one that outputs texture coords.




filename = "c:\\" + $.name as string + ".hto"
myfile = createFile filename

print $.name to: myfile

print "MATERIALS" to: myfile
print sceneMaterials.count to: myfile
--for i= 1 to sceneMaterials.count do
--(
-- print sceneMaterials[i].diffusemap.filename to: myfile
--)


-- This prints out the vertex data of the normals of the object.
print "VERTICIES" to: myfile
print $.verts.count to: myfile
for i= 1 to $.verts.count do
(
print $.verts[i].position to: myfile
)

-- this prints out the normals, currently the mode is undefined. face normals.
print "NORMALS" to: myfile
for i= 1 to $.verts.count do
(
norm = getnormal $ i
print norm to: myfile
)

--This prints out the vertex colors of the object.
--printf "VERTEX COLORS" to: myfile
--for i= 1 to $.verts.count do
--(
-- col = getVertColor $ i
-- print col to: myfile
--)

-- This then prints out the face indexes, i.e. the set of indexes which make up
-- each face.
print "FACE INDEXES" to: myfile
print $.numfaces to: myfile
for i= 1 to $.numFaces do
(
k = getface $ i
print k to: myfile
)

-- Print out the material id for each face.
print "MATERIAL IDS" to: myfile
for i= 1 to $.numfaces do
(
m = getfacematid $ i
print m to: myfile
)


-- Now we will output the texture coords.
print "TEXTURE COORDS" to: myfile
m = getNumTVerts $
print m to: myfile
for i= 1 to getNumTVerts $ do
(
l = getTVert $ i
print l to: myfile
)


print "TEXTURE INDEXES" to: myfile
for i= 1 to $.numFaces do
(
m = getTVFace $ i
print m to: myfile
)


print "END" to: myfile

close myfile


Not sure if the material stuff works though.
hope that helps.

Nutty



[This message has been edited by Nutty (edited 12-08-2000).]

ZeeBoy
12-09-2000, 12:49 PM
Thanks a lot for ur input my freind. much appriciated

dmy
12-11-2000, 05:16 AM
hi nutty.
maybe you know how to do this.
i wrote a ascii exporter for max, using MAXscript, but i've problems when extracting normals to verts.

it seems that in maxscript you can only access one normal per vertex, when instead is correct to have multiple normals per vertex, as in the junction between different smoothing groups.

.ase follow this rule, in fact in the normals section you get 4 normals each face.

can you help me?
or better, where i can find resources?

thanx
DMY