I've been trying to set the UV's of a mesh i created via code, and i have an array of vectros with the U and V coordinates, the problem is, the way to set up the UV's via the API seems to be via MeshLoops, which confuses me because, in this case, my mesh has 128 vertices, and on the UV Layer there's 384 Mesh UV Loops, which from what i understand, consist of one edge and 2 vertices in it.
This confuses me because this means there are repeated vertices in it, regardless of wether those verts are broken or not, and i do not know how to assign the texture coordinates to the proper vertices.
here's my code: (obj is the object that contains the mesh in it, and msh is the mesh itself)
msh.from_pydata(data[i].vertices, edges, data[i].faces) uv_layer = msh.uv_layers.new() print(obj.data.uv_layers.active.data) #for j in range(len(obj.data.uv_layers.active.data)): for j in range(len(data[i].uvs)-1): obj.data.uv_layers.active.data[j].uv = (data[i].uvs[j], 1-data[i].uvs[j])
This obviously doesn't work, because i'm not assigning data[i].uvs array to the proper uvs on the uv_layer. How could i approach properly adding the texture coordinates to my mesh with my array? I'm not sure how to apply this with this API, and the meshloop doesn't seem to favor the way i stored my coordinates.
Thanks for reading!