SMD importer

Hi there

I’m making a LBA1 remake, developping it on this forum
http://forum.magicball.net/showthread.php?t=14309

Some modelers are using MAX, and only way to import mesh + animation in Blender is MAX->SMD->Milkshape->Blender. I then have my own text format exporter for game engine. We would like to use SMD directly. Also with SMD we’d be able to separate 50 animations in different actions instead of one

I use this script as a base for my importer
http://folk.uio.no/jonmd/blender/smdimport/
It doesn’t handle animations, but I want to do that part.

Question is : I know the 4x4 matrix global transformation of an editbone. I compute head and tale of editbone by simple matrix*vector multiplication. How do I compute the roll value ? What is exactly the editbone.matrix ? Looks to be 3x3. Right now my animations are almost correct, I only have a twist bone problem.

Thanks !

I solved the twisted bone problem alone …

The y axis of editbone is automatically assigned while setting head and tail, but its not the case for x and z. An extra line solve this problem
Note the order of vectors : 2,0,1 (z,x,y) This is because assign y as the direction of bone while in SMD its x

     current.bone.head = (Vector([0,0,0,1])*matrix1).resize3D()
     current.bone.tail = (Vector([0.01,0,0,1])*matrix1).resize3D()
     current.bone.matrix=Mathutils.Matrix([matrix1[2][0],matrix1[2][1],matrix1[2][2]],[matrix1[0][0],matrix1[0][1],matrix1[0][2]],[matrix1[1][0],matrix1[1][1],matrix1[1][2]])

The SMD animation importer will be ready soon