Menu

SMD exporter

nemyax

Studiomodel (SMD) Exporter for Blender 2.77+

This script exports the following:

  • Individual mesh source .smd file (mesh and skeleton)
  • Individual animation source .smd file
  • Batch SMD export: mesh .smd and animation .smds at once
  • Optionally during batch export, a .qc file stub.

The exporter is designed for a specific workflow, but the workflow isn't forced on you. Note the following:

  • You can export only a subset of the armature's bones if necessary.
  • You can use constraints, drivers and non-linear animation freely. Only the final state of the animation is written.
  • It's recommended that you keep object transforms applied, both for the mesh and for the armature.

Installation

Install this script as an add-on:

  1. Open Blender's User Preferences window and go to the Add-ons tab.
  2. Click Install from File and specify the downloaded io_scene_studiomodel_export-*.*.*.zip file or the unpacked io_scene_studiomodel_export.py file.
  3. Enable the Import-Export: SMD: Valve studiomodel source format addon.
  4. To make your changes persistent, click Save User Settings.

Before you begin

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.

Usage

Exporting a mesh

  1. Select the mesh that you want to export. Only the active mesh is written. If the mesh is associated with an armature, its bones will be exported. Otherwise, a default single-bone skeleton will be written.
  2. Click File | Export | Studiomodel Mesh Source in the main menu.
  3. If you are exporting for an engine that supports vertex weighting (for example, Source), you may want to select the Include vertex weights option.
  4. Specify the file path and complete the export.

Exporting an individual SMD animation

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).

  1. Select the mesh that you want to export animation for. Only the active mesh's animation is written. If the mesh is associated with an armature, its animated bones will be exported. Otherwise, a default single-bone non-animated skeleton will be written.
  2. Click File | Export | Studiomodel Animation Source in the main menu.
  3. Specify the file path and complete the export.

Batch export of an SMD mesh and its animations

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").

Single-action and multi-action export

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.
  1. Select the mesh that you want to export animation for. Only the active mesh's animation is written. If the mesh is associated with an armature, its animated bones will be exported. Otherwise, a default single-bone non-animated skeleton will be written.
  2. Click File | Export | Studiomodel source files (batch export) in the main menu.
  3. To specify only a subset of the animation fragments present in the scene, type a prefix in the Marker filter text box.
  4. If you are exporting for an engine that supports vertex weighting (for example, Source), you may want to select the Include vertex weights option.
  5. If you want an auto-generated .qc file template with references to all the animations you are exporting, select the Write .qc stub option.
  6. If your animation sequences are spread among separate actions, select the Multi-action export option.
  7. Specify the file path for the mesh .smd; Animation .smd files will be named after the markers that tag their frame ranges. Complete the export.

How textures are handled

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.

Making sharp creases

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.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.