Jump to content


Use Maxscript To Import Models

  • Please log in to reply
No replies to this topic

#1 X360_Guy


    X-S Enthusiast

  • Members
  • 4 posts

Posted 28 December 2010 - 04:29 AM

thought I'd drop this here, during my free time off during the holidays I wanted to make a video guide on how to use MaxScript aka 3dsmax to import models.

these videos will show you some basics on using maxscript to import data from random binary files...

I'm fairly new to maxscript, or programing in general so please forgive me if I got a thing here or there wrong. tongue.gif


the PMD samples I got from the MikUMikuDance, some PMD were packed with the program.


and here is the sample script I did in the video


f = fopen "E:\\Hacking Projects\\PMD\\MEIKO.pmd" "rb"

fn ReadFixedString bstream fixedLen =
    local str = ""
    for i = 1 to fixedLen do
        str0 = ReadByte bstream #unsigned
        if str0!=0xFD AND str0!=0xFC do str+= bit.intAsChar str0


fileName =ReadFixedString f 3
fileVersion=readfloat f
modelName=ReadFixedString f 20
comments=ReadFixedString f 256

count=readlong f #unsigned

for x = 1 to count do(

vx=readfloat f
vy=readfloat f
vz=readfloat f
p4=readfloat f
p5=readfloat f
p6=readfloat f
tu=readfloat f
tv=readfloat f
p9=readshort f
p10=readshort f
p11=readshort f
append Vert_array[vx,vz,vy]
append UV_array[tu,tv,0]

count=readlong f #unsigned

print count

for x = 1 to count/3 do(
fa=readshort f #unsigned+1
fb=readshort f #unsigned+1
fc=readshort f #unsigned+1
append Face_array[fc,fb,fa]

msh = mesh vertices:Vert_array faces:Face_array
msh.numTVerts = UV_array.count
buildTVFaces msh
-- convertTo msh PolyMeshObject
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))
fclose f

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users