Lil' hand on getting/reading UV in bPython?

Yo, im stuck with an export script I made. Basically, it (should) just write to a text file, of which my games can read. Currently I can export vertices and co-ords, now I just need UV mapping, which is where my problem begins :frowning:

So I have this little section of code for the face saving.


	for i in range(len(mesh.faces)):
		file.write("faceLoad("+`i`+","+`len(mesh.faces[i].v)`)
		mesh.faces[i].v.reverse()
		for j in range(len(mesh.faces[i].v)):
			file.write(","+`mesh.faces[i].v[j].index`)
		for j in range(len(mesh.faces[i].v)):
			file.write(","+`mesh.faces[i].uv`)
		file.write(")
")

which will give me this in the file:

faceLoad(0,3,2,0,1,[(1.0, 0.0), (1.0, 1.0), (0.0, 0.0)],[(1.0, 0.0), (1.0, 1.0), (0.0, 0.0)],[(1.0, 0.0), (1.0, 1.0), (0.0, 0.0)])

The paramters there are something like faceLoad(facenumber,verts,vert1number,vert2number,vert3number,UVxlist,UVylist)
but I don’t know how the UV lists are stored…

I bet thats confusing =p

Tobs

the uvs are stored as a list of 2-tuples [two element tuple], where each 2-tuple contains the xy coord [uv coordinate] and there is a 2-tuple corresponding to each vert in the face vertex list

myface.v=[nmvert1,nmvert2,nmvert3]
myvace.uv=[(0.0,0.0), (1.0,1.0), (0.5,0.5)]

Ah ok, that helps, how does data of a Tuple go? its it a percentage of the width/height or i am up the wrong tree?

Tobs