This was a lot more of a pain than I thought, lol, but I think I got it working,
Here is a beta.
If anyone tries it out:
Before doing the conversion, you have to add all of the textures used by the OBJ file to a Quake WAD, and put it in the same directory as the OBJ. (The reason for this is OBJ2MAP needs to get the Quake texture sizes is order to write the correct texture axis values.)
Secondly, the texture names are read from the "usemtl" lines in the
.OBJ. Whatever's after "usemtl" is used as a texture name - directories and file extensions are stripped off first. I'm pretty sure this isn't quite the correct way to read skins from a .obj, I think you're supposed to use a material file, etc..
Finally the output is Valve 220 format only, so this is only usable with Hammer/Jackhammer/TB2/etc.
Future ideas:
- read .mtl file for looking up texture name?
- automatically read in the images referenced by the OBJ and convert them to a WAD file?
I included a sample model (from xonotic) that I was testing with, along with a texture wad, so you can see how things need to be set up for it to work.
source code is here