3
$\begingroup$

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?

$\endgroup$
8
  • 1
    $\begingroup$ 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 $\endgroup$ – Chebhou Apr 19 '15 at 0:41
  • $\begingroup$ @Chebhou thanks for ideas but I have the same result without UV synch, please check the image $\endgroup$ – yhoyo Apr 19 '15 at 1:07
  • $\begingroup$ did you reselect again after disabling synch ? you have to select in the UV editor this point to be considered as selected $\endgroup$ – Chebhou Apr 19 '15 at 1:07
  • $\begingroup$ @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 $\endgroup$ – yhoyo Apr 19 '15 at 1:08
  • $\begingroup$ please , select all the verts and you'll see that this point is not selected in the UV $\endgroup$ – Chebhou Apr 19 '15 at 1:12
3
$\begingroup$

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)
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.