This script exports the following:
The exporter is designed for a specific workflow, but the workflow isn't forced on you. Note the following:
Install this script as an add-on:
In many situations, you don't want to export all of the bones in an armature. If you want to indicate the subset that you want exported, create a pose bone group named "smd" (case-insensitive) and add the necessary bones to that group.
If such a group exists and isn't empty, the bones outside it will be ignored. Otherwise, the exporter will try to write all of the bones.
Individual animation .smd export uses the current playback range as the animation frame range. Important: which playback range is used depends on the state of the Use alternative start/end frame range option in the timeline (the button with a clock—or is it sliced cake?—icon).
Batch export relies on timeline or pose markers. Based on pairs of matching markers, the exporter determines the frame ranges and assigns .smd file names. To tag some frames for export, put a marker with a name that ends in "_start" at the first frame of the animation fragment and another tag with a matching name ending in "_end" at its last frame. For example, a walk cycle would be tagged by markers named "walk_start" and "walk_end". If your scene contains multiple characters, consider prepending prefixes to marker names; for example: "demon_attack_start" and "demon_attack_end". This enables you to use the Marker filter parameter of the exporter (by entering "demon").
Blender provides two kinds of animation markers: timeline markers (which are global to a scene) and pose markers (which are local to an action). You can use either kind of marker to indicate the sequences you want to export. To choose pose markers, select the Multi-action export option during batch export. Otherwise, timeline markers are used.
Single-action export (Multi-action export off) is useful when you only have a few animation sequences lined up one after another in the current action. When you have a lot of sequences, this kind of scene organisation becomes unwieldy, so you should consider splitting your sequence collection into multiple actions, with one or a couple of sequences per action. Oragnising by action is also more convenient when you are working on looping animations such as walk cycles.
When you export from multiple actions, (Multi-action export on), the script writes animations from all marked ranges in all actions available in the scene. If you want to exclude unwanted actions from this process, make sure that they have no "_start" and "_end" pose markers or that your pose markers are named in such a way that you can use the "Marker filter" parameter to match them.
Notes:
- Interestingly, the names of timeline markers are not necessarily unique in Blender. Please avoid duplicate marker names. They will not make the script crash, but only one of the duplicates will be used in matching, and the results may not be what you expect.
- If no matching tagged ranges are found, the script defaults to exporting the current playback range.
The add-on associates texture names in mesh .smd files with the names of materials on meshes. It doesn’t matter to the exporter what the material itself is like; only the name matters. The exact material name from the first non-empty material slot is used as the texture name. If there are no materials on a mesh, the name "untitled" is written.
To set up sharp edges for export, use the Edge Split modifier and adjust its options as needed. If a mesh doesn't have this modifier, all exported edges will be smooth.
Notes:
- To make the Blender viewport show the result you are going to get, use the Set Smooth command on the mesh object.
- Make sure the modifier is enabled (its eye icon is on) during export.