Advertisement

Maxscript for bone animations

Started by May 13, 2002 11:47 PM
1 comment, last by slashandburn 22 years, 9 months ago
I have been trying to get 3d max to export my bones to file, but everytime i try it exports the physical bones(mesh of the bones), not the information. Does anyone have a script to export bones from 3dmax with frames that could be easily read(ascii format) for a game(that only needs bones so i can start with the coding process)?
I don''t now if MaxScript is suited for that job..

But when you have the sdk you could have a look at the ase exporter. Someone else wrote a function in the ase exporter so that is also exports bones.
Advertisement
I went through the sdk and wrote this script. It will output every bone(position) for each frame.
It will work if the bones are numbered in sequential order. bone01,bone02,bone03,etc. And I tried to make it look like the asc file structure.

------------Script-------------
f = createFile "bone.txt"
testnode = getNodeByName "bone01" exact:false
x = 0
g = stringStream "eee"
while x < animationRange.end + 1 do
( print x
format "f %\n" x to:f -- Print Frame
sliderTime = x
y=1
while y != -1 do
(
g = stringStream ""
if y < 10 then
(
format "bone0%" y to: g
c = g as string
print c
print "Bone::"
testnode = getNodeByName c exact:false
)
else
(
format "bone%" y to:g
c = g as string
print c
print "Bone::"
testnode = getNodeByName c exact:false
)
if testnode == undefined then
(
y = -1
)
else
(
format "B % : %\n" y testnode.pos to:f
y+=1
)
)
x += 1
)
close f

-------- End Script ---------


//Sample text made by file
f 0
B 1 : [-3.95531e-006,-0.486931,90.0887]
B 2 : [50,-0.486933,80.0887]
B 3 : [60,-0.486931,40.0887]
B 4 : [60,-0.48693,0.0887179]
B 5 : [-3.95531e-006,-0.486931,90.0887]
B 6 : [-50,-0.486928,80.0887]
B 7 : [-60,-0.486927,40.0887]
B 8 : [-60,-0.486925,0.0887117]
B 9 : [-3.95531e-006,-0.486931,90.0887]
B 10 : [-4.58398e-007,-0.486927,10.0887]
B 11 : [0,-0.486927,0.08872]
B 12 : [0,-0.486927,0.08872]
B 13 : [-60,-0.486925,-9.91129]
B 14 : [-60,-0.486924,-29.9113]
B 15 : [60,-0.486929,-9.91128]
f 1
B 1 : [-3.95531e-006,-0.486931,90.0887]
B 2 : [50,-0.486933,80.0887]
B 3 : [60,-0.486931,40.0887]
B 4 : [60,-0.48693,0.0887179]
B 5 : [-3.95531e-006,-0.486931,90.0887]
B 6 : [-50,-0.486928,80.0887]
B 7 : [-60,-0.486927,40.0887]
B 8 : [-60,-0.486925,0.0887117]
B 9 : [-3.95531e-006,-0.486931,90.0887]
B 10 : [-4.58398e-007,-0.486927,10.0887]
B 11 : [0,-0.486927,0.08872]
B 12 : [0,-0.486927,0.08872]
B 13 : [-60,-0.486925,-9.91129]
B 14 : [-60,-0.486924,-29.9113]
B 15 : [60,-0.486929,-9.91128]
f 2
B 1 : [-3.95531e-006,-0.486931,90.0887]
B 2 : [50,-0.486933,80.0887]
B 3 : [60,-0.486931,40.0887]
B 4 : [60,-0.48693,0.0887179]
B 5 : [-3.95531e-006,-0.486931,90.0887]
B 6 : [-50,-0.486928,80.0887]
B 7 : [-60,-0.486927,40.0887]
B 8 : [-60,-0.486925,0.0887117]
B 9 : [-3.95531e-006,-0.486931,90.0887]
B 10 : [-4.58398e-007,-0.486927,10.0887]
B 11 : [0,-0.486927,0.08872]
B 12 : [0,-0.486927,0.08872]
B 13 : [-60,-0.486925,-9.91129]
B 14 : [-60,-0.486924,-29.9113]
B 15 : [60,-0.486929,-9.91128]
//////////////////////////


[edited by - slashandburn on May 14, 2002 11:11:43 PM]

This topic is closed to new replies.

Advertisement