[Bf-python] Problem with obj exporter.

Campbell Barton cbarton at metavr.com
Tue Jul 12 13:18:17 CEST 2005


Dan McDonald wrote:

>Manuel wrote:
>  
>
>>I've tried to import an obj made by Blender into another application
>>(Ayam). It don't work because there is a little 'problem' in obj. This
>>is the reply from Ayam developer:
>>-----------------------------------------------------------
>>Thanks. Blender writes all faces with an extra whitespace at the end
>>of the face statement:
>>"f vi1 vi2 vi3 " instead of "f vi1 vi2 vi3"
>>tricking the Ayam parser into "there is another vertex index left
>>to be read"-mode after reading the last vertex index. This next vertex
>>index is never given, instead EOL appears and Ayam thinks this an
>>error, throwing away the whole face.
>>It is debatable, whether this is actually a malformed OBJ file according
>>to the Spec, as the Spec does not speak too much about whitespaces...
>>There is no easy fix available as the OBJ parser is coded in C,
>>you will currently need to fix the OBJ file by running it through a
>>processor of some sort.
>>------------------------------------------------------------
>>
>>Ciao,
>>
>>     Manuel
>>    
>>
>I've never made a patch for Blender before and I don't have Ayam to test
>it with, but it seemed so trivial that I had to do it. I don't even know
>Python! Still, try this patch.
>
>Dan
>
>  
>

Added some fairly nice improvements- Exports more compact files with 
less material context swictking per mesh. Dosent export the same UV 
coords twice and dosent export 3x normals per face- rather a normal per 
vert as blender stores them. also does a better job of ignoring edges.

There is a bit of a speed hit here, mainly with the UV's- but shouldnt 
be too bad.
Also fixed the space after the line ending with faces.

- Cam
-------------- next part --------------
A non-text attachment was scrubbed...
Name: obj_export.py
Type: text/x-python
Size: 5861 bytes
Desc: not available
URL: <http://lists.blender.org/pipermail/bf-python/attachments/20050712/be9cea11/attachment.py>


More information about the Bf-python mailing list