macroScript Export_BPM category:"Blue Phoenix Exporters" tooltip:"Blue Phoenix Model Exporter" Icon:#("AtmosApp",1)
(
tmesh = snapshotAsMesh selection[1]
out_name = getSaveFileName types: "Blue Phoenix Models(*.bpm) |*.bpm|"
out_file = createfile out_name
num_verts = tmesh.numverts
num_faces = tmesh.numfaces
num_tverts = tmesh.numtverts
format "// Blue Phoenix Model Exporter\n// Created By: Andrew Esser\n// Date: 12\11\2006\n// Copyright (C) esserSoft Technologies, 2006\n" to:out_file
format "\n#V:%\n#F:%\n\n" num_verts num_faces to:out_file
format "Vertices {\n" to:out_file
for v = 1 to num_verts do
(
vert = getVert tmesh v
format "%\n" vert to:out_file
)
format "}\n\n" to:out_file
format "Normals {\n" to:out_file
for n = 1 to num_verts do
(
norm = getNormal tmesh n
format "%\n" norm to:out_file
)
format "}\n\n" to:out_file
format "Vertex Faces {\n" to:out_file
for f = 1 to num_faces do
(
face = getFace tmesh f
format "%\n" (face - 1) to:out_file
)
format "}\n\n" to:out_file
format "Texture {\n" to:out_file
for t = 1 to num_tverts do
(
texture = getTVert tmesh t
format "%\n" texture to:out_file
)
format "}\n\n" to:out_file
format "Texture Faces {\n" to:out_file
for s = 1 to num_verts do
(
textureFaces = getTVface tmesh s
format "%\n" (textureFaces - 1) to:out_file
)
format "}" to:out_file
close out_file
)
MaxScript Exporter
Hey There,
I've got Max exporting the Vertices and Normals correctly, all fun and dandy, displays correctly in my Game Engine. It also exports the Texture Faces and Coordinates, again all correct. However, I do not know how to get Max to export the relevant Texture path for each face (which I'm assuming would be indexed).
I've included my Maxscript with this email. It would be much appreciated if someone were able to tell me how I could export the texture paths and reference the texture index for each face.
Quote:Original post by AndyEsserI've included my Maxscript with this email. It would be much appreciated if someone were able to tell me how I could export the texture paths and reference the texture index for each face.
every node in max has a "material" property. and if that is not a "Multimaterial" object you can get diffuse texture's path with:
"node.material.diffuseMap.fileName" and other maps' names can be accessed similarly. i dont understand what you mean with "indexing"?
By Indexing I mean, Max gives me a list of Vertices, and then it gives me a list of faces, which are just integers like this
1,4,6
These simply refer to the Vertex at positions 1, 4, and 6 in the aforementioned Vertex List.
I was thinking along the lines of at the beginning I export the paths to the textures so:
"texture1.bmp"
"texture2.bmp"
And then for the faces instead of only having 3 values, xyz there's a 4 value which refers to the relevant texture.
So
4,2,5,2
That would refer to Vertices 4,2,5 and Texture 2(texture2.bmp)
1,4,6
These simply refer to the Vertex at positions 1, 4, and 6 in the aforementioned Vertex List.
I was thinking along the lines of at the beginning I export the paths to the textures so:
"texture1.bmp"
"texture2.bmp"
And then for the faces instead of only having 3 values, xyz there's a 4 value which refers to the relevant texture.
So
4,2,5,2
That would refer to Vertices 4,2,5 and Texture 2(texture2.bmp)
My exporter sorts all objects by texture, and simply loop through them all, i.e:
texture1.tga
1 // nr of object
... //vertex, normal, uv data
grass.tga
3
...
...
...
Works like a charm! :)
/Robert
texture1.tga
1 // nr of object
... //vertex, normal, uv data
grass.tga
3
...
...
...
Works like a charm! :)
/Robert
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement