Assigning per vertex UVs for bmesh

Hi! :slight_smile: I currently have this code to read in my vertex information. But I have no idea how to apply my UVs


            for i in range(0,num_vertices):
                vx = read_float(file)
                vy = read_float(file)
                vz = read_float(file)
                vtx = bm.verts.new((vx,vy,vz))
                nx = read_float(file)
                ny = read_float(file)
                nz = read_float(file)
                vtx.normal[0] = nx
                vtx.normal[1] = ny
                vtx.normal[2] = nz
                uvx = read_float(file)
                uvy = read_float(file)
                uvs.append((uvx,uvy))

I’ve tried this without luck :frowning:


    uv_layer = bm.loops.layers.uv[0]
    bm.faces.ensure_lookup_table()
    for face in bm.faces:
        face.loops[0][uv_layer].uv = uvs[face.loops[0].vert.index]
        face.loops[1][uv_layer].uv = uvs[face.loops[1].vert.index]
        face.loops[2][uv_layer].uv = uvs[face.loops[2].vert.index]

Any ideas on how I can apply my UVs?