blender->md5 export script 2006-02-12

edit: read my latest post below

Hi,

I wrote a script that exports to MD5 (Doom3 engine’s format for animated characters, used in Doom 3 and Quake 4).
It´s based on Jiba´s blender2cal3d script.

http://home.tiscali.de/der_ton/blender2md5.rar

Just did a test but it did not work .

Using a clean Global Dictionary.
analyzing IPOs: only IPOs with names starting with Action will be handled
Traceback (most recent call last):
  File "blender2md5.py", line 1186, in ?
  File "blender2md5.py", line 1094, in export
  File "blender2md5.py", line 842, in getIpoValue
  File "blender2md5.py", line 826, in CalcIpoName
ValueError: invalid literal for int():

 curvevalue = int(curvebits[2])

Sorry, I forgot to mention it doesn´t work with Blender2.30. But that also tells me you haven´t read the readme or the header of the script. :wink:

Very nice. The math lib that you wrote is nice as well…
P.s. what is this about quaternion ipo names? Also what about animation names? Im interested in the problems you had is writing this script regarding deficiences in the api.

The math-lib is almost completely taken from Jean-Baptiste Lamy´s “blender2cal3d” script. :slight_smile:

For the thing about quaternion IPO names, look here:
https://blenderartists.org/forum/viewtopic.php?t=16409&postdays=0&postorder=asc&start=15
it describes pretty well what´s the issue. In Blender2.30 it changed and is probably easier to extract the values of ipo curves, but I haven´t looked at it closely yet.

The animation names issue:
You can have an animation with some name, and somehow the animation is linked with IPOs. The IPOs are the relevant thing for the script, but they may have different names (names that have nothing to do with the name of the animation they “belong” to. I don´t know if the mapping of IPOs and their animations is accessible from Python. In Jiba´s code, the IPOs are assumed to have some common part of the name (prefix) which is treated as the animation name.

Id like to take a look at this and see if it can be fixed once the mathutils is done.

A new version is up:

http://home.tiscali.de/der_ton/blender2md5.zip

New features:

  • has a GUI
  • works on Blender2.28 - 2.32, probably 2.25 too
  • exports animated cameras too

I only tested it on Win2k though. Any feedback is welcome. :slight_smile:

A new version: V0.9, exports to MD5 Version 10 (the one that the final Doom3 game uses), and works with Blender2.34 with the quaternion patch applied, for example this one:
http://www.letwory.net/cvsbuilds/bf_blender_windows_20040810.zip

There was a bug in the standard 2.34, for more info read this:
http://www.blender.org/modules.php?op=modload&name=phpBB2&file=viewtopic&t=4282

The script needs Python installed.

You can export camera animations, too.

To see the generated MD5, you can use either a modelviewer (there are a couple on doom3world.org, for example mine: http://www.doom3world.org/phpbb2/viewtopic.php?t=1281 )
Or you can import it into 3dsmax/gmax with my md5->max importer:
http://www.doom3world.org/phpbb2/viewtopic.php?t=3229
Or you can import it into Doom3, for info on how to do that read:
http://www.doom3world.org/phpbb2/viewtopic.php?t=5164
(sorry for all that pimping…)

I need feedback on this, it hasn’t been tested much.
For example, I tried to export a baked animation and I only got the bind-pose. I’d be thankful for any feedback. :slight_smile:

A new version, updated for Blender2.40:
http://home.tiscali.de/der_ton/blender2md5.rar
Thanks for any feedback, here or at
http://www.doom3world.org/phpbb2/viewtopic.php?p=130466#130466

Another update, for Blender2.41:
http://home.tiscali.de/der_ton/blender2md5.rar
-Works with 2.41 only (or newer maybe)
-uses Blender241’s new Pose-module (enables export of ik without baking to IPO animations)

Be careful when using the exporter, there is a bug in the python API that might affect this script. Save your .blend before using the exporter, then export, then reload the .blend file, just to make sure. I haven’t tested this but just saw a bug report about a blender function (Action.setActive()) that this script is using, too:
http://www.blender.org/forum/viewtopic.php?t=8094