galagast
12-03-2004, 03:41 PM
I used two scripts that came with max (from the HOW TO examples), combined them to function as one in a single press of a button.. it works well...
rollout xport_rol "Xport"
(
button xport "Export"
on xport pressed do
(
vert_array = #()
face_array = #()
if selection != undefined do
(
for i in 1 to selection.count do
(
tmesh = snapshotAsMesh selection[i]
out_name = ((GetDir #export)+"/testmesh_0"+i as string+".dat")
out_file = createfile out_name
num_verts = tmesh.numverts
num_faces = tmesh.numfaces
format "%,%\n" num_verts num_faces to:out_file
for v = 1 to num_verts do
(
vert = getVert tmesh v
format "%," vert to:out_file
)
format "\n" to:out_file
for f = 1 to num_faces do
(
face = getFace tmesh f
format "%," face to:out_file
)
close out_file
-------------------------------------------------------------
in_name = ((GetDir #export)+"/testmesh_0"+i as string+".dat")
in_file = openFile in_name
if in_file != undefined then
(
num_verts = readValue in_file
num_faces = readValue in_file
vert_array.count = num_verts
face_array.count = num_faces
for v = 1 to num_verts do
(
vert = readValue in_file
vert_array[v] = vert
)
for f = 1 to num_faces do
(
face = readValue in_file
face_array[f] = face
)
)
close in_file
new_mesh = mesh vertices:vert_array faces:face_array
)
)
)
)createdialog xport_rol
now my problem is, how do i copy uvs so that when the import is performed, uvs are retained... I dont know where to start looking in the reference. cud anybody give me hint. :D
I intend to use it with pathdeforem WSM, i cant sanpshot the mesh bcoz of the world space modifier, though with the script above, i was able to get the mesh, but with no UVs... I just hope i cud include the uvs on the export. Or if anyone know other workaround for this, im all ears to any suggestions. :thumbsup:
rollout xport_rol "Xport"
(
button xport "Export"
on xport pressed do
(
vert_array = #()
face_array = #()
if selection != undefined do
(
for i in 1 to selection.count do
(
tmesh = snapshotAsMesh selection[i]
out_name = ((GetDir #export)+"/testmesh_0"+i as string+".dat")
out_file = createfile out_name
num_verts = tmesh.numverts
num_faces = tmesh.numfaces
format "%,%\n" num_verts num_faces to:out_file
for v = 1 to num_verts do
(
vert = getVert tmesh v
format "%," vert to:out_file
)
format "\n" to:out_file
for f = 1 to num_faces do
(
face = getFace tmesh f
format "%," face to:out_file
)
close out_file
-------------------------------------------------------------
in_name = ((GetDir #export)+"/testmesh_0"+i as string+".dat")
in_file = openFile in_name
if in_file != undefined then
(
num_verts = readValue in_file
num_faces = readValue in_file
vert_array.count = num_verts
face_array.count = num_faces
for v = 1 to num_verts do
(
vert = readValue in_file
vert_array[v] = vert
)
for f = 1 to num_faces do
(
face = readValue in_file
face_array[f] = face
)
)
close in_file
new_mesh = mesh vertices:vert_array faces:face_array
)
)
)
)createdialog xport_rol
now my problem is, how do i copy uvs so that when the import is performed, uvs are retained... I dont know where to start looking in the reference. cud anybody give me hint. :D
I intend to use it with pathdeforem WSM, i cant sanpshot the mesh bcoz of the world space modifier, though with the script above, i was able to get the mesh, but with no UVs... I just hope i cud include the uvs on the export. Or if anyone know other workaround for this, im all ears to any suggestions. :thumbsup:
