Copy the code below, open up 3DS Max, Maxscript Menu>New Script, then paste, save, Maxscript Menu>Run Script, select the script you saved.
Now it's going to ask for the mesh file, so open up a .geo in the "Mesh" folder eg. 0144_torsoupper.geo
Then it's going to ask for the UV file which is also a .geo file, but should be in the "MeshVolatile" folder eg. 0145_torsoupper.geo
Notice that the number is different, lower is the mesh and greater is the UV.
14/02/11 Edit: Fixed the code so it didn't suck...
23/02/11 Edit 2: The .geo format is really inconsistent, so I've added an "if statement" for more compatibility.
6/03/11 Edit 3: Found another face count, should fix problems with files that have multiple meshes
Code: Select all
fname = getOpenFileName \
caption:"Open .geo from Mesh folder" \
types:"Dead Space 2 Mesh(*.geo)|*.geo" \
historyCategory:"DeadSpace2ObjectPresets"
f = fopen fname "rb"
gname = getOpenFileName \
caption:"Open .geo from MeshVolatile folder" \
types:"Dead Space 2 UV(*.geo)|*.geo" \
historyCategory:"DeadSpace2ObjectPresets"
g = fopen gname "rb"
clearlistener()
fscale=100
indices = 0
Face_array=#()
Vert_array=#()
UV_array=#()
fseek f 0x50 #seek_set
infoOff1=readlong f
r=readlong f
r=readlong f
r=readlong f
r=readlong f
r=readlong f
infoOff2=readlong f
fseek f infoOff1 #seek_set
fseek f 48 #seek_cur
Print ("Last Read @ 0x"+((bit.intAsHex(ftell f))as string))
faceInd=readlong f
fseek f 76 #seek_cur
unk01=readlong f
vertOff=readlong f
faceOff=readlong f
fseek f infoOff2 #seek_set
Print ("Last Read @ 0x"+((bit.intAsHex(ftell f))as string))
unk1=readlong f
vertcount=readlong f
unk2=readlong f
null1=readlong f
unk3=readlong f
vertcount=readlong f
unk4=readlong f
unk5=readlong f
unk6=readlong f
face=readlong f
Print ("Last Read @ 0x"+((bit.intAsHex(ftell f))as string))
unk7=readlong f
unk8=readlong f
unk9=readlong f
unk10=readlong f
unk11=readlong f
unk12=readlong f
unk13=readlong f
face2=readlong f
Print ("face2 @ 0x"+((bit.intAsHex(ftell f))as string))
fseek f vertOff #seek_set
Print ("Last Read @ 0x"+((bit.intAsHex(ftell f))as string))
for x = 1 to vertcount do(
vx=readfloat f
vy=readfloat f
vz=readfloat f
p=readfloat f
p=readfloat f
p=readfloat f
p=readfloat f
p=readfloat f
append Vert_array([vx,vy,vz] * fscale)
)
for u = 1 to vertcount do(
tu=readfloat g
tv=readfloat g
append UV_array[tu,tv,0]
)
fseek f faceoff #seek_set
Print ("Last Read @ 0x"+((bit.intAsHex(ftell f))as string))
if (face2 > faceInd) then (
indices = face2
)else(
indices = faceInd)
if (faceInd > face) then (
indices = faceInd
)else(
indices = face)
for x = 1 to indices/3 do(
fa=readshort f #unsigned+1
fb=readshort f #unsigned+1
fc=readshort f #unsigned+1
append Face_array[fa,fb,fc]
)
Print ("Last Read @ 0x"+((bit.intAsHex(ftell f))as string))
msh = mesh vertices:Vert_array faces:Face_array
msh.numTVerts = UV_array.count
buildTVFaces msh
for j = 1 to UV_array.count do setTVert msh j UV_array[j]
for j = 1 to Face_array.count do setTVFace msh j Face_array[j]
Print ("Last Read @ 0x"+((bit.intAsHex(ftell f))as string))
gc()
fclose f
fclose g