Sign in to follow this  
NestorPL

MAXscript output.

Recommended Posts

Hi everyone. Im writing a little exporter for my own engine, but i've stumbled upon a little obstacle. I cant output the texture mapping. For some strange reason the already mapped object cannot be written to file with texture mappings because maxscript says that .numtverts is 'undefined', thus i cant obtain the uv mapping on vertices, and cant build texture faces. I found some meshops in the maxscript reference about bulding the default mapping mesh, but that doesnt help either. Thanks for any constructive help. Here's the code: MacroScript ExportMesh3 category:"HowTo" ( fn GetGeometry o = ( Superclassof o == Geometryclass and classof o != TargetObject ) obj = pickobject if isValidNode obj then ( tmesh = snapshotAsMesh obj out_name = GetSaveFileName() if out_name != undefined then ( out_file = createfile out_name num_verts = tmesh.numverts num_faces = tmesh.numfaces meshop.DefaultMapFaces tmesh 1 num_faces num_tverts = meshop.getNumTVerts tmesh num_tvfaces = tmesh.numtvfaces format "verts/normal here : \n" to:out_file format "%,%,%,%\n" num_verts num_faces num_tverts num_tvfaces to:out_file for v = 1 to num_verts do ( format "%," (getVert tmesh v) to:out_file format "\n" to:out_file format "%," (getNormal tmesh v) to:out_file format "\n" to:out_file ) format "tverts here : \n" to:out_file for v = 1 to num_tverts do ( -- error below this line (numverts is 'undefined') --- format "%," (getTVert tmesh v) to:out_file format "\n" to:out_file ) for f = 1 to num_faces do ( face = getFace tmesh f tvface = getTVFace tmesh f matid = getFaceMatId tmesh f format "%,%\n" face matid to:out_file ) format "tverts here : \n" to:out_file for f = 1 to num_tvfaces do ( tvface = getTVFace tmesh f matid = getFaceMatId tmesh f format "%,%,%,%,%,%\n" face matid to:out_file ) close out_file edit out_name ) ) )

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this