3ds max export

Skeletons, animations, shaders, texturing, converting, fixing and anything else related to read game models
theclub456
Posts: 10
Joined: Tue Jan 27, 2015 11:32 pm

3ds max export

Post by theclub456 »

can anyone teach me how to make a exporter for a 3d model with 3ds max. like if i wanted to mod a game i would make an importer and exporter with 3ds max
TGE
Posts: 38
Joined: Sat Dec 20, 2014 5:14 pm

Re: 3ds max export

Post by TGE »

Example script:

Code: Select all

fname = getSaveFileName \ 
caption:"Save File" \
types:"Binary Model(*.bmdl)|*.bmdl"\
historyCategory:"CustomBMDL Object Presets"
o = fopen fname "wb"

ObjArray = #()

clearlistener()

max select all
ObjCount = selection.count
print "Object Count: "+ObjCount as string
WriteLong o (ObjCount as integer)
for x = 1 to ObjCount do (
   msh = snapshotAsMesh (selection[x])
   ObjArray[x]   = msh
   VertCount   = msh.numVerts
   UVCount    = msh.numTVerts
   FaceCount    = msh.numFaces
   print ("Object: "+ObjArray[x] as string)
   print ("Vertex Count: "+VertCount as string)
   print ("UV Count: "+UVCount as string)
   print ("Face Count: "+FaceCount as string)
   WriteLong o VertCount
   WriteLong o UVCount
   WriteLong o FaceCount
   
   Print ("Vertex Start = 0x"+(bit.intAsHex(ftell o)as string))
   for v = 1 to VertCount do (
      vert = getVert msh v
      vx = vert.x as float
      vy = vert.y as float
      vz = vert.z as float
      writefloat o vx
      writefloat o vy
      writefloat o vz
   )
   
   Print ("UV Start = 0x"+(bit.intAsHex(ftell o)as string))
   for u = 1 to UVCount do (
      tvert = getTvert msh u
      tu = tvert.x as float
      tv = tvert.y as float
      writefloat o tu
      writefloat o tv
   )
   
   Print ("Face Start = 0x"+(bit.intAsHex(ftell o)as string))
   for f = 1 to FaceCount do (
      face = getFace msh f
      f1 = face.x as integer -1
      f2 = face.y as integer -1
      f3 = face.z as integer -1
      writeshort o f1
      writeshort o f2
      writeshort o f3
   )
   
)

fclose o


Doesn't quite work as it intended (doesn't write each object to a seperate chunk) but it's a good example regardless.