How to return to UV after selecting the face.

How to return to UV after selecting the face.

243202504
Enthusiast Enthusiast
1,290 Views
7 Replies
Message 1 of 8

How to return to UV after selecting the face.

243202504
Enthusiast
Enthusiast

I know how to return vertices after selecting faces.

cmds.polyInfo(fv=1)

Usually, a face consists of 3 or 4 vertices.

However, when I select a face, in the UV interface, the index corresponding to the UV is completely inconsistent with the index of the vertex. For example, I selected a face.

select -r low3.f[469] ;

This face consists of 4 vertices.[u'FACE 469: 441 448 446 444 \n']

but i want get the uvCorrdinate. The 4 UVs on this surface are 

select -r low3.map[863] ;
select -r low3.map[865] ;
select -r low3.map[864] ;
select -r low3.map[866] ;

I want to know how to get the index of these UVs through python,thx~

0 Likes
Accepted solutions (1)
1,291 Views
7 Replies
Replies (7)
Message 2 of 8

243202504
Enthusiast
Enthusiast

i found a way, use cmds.selectType,when i select a face ,use this commend,i can turn face to uv~

0 Likes
Message 3 of 8

243202504
Enthusiast
Enthusiast
this is wrong!
0 Likes
Message 4 of 8

Rourker27
Contributor
Contributor
Accepted solution

I found this thread:
https://forums.cgsociety.org/t/convert-selection-to-uv-w-python/1366967/5

and from that I believe this code will do what you need:

import maya.cmds as cmds

cmds.select(cmds.polyListComponentConversion(tuv = True))
selectedUVs = cmds.polyEditUV(query = True)
print(selectedUVs)
Message 5 of 8

243202504
Enthusiast
Enthusiast

yes, i use this commend and got them. i mean the uvs.

but cmds.polyEditUV(query=True) got a list was not what i need.

i use cmds.ls(sl=1)

but here has a new problem , the list i got  length is not 4 is 3.

like that pic

u'pCube1.map[10,11]'

if i want got all 4 number ,I know that using the powerful data processing function of python can finally get the names of these 4 UVs, but are there any commands that can be used in Maya to get them quickly? 

pCube1.map[3] ,pCube1.map[11] ,pCube1.map[1] ,pCube1.map[10] 

not  [u'pCube1.map[1]', u'pCube1.map[3]', u'pCube1.map[10:11]']

0 Likes
Message 6 of 8

243202504
Enthusiast
Enthusiast

yes, i use this commend and got them. i mean the uvs.

but cmds.polyEditUV(query=True) got a list was not what i need.

i use cmds.ls(sl=1)

but here has a new problem , the list i got  length is not 4 is 3.

like that pic

u'pCube1.map[10,11]'

if i want got all 4 number ,I know that using the powerful data processing function of python can finally get the names of these 4 UVs, but are there any commands that can be used in Maya to get them quickly? 

pCube1.map[3] ,pCube1.map[11] ,pCube1.map[1] ,pCube1.map[10] 

not  [u'pCube1.map[1]', u'pCube1.map[3]', u'pCube1.map[10:11]']

0 Likes
Message 7 of 8

243202504
Enthusiast
Enthusiast
i know what that[0.625, 0.0, 0.625, 0.25, 0.875, 0.0, 0.875, 0.25]
thats what i need ,the uv Coordinate
0 Likes
Message 8 of 8

243202504
Enthusiast
Enthusiast

forgot the pic123.png

0 Likes