Page 2 of 4

Posted: Sat Feb 09, 2008 10:47 am
by Preach
Arrrghghgh in some ways blender is a little annoying. For instance, they have a built-in function for creating gui buttons/gui menus. One of the parameters it takes is the "default" value, which all sounds great and sensible. The problem is that in order to redraw the gui, the function to create the button is run again, which resets it to it's default value! The only workaround I can find is to pass the known value of the button as the default value parameter of the create button, so that every time it's redrawn it's recreated with the default value it's already known to have(I later found this is what the working buttons in the gui were already doing). Of course, none of this is documented in the blender manual, presumably because writing that up would cause the developers to die of embarrassment.

So, new version of the script is up at
http://people.pwf.cam.ac.uk/~ajd70/mdl_export.py
Features this time are added are:
*Scale button now works.
*Added a flags parameter. At the moment this is just a number entry field, if people really need I could change it to a series of toggle buttons for each flag. There's no way to make check boxes in the standard package.
*Added UV fixing options. Translate UV's means that UV's outside the range are moved up/down by skinwidth or skinheight until they are in the range [0,skin(height or width) - 1]. This is useful if you find the uvs are aligned up with the skin, but in the range [-1,0].
Clamp UV's just moves any points which are out of range to the nearest edge of the skin, so if it's at -5 it gets moved to 0, if it's at skinwidth it gets moved to skinwidth - 1.

As a promo, I spent 30 mins converting one of those sweet TF2 low poly models to mdl format. The time consuming things were duplicating the polys that should be double-sided and making a conversion of the skin to the quake palette, once you use the blender "Consolidate onto one image" function the actual conversion is painless.
Image
The Sniper

Posted: Sun Feb 10, 2008 7:43 pm
by motorsep
What flags are "available" for mdl / md3 models? And what do they stand for?
Regarding that SMD exporter. Besides the fact that it's very broken, it also doesn't work properly with advanced rigs. It works fine probably with simple Forward Kinematic rig, but when you have various constraints and IK for your rig (and multiple meshes per rig), it screw things up :(
It would be much appreciated if you could look into it, Preach. Pleeeaaasseee :)

Posted: Sun Feb 10, 2008 7:45 pm
by motorsep
Wow. That dude looks cool. Where can I download TF2 low-poly models (I assume they can be imported into Blender for dissection)?

Posted: Sun Feb 10, 2008 7:59 pm
by Preach
The TF2 models are being dicussed in http://forums.inside3d.com/viewtopic.php?t=901. There's a obj importer for blender that handles them just fine(aside from two sided polygons.

The flags are for setting trails and rotation on models, see the bottom of http://www.cc.gatech.edu/classes/AY2000 ... iting.html for a table of all of them.

Posted: Tue Feb 12, 2008 7:00 pm
by motorsep
Preach, have you looked into blender2md5 and that broken smd exporter?

Posted: Tue Feb 12, 2008 9:07 pm
by leileilol
Blender2MD5 doesn't need fixing.

Posted: Tue Feb 12, 2008 9:33 pm
by FrikaC
Preach, some code I have for a few home projects I've been working on is all broken. Have you looked into to fixing it for me?

Posted: Tue Feb 12, 2008 11:21 pm
by motorsep
blender2md5 doesn't need to be fixed, but it still doesn't export to smd :)

Posted: Wed Feb 13, 2008 4:10 am
by leileilol
That's because it is intended to export to md5 and is not intended to support SMD, so it is a non-bug

Posted: Wed Feb 13, 2008 4:41 am
by leileilol
wah, it has that stupid 'object should not be rotated - fixing for you' behavior from the md2 exporter. This is stupid behavior and should not be done as rotating objects can be necessary.

I also get a TypeError: expected object or string and optional integer arguments coming from line 903. Blender 2.43

The "BEEP!" is annoying, blender 2.45

and my model points up and doesn't really export like it should (with Blender pointing the object in the correct intended direction) this is some of the reasons why the MD2 exporter sucks alot and MD3 exporter doesn't. The triangle conversion is stupid too (md3 exporter does that itself in the buffer)

also even though my skin is actually an 8bit PNG, it appears mostly black on the MDL

and my animations can't seem to export. At all.

Posted: Wed Feb 13, 2008 9:37 am
by Preach
leileilol wrote:wah, it has that stupid 'object should not be rotated - fixing for you' behavior from the md2 exporter. This is stupid behavior and should not be done as rotating objects can be necessary.
I will look into applying all kinds of transformations eventually, but for now it's designed for models that animate the vertices. Since I don't actually have any suitable test files, I'm relying on md2s I've imported, which are set up like this. If you could put your files up for download I'd have test cases to work from.
I also get a TypeError: expected object or string and optional integer arguments coming from line 903. Blender 2.43

The "BEEP!" is annoying, blender 2.45
I did say it worked in 2.4.4, it's very hard to make a script that works in all versions because the developers keep pulling the rug from under your feet.
and my model points up and doesn't really export like it should (with Blender pointing the object in the correct intended direction) this is some of the reasons why the MD2 exporter sucks alot and MD3 exporter doesn't. The triangle conversion is stupid too (md3 exporter does that itself in the buffer)
Once other transformations are supported it'll face the right way. The triangle conversion I had noticed before, that shouldn't be too hard to fix.
also even though my skin is actually an 8bit PNG, it appears mostly black on the MDL

and my animations can't seem to export. At all.
The script doesn't do any conversion to the quake 1 palette, if a pixel is not one of the q1 palette colours then it is mapped to black. Do the conversion first, it's bound to look better than what the script could be made to do, avoiding fullbrights etc. As mentioned above, animation for the current version needs to be done at the vertex level, otherwise I can't vouch for what happens. Send me your models where the animation is failing and I can work on that for a new version.

Posted: Wed Feb 13, 2008 9:44 am
by leileilol
Try this silly gun i just modeled for this
http://leileilol.mancubus.net/vs97/Autorifle.zip

Posted: Sun Mar 23, 2008 2:49 pm
by Urre
This is somewhat offtopic, but the modeler from my team says Blenders md3 exporter is incomplete, that it only exports single frame models. Is this true, or does there exist a md3 exporter for blender with support for animations and tags?

Posted: Sun Mar 23, 2008 2:58 pm
by Preach
Try this:

http://cube.wikispaces.com/Blender+Animated+Md3+Export

Let me know if this also works with bones, I'm looking to see what it does different. One thing it does is applies the global transformation matrix to each vertex, so I'll do that next time. But the only other thing it seems to do differently is use the depreciated "NMesh" rather than the current "Mesh" API. Hopefully that isn't the key to making animation transforms work...

Posted: Mon Mar 24, 2008 3:01 am
by leileilol
Urre wrote:This is somewhat offtopic, but the modeler from my team says Blenders md3 exporter is incomplete, that it only exports single frame models. Is this true, or does there exist a md3 exporter for blender with support for animations and tags?
they're bullshitting you because they think bob's old beroken 2003 2.32 script is the most current one out there.

if that was true, then OpenArena wouldn't exist
Preach wrote:Try this:
old and out of date, this is better