Hi,shakotay
I have been look up some maxscript with bone import
but I have to say I am really confused because there is no comments.
Here's a X format file(text version)
I guess these data are used to create bone.
But I just don't understand how to do it via maxscript.
Frame root_ground {
FrameTransformMatrix {
-0.000000,1.000000,0.000000,0.000000,-0.000000,-0.000000,1.000000,0.000000,1.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,1.000000;;
}
Frame root_hips {
FrameTransformMatrix {
-0.000000,-0.000000,1.000000,0.000000,-0.000000,1.000000,0.000000,0.000000,-1.000000,0.000000,-0.000000,0.000000,49.748032,-0.000008,0.000006,1.000000;;
}
Frame pelvis {
FrameTransformMatrix {
-0.051403,-0.223888,0.973259,0.000000,-0.011808,0.974615,0.223577,0.000000,-0.998608,0.000000,-0.052742,0.000000,0.000000,0.000000,0.000000,1.000000;;
}
Frame leg_left_thigh {
FrameTransformMatrix {
0.973258,0.223577,-0.052742,0.000000,-0.223888,0.974615,0.000000,0.000000,0.051403,0.011808,0.998608,0.000000,7.420700,0.832138,-4.649714,1.000000;;
}
I have been write a maxscript to import mesh
Could you edit it to support bone and weights?
Since there is no facing-newbie bone import tutorial,and these files are text files,there are much easier than binary files
I think this is good for me and others newbies to start import bone.
Thanks!
http://www.mediafire.com/download/9uuq0 ... format.rar
Code: Select all
fname = getOpenFileName \
caption:"Select a X format file" \
types:"DirectX(.x)|*.x" \
historyCategory:"DirectXObjectPresets"
f = openfile fname
Vert_array = #()
Face_array = #()
Normal_array = #()
UV_array = #()
RDL= readline f
while (RDL != " TextureFilename {") do (RDL = readline f)
texture_name = readvalue f
while (RDL != " Mesh {") do (RDL = readline f)
mesh_count = readvalue f
for i=1 to mesh_count do
(
x = readvalue f
y = readvalue f
z = readvalue f
append Vert_array [x,y,z]
readline f
)
face_count = readvalue f
for i=1 to face_count do
(
readvalue f
p1 = readvalue f
p2 = readvalue f
p3 = readvalue f
append Face_array [p1+1,p2+1,p3+1]
readline f
)
while (RDL != " MeshNormals {") do (RDL = readline f)
normal_count = readvalue f
for i=1 to normal_count do
(
n1 = readvalue f
n2 = readvalue f
n3 = readvalue f
append Normal_array [n1,n2,n3]
readline f
)
while (RDL != " MeshTextureCoords {") do (RDL = readline f)
UV_count = readvalue f
for i=1 to UV_count do
(
x = readvalue f
y = readvalue f
append UV_array [x,1-y,0]
readline f
)
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]
close f
texture_path = sysInfo.currentdir
if texture_path[texture_path.count] != "\\" do texture_path += "\\"
texture_path += texture_name
new_mat = StandardMaterial()
new_mat.diffuseMap = Bitmaptex()
new_mat.diffuseMap.filename = texture_path
new_mat.showInViewport = True
msh.Material = new_mat