Archived

This topic is now archived and is closed to further replies.

ogl2k

MaxScript

Recommended Posts

Anybody knows how to get the texture coords of a vertex? I use getVert to get the position coords of the vertex and I thought that getTVert could work but it doesn´t. Any help?

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Here''s a script I made along time ago...dumps alot of info to a file..maybe it could help you along.



  
clearlistener()
file = createfile "c:\\temp\\test.txt"

b = for i in $* collect
if (classof i == BoneGeometry) then i else dontcollect

at time 0 if b.count > 0 then (
print "<BONES>" to:file
print b.count to:file
coordsys parent for i = 1 to b.count do (
print b[i].name to:file
print b[i].pos to:file
format "[%,%,%,%]\n" b[i].rotation.x b[i].rotation.y b[i].rotation.z b[i].rotation.w to:file
)

for i = 1 to b.count do(
try (
print b[i].parent.name to:file
)
catch (
print "<ROOT>" to:file
)
)
)

o = for i in $* collect
if (classof i == Editable_mesh) then i else dontcollect

at time 0 for i = 1 to o.count do (
print "<MESH>" to:file
print o[i].name to:file
try (
print "<VERTS>" to:file
print o[i].NumVerts to:file
for v = 1 to o[i].NumVerts do (
print o[i].verts[v].pos to:file
)
)
catch (print "Error...")

try (
print "<FACES>" to:file
print o[i].NumFaces to:file
for f = 1 to o[i].numFaces do (
vi = getFace o[i] f
print vi to:file
)
)
catch (print "Error...")

try (
print "<TEXCOORDS>" to:file
print o[i].NumTVerts to:file
for v = 1 to o[i].NumTVerts do (
u = gettvert o[i] v
print u to:file
)
)
catch (print "Error...")

try (
print "<TEXFACES>" to:file
for f = 1 to o[i].NumFaces do (
ti = gettvface o[i] f
print ti to:file
)
)
catch (print "Error...")

if o[i].modifiers.count > 0 then (
if o[i].modifiers[1].name == "Skin" then (
s = o[i].modifiers[1]
max modify mode
modPanel.setCurrentObject s
tv = skinops.getNumberVertices s
if tv > 0 then (
print "<SKINWEIGHTS>" to:file
for v = 1 to tv do (
nb = skinops.getVertexWeightCount s v
for vb = 1 to nb do (
w = skinops.getVertexWeight s v vb
bID = skinops.getVertexWeightBoneID s v vb
bn = skinops.getBoneName s bID 1
format "[%,%,%]\n" v bn w to:file
)
)
print "<END>" to:file
)
)
)
m = o[i].material
if ((m != undefined) and (classof m == Standardmaterial)) then(
print "<MATERIAL>" to:file
format "[%,%,%]\n" m.diffuse.r m.diffuse.g m.diffuse.b to:file
format "[%,%,%]\n" m.ambient.r m.ambient.g m.ambient.b to:file
format "[%,%,%]\n" m.specular.r m.specular.g m.specular.b to:file

t = m.DiffuseMap
if ((t != undefined) and (classof t == Bitmaptexture)) then(
print t.filename to:file
)else(Print "<NONE>" to:file)

)
print "------------------------------------"
)

s = for i in $Tape* collect i
if s.count > 0 then (
print "<SPRING>" to:file
print (s.count / 2) to:file
for i = 1 to s.count by 2 do (
print s[i].pos to:file
print s[i+1].pos to:file
)
)

o = for i in $* collect
if (classof i == Point) then i else dontcollect
if o.count > 0 then (
print "<POINTS>" to:file
print o.count to:file
for i = 1 to o.count do (
print o[i].pos to:file
)
)

close file

Share this post


Link to post
Share on other sites