3dsmax skeleton and mesh export

Here are 3dsmax4/5 scripts which export meshes and skeletons.

Tutorials

XMLConverter (OgreXMLConverter)

3ds scripts write .xml files. So, in order to have .mesh and .skeleton files, XMLConverter.exe should be used. It's in Tools/XMLConverter/bin/debug directory.

Issues

XMLConverter doesn't find the skeleton file when you try to convert your mesh file even if it has been created. So there is an eror message, but don't care: it works well when an OGRE application uses it.

Scripts Features

How to use the script

Troubleshooting

[Thanks to gfactor for these tips]
  1. If the XML converter complains about missing bones, then the bones probably do not have any vertices assiged to it, and the converter 'optimises' it by simply not exporting them. So make sure all bones have at least one vertex weight.
  2. If the XML converter complains about Bip01 missing, then you will probably need to convert your Physiqued biped to a Skinned biped. Don't ask me why but once we did this our models exported without problems. The really weird thing is that one of our models exported fine about 2 months ago (physiqued) but then failed to work again until we converted it to skinnned... weird. The good news is that there is a max plugin that does this, which can be found at http://sparks.discreet.com/downloads/ 
  3. If you have a mesh with multiple animations, all the animations MUST be based on the same pose because all Ogre does when animating is rotate the bones based on the binding pose (does not store positions). The easiest way we've managed to do this is to simply export say... an idle animation as our first animation (using that pose as the base skeleton file), then for each additional animation we import frame 0 of Idle into max and start animating our actual animation from frame 1 onwards. When you export the animation.... export from frame 1 onwards (do not export frame 0). This ensures that all animations will be rotated from the same reference pose. Then simply edit the XML files and cut / paste all additional animations into the idle.skeleton file 
  4. Animations can do weird things unless you flatten the footsteps (creating a key frame for every frame) 
  5. If the XML converter says that it cannot find the *.skeleton file you are trying to convert (despite well.... the skeleton file being there) then the XML file is corrupt. One of our programmers looked through the XML file and found multiple <animations> tags (note: not <animation>) which of course is bad. 
  6. If you get a weird error that actually breaks in the comments of the Max Script when exporting...
    " Type error: Call needs function or class, got: undefined "
        
    then the object you are exporting (the body...not the bones) has spaces in its name. For example.... enemy_NPC will export... but enemy NPC will cause the above error. As far as I can tell... bone names with spaces are fine... but the actual mesh must NOT have spaces in it.

If you want to know a little more about how scripts have been written...