Here I will going to demonstrate how to rig a mesh to a skeleton using fragMOTION, a shareware (really annoyware) rigging and animation tool. No, I'm not being paid

For this, you will need a fully textured mesh, ready for rigging. Like this:

You may note that I have all the modding tools on Quick Links: Blender, Wings, GIMP, Python, Map Editor, BRFEdit, along with links to my dev directory and the M&B directory, NetBeans (a full-featured Java IDE), Visual Basic Studio Express, Visual C# Studio Express, shortcuts to M&B v808 and v894, WinAMP (because making mods requires music), and Firefox. If you are serious about making mods, I recommend a similar setup, because double-clicking sucks.
Export the man_body.smd from Native with BRFEdit. You'll need the skeleton later.
fragMOTION, for some reason, won't import OBJ files. SO, export your mesh as a 3ds file. Make sure to set the export scale to 10.0 and check Swap Y and Z axes:

Close your modeling program. Open fragMOTION. You should see this:

As you can see, I have not registered yet. Take a few minutes to get familiar with the interface. Read the documentation. Throughly. To get started, import man_body.smd:


You should see this:

On right side is the Tool panel. Click 'Select Vertex' and hit Ctrl-A to select all the verts. Go to Edit -> Delete Mesh Selection-> All to delete the body mesh, which we don't need anyway. All we want is the skeleton:

Next, import the mesh you want to rig by going to File -> Merge, and selecting the 3ds file we created earlier:

This dialog will pop up:

The default settings are fine, so click OK.
Here is your mesh. Now the fun begins.

Hit Ctrl-B to bring up the Assign Vertices to Bones floating dialog. In the upper right corner is the Skeleton panel, showing the hierarchy with all the bones. Click each one and see it highlighted in the main panel. The bone names will also show up in the Assign Vertices to Bones dialog. Click a bone in the Skeleton panel to which you want to assign some vertices. With 'Select Vertices' selected in the Tools panel, select the vertices you want to assign to the bone, then enter a weight you wish to assign to the bone and click Set. I find a weight of 0.5 is a good starting point. A series of lines will connect the verts to the bone, indicating those verts have been assigned to that bone. Repeat until all the verts are assigned to a bone.

A fully rigged model:

Save you work, preferably many times along the way.
Next, go to Bones -> Validate Weights and Assignments and click OK. The console at the bottom will tell you how many weights and assignments were adjusted. This will prevent you from assigning a weight of more than 1.0 to a vertex.
Once the verts are assigned to your liking, export your rigged mesh to the SMD format. Go to File -> Export, and select SMD from the drop down menu. Make sure you export ONLY the mesh.

Save and Close. Open BRFEdit. Import your mesh, making sure to select Previous SMD and DESELECT Swap Y and Z axes (we did this before when we exported the mesh to 3ds).

This is your first sanity check. If the mesh is crazy here, it will likely be crazy in the game. Save that BRF file and add it to your module.ini file. Assign the mesh to an item in the module_items.py file (using the Module System), and compile your mod. To test it, make sure the player character has easy access to the newly meshed item (adding it to your inventory at the start is good). Start M&B, and run your mod. The item dutifully appears in your inventory:

Put it on, and voila! A fully rigged article of clothing, what all the stylish samurai are wearing this season:

A pose for effect:

Any questions? Remember, RTFM before getting started!
