Hello guys! I'm writing an export script in python and I need some help. First of all I have never worked before with Blender so maybe I will have lame questions but I try to explain my problem. It will be a task for a university lesson so I got a fixed xml format for the export. It looks something like this:
Code: Select all
<texture u0="1.000000" v0="0.000000" />
<texture u0="1.000000" v0="1.000000" />
<texture u0="0.000000" v0="1.000000" />
<texture u0="0.000000" v0="0.000000" />
<face a="0" b="1" c="2" ta="0" tb="1" tc="2" />
<face a="2" b="3" c="0" ta="2" tb="3" tc="0" />
<face a="4" b="5" c="6" ta="3" tb="0" tc="1" />
<face a="6" b="7" c="4" ta="1" tb="2" tc="3" />
<face a="0" b="3" c="5" ta="3" tb="0" tc="1" />
<face a="5" b="4" c="0" ta="1" tb="2" tc="3" />
<face a="3" b="2" c="6" ta="3" tb="0" tc="1" />
<face a="6" b="5" c="3" ta="1" tb="2" tc="3" />
<face a="2" b="1" c="7" ta="3" tb="0" tc="1" />
<face a="7" b="6" c="2" ta="1" tb="2" tc="3" />
<face a="1" b="0" c="4" ta="3" tb="0" tc="1" />
<face a="4" b="7" c="1" ta="1" tb="2" tc="3" />
Here the texture tag contains the UV coordinates. The a,b,c attributes of the face tag contain the vertices of the face. The ta, tb, tc attributes represent the index of the belonging UV coordinate. So, in our example if we are looking at the first line from the face tags, the ta="0" belongs to a="0" vertex. This means that the corresponding line from the texture tags is the first one (0 th programmatically). So my question is simple, how can I assign these UV coordinates to face vertices? I'm looping through the mesh.tessfaces to get the face information and the mesh.tessface_uv_textures.active.data[face_index] to get the UV coordinates, but I can't see the connection between them programmatically. I would appreciate any help!