To import MD3 file format into Blender.
MD3 is the file format used to hold 3D model data for games based on Quake 3: Arena from Id Software.
Blender is a Free 3D modeller from the Blender Foundation that runs on that runs on just about every platform that Quake 3 does: Windows, Linux/x86, FreeBSD, OSX, BeOS, Solaris, IRIX, and then some. (So it seems Blender is a more fitting companion to Q3 than 3DS is *cough*plugplug*cough*). Blender can trace its lineage back to being a freeware modeller from the Not-A-Number company (corporation?). Blender uses Python as its extensible programming language.
PYTHONPATH
to include the md3.py's directory).
md3import234.py
(middle-mouse button).
The bounds/bounding box is imported with the name "bounds", and created in Blender as a rectangular prism (cube). Mangle this however you want: delete, move to another layer, move to another scene.
MD3 tags are created in Blender as Empty objects. The tag names are reflected in the names of the Emptys. Tag orientation (angles) is not yet preserved/imported.
Animation is not imported yet. For any MD3 with animation, only the first frame is imported. MD3 animation is based on storing all vertices for each frame. Blender's VertexKeys IPO is a perfect match for this style of animation, however, I'm having difficulty with the Blender-Python API wrt IPO.
There is another format just above MD3 (MD4?) which uses bones animation. I have no idea what exactly this means, but while analyzing the C data structs, thoughts of Blender's IKA/Armature keep popping up in my mind.
In either case, exporting animation to MD3 in either style should be rather straightforward once all the bit-structuring has been worked out.
Textures and texture coordinates are not imported. I don't understand this texture concept thing... yet.
No export to MD3 yet (still).
The importing is split into two pieces.
Analysis and parsing of the MD3 file is done in md3.py
, while
actual conversion into Blender objects are done in md3import.py
.
This separation allows md3.py
to be reusable outside of Blender (My first Python module! Wheee! =).
The resulting object after parsing (from md3.qmodel.parse()) is a mess. It's tough to figure out without seeing how the data is traversed in md3.qmodel.dump().
(2004.09.06)
md3import234.py -
MD3 importer updated for Blender 2.34.
This version preserves all the functionality (read: just as broken as before) as under Blender 2.22.
No changes to md3.py (modularity!).
(2004.10.23)
One-line bugfix to md3import234.py; was calling class md3's __init__() with extraneous arguments.