Here are some screens:
www.postimage.org/image/258d8jh8k/
www.postimage.org/image/25889xfr8/
www.postimage.org/image/2584yuqro/
I'm sure most of you will agree that these rotations don't make any sense. Its not very likely that the 3d artists made the bones like that. The only explanation is that some 3d modellers store matrices in a different way or something.
I tried to do the same with Blender.
Seems correct:
www.postimage.org/image/252j7aeis/
www.postimage.org/image/2536ct9fo/
(note that the bones aren't connected in any of the images, because the 3d formats dont store real bones per se, only transform matrices and the scale value in the matrix is not used for the lenght of the bone (it's always 1.0)
I then tried to import other formats in Blender/3d engine and I got the same results.
However, if I play the animations created for those 3d models, everything looks exactly as it should. So this means I'm not doing anything wrong during import, because the animations would screw up if the bones had wrong angles.
What does this mean? Why should I care?
This means that I can't make a proper importer for Blender, as those angles of bones would be unusable for modding. It also means if I hand edited the bone angles or just connected the bones, then the newly exported models wouldn't be campatible with the existing animation files.
So I'm pretty stuck. I could post the importer and some sample files, but like I said it's also the case for other formats.
Why is it like this? Is this some kind of conundrum or historycal meaning? Can something be done?
this is the blender function for loading and creating the bones:
def read_joint(index, file_object):
# 64 byte matrix (16* 4byte float), 4x4, inverse
data_chunk = file_object.read(64)
rawlist = struct.unpack_from('<16f', data_chunk) # '<16f' = "little endian, 16* float (4 byte)"
r0 = [[rawlist for i in range(el,el+4)] for el in range(0, 15, 4)]
# create a Blender matrix
bmat = Blender.Mathutils.Matrix(r0[0],r0[1],r0[2],r0[3])
bmat.invert() # inverts this matrix
# You need to set this explicitly.
skeleton.makeEditable()
newBone = Blender.Armature.Editbone()
newBone.matrix = bmat
armature.update()
heres an example skeleton with the weird bone angles, in blend format:
www.megaupload.com/?d=H72YS2Q8