Updated MD2 export script

I’ve finally gotten around to working on my MD2 import/export scripts again to hopefully be included with the next release of blender. I’ve pretty much done a rewrite of the exporter. Importer was polished up a little, but not much was changed.

New features
-released under GPL, previously under SBB (Send Bob a Beer)
-better error detection
-user defined frame name/length support
-openGL command list support

Known bugs
-occasionally segfaults blender after export is finished
-blender reports over 200 mb of ram used after export finishes

It is hanging on my website, as well as a link here for a blend with everything in it.

Please let me know about any bugs/good ideas you have for it.

Download Here!

Cheers,

Bob

Great work !!!

Thank you very much for renewing this script

Your web page has never left my bookmark since I first visited it … a few years ago …

Jean-Baptiste

Thanks. I appricate the support. I’m looking for testers to help break it.

Cheers,

Bob

No takers?

Hey Bob,

I’ll give it a go. I don’t have Quake, but I do have a couple other apps that import/export MD2 files. Give me a bit of time to try it.

This is what I get in the console.

Traceback (most recent call last):
File “export-md2-0.16.py”, line 141, in bevent
File “export-md2-0.16.py”, line 1005, in save_md2
File “export-md2-0.16.py”, line 618, in fill_md2
AttributeError: ‘Blender Mesh’ object has no attribute ‘getFromObject’

blender-2.40-alpha1-windows

I tried your demo .blend file in 2.40alpha2 and it worked fine. I tried one of my own blends and it crashed. I’ll have to tinker with it a bit more and see if I can give you some error messages.

Syl, Thanks for helping me test.
I get (but not all the time)

Using Python version 2.4
Header Information
ident: 844121161
version: 8
skin width: 256
skin height: 256
frame size: 1948
number of skins: 1
number of texture coordinates: 392
number of faces: 888
number of frames: 198
number of vertices: 477
number of GL commands: 5016
offset skins: 68
offset texture coordinates: 132
offset faces: 1700
offset frames: 12356
offset GL Commands: 398060
offset end: 418124

Closed the file
Segmentation fault

Then blender crashes. Line 618 (your problem line) I think is also the root of my crash. I might be using the function wrong, but if I comment out that line, I don’t get the segfault when the script ends. Otherwise, the script complets, then blender segfaults.

I’m not sure why your version of blender says it can’t find the attribute ‘getFromObjct’. Both my windows and linux system don’t have a problem with it (thier problem is somewhere else). The latest Blender Python API defines getFromObject as:

getFromObject(name, cage)-Replace the mesh’s existing data with the raw mesh data from a Blender Object.

Which is how I I think I’m using it. Try reinstalling your blender from a complete 2.40-alpha (with dlls, scripts, etc) and not just the binary (single file). Let me know if that helps.

Cheers,

Bob

Bob,

could you put the segfault in the tracker?

Even if you are using something wrong there shouldn’t be a crash,

LetterRip

sure will

Hello. I was wondering, when you eventually get around to building an importer/exporter for Neverwinter Nights, will you have a version that runs on Windows? I’ve been working with Blender for a long while now but I’ve just recently become interested in making my own custom content, particularly custom animation.

This is my first post here. Hope I don’t sound dumb.

I’m having trouble with your exporter. Here’s what I get when trying to export:

Traceback(most recent call last):
File “export-md2-0.16.py”, line 141, in bevent
File “export-md2-0.16.py”, line 1001, in save_md2
File “export-md2-0.16.py”, line 444, in validation
AttributeError: expected nothing or bool keyword ‘name_only’ as argument

Any ideas? Thanks!

reikibia-You don’t sound dumb at all. I had put the Neverwinter nights exporter on a back burner because somebody else had started working on one. If it doesn’t work right, the author of the original script may be a better place to start to get new functionality. If the original author isn’t supporting it anymore, please let me know. I will offer what help I can.

arkdm-I"ll look into it this weekend. I just got in tonight so hopefully I’ll have a good answer for you by tomorrow night.

Cheers,

Bob

I looked into the script. I would double check that you are running the 0.16 version of the script. If you’re still getting errors, would you mind sending me the .blend.

Cheers,

Bob

Sorry to have to ask, but which script are you talking about? The only other model import/export script for NWN i know of (that doesn’t require 3D Studio) is Neverblender–but I can’t get that to work right. Is there another script I haven’t found yet?

Well, I should correct and clarify myself. I have found something that converts Neverwinter’s .mdl to .mdl.ascii. NwnMdlComp. But once I change it to ascii, I don’t know how to bring it into Blender to work with or what can be done with ascii files like that.

I double checked, I am running .16. The blend I’m using is the sample one you provided at the top of the thread. Maybe it’s my blender version. Does the script require Blender 2.4?

Thank you for all your help!

Arkdm-The latest version of the script requires 2.4 because of the Python API changes in it. If you upgrade to the latest version of blender, you should be ok.

reikiba-The neverblend script is what I was talking about. Have you checked out : http://www.beastwithin.org/users/wwwwolf/games/nwn/gametools/neverblender/
It’s the maintainers website and should show you help you get started. The original author states that he needs some help with the script so I’m checking it out now. I’ll give it a look and see if I cna help with it. More to come…

Cheers,

Bob

I’m talking to the maintiner of neverblender now. Thanx for your help.

reikiba-Just in case you were wondering, Jean-Baptiste is going to release a neverwinter night script. I’m not sure if he is the original author, but he stated that his is very mature and handles meshes/UV/textures/animation.

It’s located at: http://perso.wanadoo.fr/jb.perin/

Cheers,

Bob