to get better access to more complex model formats.
Why not making it capable of loading/executing phyton scripts for example?
But I quickly realized that it would make no sense -trying- to create a Noesis clone.
Another thought was to supply a bunch of max script templates for a special kind of models each.
So analyzing with hex2obj and then manually transferring the results to the best fitting template.
Finally ending up having a "create max script" button in hex2obj (years later, hehehe)
To give this new idea a start I made a max script for pcmesh faceindices then realized it could be simply
done using hex2obj with DWORD faceindices selected.
So this is the second try (on another format, *.pb), thus the scripts named tple2.ms (faceshape) and tple2b.ms (hair)
to be used with luci.pb only from this thread: viewtopic.php?f=29&t=10894&start=15, post as of 8-19-2014
load luci.pb, and enter an obj file name where the results are to be saved to.
tple2.ms, faceshape
Code: Select all
function ReadModelFile fName file_out=
(
format "-- START READING MODEL FILE --\n"
stream = fOpen fname "rb" -- Open the file for reading
fSeek stream 0x7DA8C #seek_set -- start of vertices
for k=1 to 8 do ( -- 8: submesh count
print ("@ 0x"+ bit.intAsHex(ftell stream) as string)
for i=1 to 24 do ( -- a vertex count of 24 doesn't apply to all submeshes!
x = readFloat stream
y = readFloat stream
z = readFloat stream
format "v % % %\n" x y z to:file_out
)
format "#\n" to:file_out
fSeek stream 512 #seek_cur -- meet next submesh
)
for i=1 to 13 do ( -- a vertex count of 24 doesn't apply to all submeshes!
x = readFloat stream
y = readFloat stream
z = readFloat stream
format "v % % %\n" x y z to:file_out
)
fSeek stream 0x7D4A0 #seek_set -- start of face indices
maxcnt=0
face_cnt= 747/3
for i=1 to face_cnt do (
f1 = (readShort stream #unsigned) + 1
f2 = (readShort stream #unsigned) + 1
f3 = (readShort stream #unsigned) + 1
if (f1>maxcnt) then maxcnt= f1
if (f2>maxcnt) then maxcnt= f2
if (f3>maxcnt) then maxcnt= f3
format "f % % %\n" f1 f2 f3 to:file_out
--print ("f " + (f1 as string) + " " + (f2 as string) + " " + (f3 as string)) to:file_out
)
format "max face index: %\n" maxcnt
format "submesh count: %\n" (maxcnt/24)
fClose stream
)
-- entry point --
ClearListener()
fname = getOpenFileName \
caption:" open 3D Model" \
types:"3D Model (*.pb)|*.pb"
--historyCategory:"3D Model pb
format "fname: %\n" fname
-- logging preparation
fname_out = GetSaveFileName()
if fname_out != undefined then (
file_out = createfile fname_out
ReadModelFile fname file_out
--format "\n" to:file_out
close file_out
)
Code: Select all
function ReadModelFile fName file_out=
(
format "-- START READING MODEL FILE --\n"
stream = fOpen fname "rb" -- Open the file for reading
fSeek stream 0x7ADBC #seek_set -- start of vertices
for k=1 to 5 do ( -- 5: submesh count
print ("@ 0x"+ bit.intAsHex(ftell stream) as string)
for i=1 to 24 do ( -- a vertex count of 24 doesn't apply to all submeshes!
x = readFloat stream
y = readFloat stream
z = readFloat stream
format "v % % %\n" x y z to:file_out
)
format "#\n" to:file_out
fSeek stream 512 #seek_cur -- meet next submesh
)
for i=1 to 13 do ( -- a vertex count of 24 doesn't apply to all submeshes!
x = readFloat stream
y = readFloat stream
z = readFloat stream
format "v % % %\n" x y z to:file_out
)
fSeek stream 0x7A930 #seek_set -- start of face indices
maxcnt=0
face_cnt= 570/3
for i=1 to face_cnt do (
f1 = (readShort stream #unsigned) + 1
f2 = (readShort stream #unsigned) + 1
f3 = (readShort stream #unsigned) + 1
if (f1>maxcnt) then maxcnt= f1
if (f2>maxcnt) then maxcnt= f2
if (f3>maxcnt) then maxcnt= f3
format "f % % %\n" f1 f2 f3 to:file_out
--print ("f " + (f1 as string) + " " + (f2 as string) + " " + (f3 as string)) to:file_out
)
format "max face index: %\n" maxcnt
format "submesh count: %\n" (maxcnt/24)
fClose stream
)
-- entry point --
ClearListener()
fname = getOpenFileName \
caption:" open 3D Model" \
types:"3D Model (*.pb)|*.pb"
--historyCategory:"3D Model pb
format "fname: %\n" fname
-- logging preparation
fname_out = GetSaveFileName()
if fname_out != undefined then (
file_out = createfile fname_out
ReadModelFile fname file_out
--format "\n" to:file_out
close file_out
)
tple2b.ms, hairmesh
For me this appears to be the fastest way to track down problems that might occur.
Missing mouth/nose to be found here: viewtopic.php?f=16&t=11580&p=95322&hili ... 318#p95322

