I'm trying to update an old script and I'm near to achieve my goal but I'm locking at getting uv coordinates because the old script used the texture assigned using the UV image editor and the new one need to use the texture assigned with material.
Then the thing I don't find is how to get the uv as easy as the vertex coordinates. This is the code I have to get faces:
face_count = len(self.ob.data.polygons) print("face count: "+str(face_count)) for f_index in range(face_count): uv_polygon = self.ob.data.polygons[f_index] vertices =  # export the triangle for i in range(3): vertices.append([self.ob.data.vertices[uv_polygon.vertices[i]], self.ob.data.uv[uv_polygon.vertices[i]]]) try: Face(vertices, uv_polygon.material_index) except: Face(vertices, -1)
The error appears here: self.ob.data.uv[ uv_polygon.vertices[i] ] because uv is not an attribute of mesh.