Exporting from Blender to Bones
You will need
- Blender this guide was written with the latest Blender to date: 2.61. It should work on all 2.6x in general.
- blender2ogre Blender export 2.6x plugin (It needs Ogre Command Line tools, but since you only need the .xml files you don't need them)
- Bones beta version
- Place your model AND armature in position 0,0,0. Then, ensure it's applied: Ctrl+A_key and select Location from the menu.
- Set the rotation and scale of your model as you want it, and then apply (Ctrl+A_key, Select Rotation and Scale). # If your model doesn't have it, create a Root Bone: This is a bone that is parent to every other bone in your armature. You don't need to connect it to the rest though, and can leave the offset. It must have it's head in 0,0,0 and tail in x=0,y=0,z=1
- EVERY vertex NEEDS to be part of a vertex group/bone or it won't get exported causing the loss of every face that contains it.
- No mesh can have more than 1 material, it's recommended to split them in this case: Go to edit mode for that object, select all vertices (A_key), split (P_key), and select "By material". All your weights are preserved, so no further work is needed.
- It is recommended to have all your textures in a relative path. If they are not, just move them to the folder in which your .blend file is, or another folder inside that folder, and choose them again as though you were searching for another image file.
- It is also recommended to start your animation in frame 0. You can move all your animation at once with a Border Select on the Dopesheet, or NLA Editor with G_key
- Your model doesn't need to be in Rest Position when exporting.
- Be sure you installed the blender2ogre plugin either by moving it to the scripts folder, or from the User Preferences by installing it (the recommended way)
- Go to File>Export>Ogre3D(.scene and .mesh) (if this option doesn't appear, the plugin is either not installed or enabled, so go to User Preferences)
- To the left, you have System, then Bookmarks, followed by Recent, and finally Export Ogre which contains the options for the exporter: It is recommended to uncheck "Export Scene", "Force Camera" and "Force Lamps" as you won't need the .scene file.
- Select any name to export to, it won't be the name of any file you need as that's the name of the .scene file. Just be sure NOT to name it like any file you need, i.e: my_model.mesh.xml or my_model.skeleton.xml (if you followed step 2, there will actually be NO file output with the name entered)
- As output you'll get 1 .mesh.xml and 1 .skeleton.xml for each object you had selected when the export script executed (So, be sure to have selected the object(s) you wanted to export. You don't need to have their armature selected. The script also has an option to export all objects: Uncheck "Export Selected Only")
- You'll also get a .material and an image file for each texture you use. You'll need the image file for your program, but it's nothing different from the one you already used in Blender for the texture. The material file is not needed.
- Pass the .mesh.xml and .skeleton.xml files to the Bones script
Usage: JMEOgreImporter [options] -in <ogre.mesh.xml> [ogre.mesh.xml...] Example: JMEOgreImporter -out myFile.bones -in MyOgre.mesh.xml
You can test your model with the LoadBonesFormatSample program in Bones's examples. Check for any missing face, and if any, go to Preparing step 4.