From BlenderWiki

Jump to: navigation, search
DirectX Exporter (.x)
Exports the current scene to the DirectX model format (.x)
UI location File > Export > DirectX (.x)
Version 3.0.1 Author(s) Chris Foster
Blender 2.66a License GPL


Executable information
File name __init__.py, export_x.py
Python modules io_scene_x
External Python Modules or dependencies math, os


Links and troubleshooting
Links https://projects.blender.org/tracker/index.php?func=detail&aid=22795


About


I started this project for Blender 2.49 with the intention of replacing the DirectX exporter that was shipped with Blender 2.4x because, as any Blender 2.4x user who's tried to get their models out of Blender 2.4x and into DirectX apps knows, it is very difficult to get working and often doesn't work at all. I hope this is a project the community will find useful.

After completing version 1.0 of my exporter for 2.49, I successfully ported the script into Python 3.1 using Blender 2.5's new API. All of the old functionality has been ported, and there's still more to come!

The script has come a long way, from being a tool I started out of necessity, to finding a place in the final release of Blender. I must say that I'm proud of my work and I hope that with your feedback, I can maintain its quality.

If you would like to find the old version of this script for Blender 2.49, follow the link at the bottom of this page. Maybe it can still be useful to some people.

Information


Use

To use, first enable the Add-On from the Add-Ons tab in the User Preferences window. Select File > Export > DirectX (.x) to start the exporter. From there, check the options you wish to use for export, choose a file path, and then click Export DirectX.

Here is a brief description of the options:

  • Export Selected Objects Only - If unchecked, all supported objects in the scene will be exported.
  • Export Meshes - Export mesh data. If unchecked the object's frame will still be exported.
    • Export Normals - Export mesh normals.
      • Flip Normals - Flip mesh normals before export.
    • Export UV Coordinates - Export the active UV layer.
    • Export Materials - Export material properties per face. Texture references will be exported as well.
    • Export Vertex Colors - Export the active vertex color layer.
    • Export Skin Weights - Export the vertex group data for the bones of an armature that affects this mesh. Multiple armatures per mesh is currently unsupported.
    • Apply Modifiers - Temporarily apply the effects of modifiers to the mesh before export. This excludes Armature modifiers only if Export Skin Weights is checked.
  • Export Armature Bones - Export frames for each bone of an armature. If unchecked, the armature object's frame will still be exported.
    • Export Rest Position - Export the bones of the armature in their rest positions. This is recommended if animation is exported.
  • Export Animation - Export object and bone animation (if bones are exported). Rotation, scale, and position is exported for every frame.
    • Include Frame Rate - Export the AnimTicksPerSecond template. This is required by some engines.
    • Export Actions as AnimationSets - Export the action of each object as a separate, named AnimationSet template.
      • Attach Unused Actions to First Armature - Export each unused action as if used by the first armature object.
  • Verbose - Displays debug text in the external console. Useful when getting export errors to see exactly where the problem occurred. Please email me with any bugs that you encounter.

Other Information

The script has been updated and tested successfully on Blender 2.66a.

Some things to know:

  • To export armature data correctly, you must use an armature modifier. Setting the parent as an armature is not enough (and not even necessary).
  • To export armature animation that requires complex constraints (i.e. MakeHuman rigs), it is often necessary to use the Bake Action operator before export. Select all bones in Pose Mode, press Space, type Bake Action, and press Enter.

I'm committed to this project, so please feel free to email me about problems you encounter using the script, along with any questions, comments, or suggestions you might have. If something goes wrong, I can't fix it 'til you tell me! :)

Links and Support