Patch for Blender .obj export


Note: this problem with wavefront export has been fixed as of Blender 2.49.

There is a bug in the script supplied with Blender which allows Wavefront .obj export. There's been a deafening silence after submitting this to the Blender bugtracker almost a year ago, so I'm now taking matters into my own hands by re-posting it here. The patch below applies on the script file blender.app/Contents/MacOS/.blender/scripts/export_obj.py

The Wavefront export has an option to export texture coordinates, which works as expected when all exported meshes have texture coordinates assigned. When some don't, the texture coordinates in the exported file will be incorrectly assigned.

The reason for this is that in .obj files, texture coordinates are assigned by the order in which the tex and mesh coordinates are written in the file. The bug, which this patch corrects, is that no tuples are written if a mesh has no tex coordinates assigned in blender. If the tex coord export option is selected and one or more of these meshes occur before any textured meshes, the coords will be incorrectly assigned to the first polygons.

The patch solves this by writing null (0,0) tex coords for meshes that lack these, and doing this only when the texture coordinate option is selected. AFAIK this would be the correct behavior, and I've found no side-effects from the patch. Re-import tested with Java3D's Objectfile loader.

AttachmentSize
export_obj.patch945 bytes

Hi

Would it be possible for you to post the entire patched file for download? Thanks

How silly of me, this problem (and probably a few others too) with wavefront export has been fixed as of Blender 2.49. I *think* I confirmed this when working on the same project where I found the bug in the first place. I've added a note to this post, trying not to waste anybody's time ;-)