3

actually I know how to take the 3d and 2d (UV) vertex data.... I'm using this code with a little modifications

Now I'm trying to find the 3d vertex.index equivalent in UV 2d. that in order to know the uv vertex cordinates of especific 3d vertex index.

I have the same len(3d vertices) and the len(uv 2d vertices), and the 3d vertex only have 1 representation in UV 2d view.

but after run the code I have this:

confused data

in the example image I have 3d vertex.index #11 selected and only one UV 2d vertex selected too with his 2d vertex cordinates (366,839)

in order to know that specific cordinates I have:

if ob.data.uv_layers.active.data[v.index].select:
                     print("vertice selected: ", v.index, " cor: ", uv[0]*x, uv[1]*y)

but as you see in console I have crazy results

UPDATE I have the same result without UV synch WITHOUT synch

UPDATE: if I select all the verts and in UV editor select 1 point... the result is crazy too... but I want to know the index relation between 3d vertice index and 2d point index and with this method is imposible: WITHOUT SYNCH AND SELECT ALL do you have some ideas please?

yhoyo
  • 2,285
  • 13
  • 32
  • 1
    disable selection synch and try again ( it seems that UV selection is not updated while it is active ), you are seeing the previous selection before activating the selection synch option – Chebhou Apr 19 '15 at 00:41
  • @Chebhou thanks for ideas but I have the same result without UV synch, please check the image – yhoyo Apr 19 '15 at 01:07
  • did you reselect again after disabling synch ? you have to select in the UV editor this point to be considered as selected – Chebhou Apr 19 '15 at 01:07
  • @Chebhou, yes, of course... wait.... as you see I can't select that in the UV editor because I can't see that... but any way I have the same result – yhoyo Apr 19 '15 at 01:08
  • please , select all the verts and you'll see that this point is not selected in the UV – Chebhou Apr 19 '15 at 01:12
  • do you have to do the selection in the 3d view ? – Chebhou Apr 19 '15 at 01:13
  • @Chebhou yes, I have to do the selection in the 3d view because as you see if I disable the UV synch I can´t select that in the UV editor.... ... also if I have the UV sync active, I can select that in the UV editor but nothing change.

    also is I select all vertices without UV synch I can select 1 UV vertice but the result is crazy too.. please check the new update

    – yhoyo Apr 19 '15 at 02:08

1 Answers1

3

thanks to @Chebhou here the answer:

for v in ob.data.vertices : 
            for p in ob.data.loops :

                if v.index == p.vertex_index  and v.select:

                    x = ob.data.uv_layers.active.data[p.index].uv[0]
                    y = ob.data.uv_layers.active.data[p.index].uv[1]

                    print(v.index, " 3d co: ", v.co, " UV co: ", x,",",y)
yhoyo
  • 2,285
  • 13
  • 32