Since there has been no native .md2 support in blender since version 2.4x (2009!) or something and there apparently are no working community made .md2 add-ons for later versions I thought I'd start writing my own one.
What can this importer (!) do so far?
load an MD2 object in blender
either attach the skin linked in the .md2 file or a custom one
load and run animations (in DP2 all animated .md2 files are the flag models in pball/players/male and pball/models/items/flag)
What is missing?
proper error handling (some .md2 files store broken skin pathes (some of the gun models) or ones to files that don't exist)
aligning the animation keyframes to the fps used for the different animations (see
https://forums.digitalpaint.org/index.php?topic=28720.msg259085#new)
.pcx is no longer natively supported by blender so I used a different package that unfortunately loads all skins as grayscale ... instead of fixing this I'd prefer jitspoe to finally replace all remaining pcx skins with jpg/png (or tga)
How to install the importer?
put the (extracted) script (attached) somewhere and follow this guide:
https://github.com/rlguy/Blender-FLIP-Fluids/wiki/Addon-Installation-and-Uninstallationinstall PIL (for loading .pcx files) - use the ensurepip answer here:
https://blender.stackexchange.com/questions/5287/using-3rd-party-python-modulesSo far this importer isn't useful for anything else but inspecting models (.skm aren't supported btw so you cannot load those models). But it can probably be turned into an import/export script easier than by starting from scratch. Oh and you can export the UV layout in blender and replace a model skin with it, gives a wireframe-ish effect (only on offline servers of course)
.
I'd be thankful for feedback regarding the installation, errors during execution, code readability (coding in blender isn't much fun) etc.