View Full Version : Convert Selection to UV w/Python?
EightBit 10-07-2009, 05:13 PM Trying to figure it out, but not succeeding:
tmpVerts = cmds.ls (sl = 1)
for vert in tmpVerts
#cmds.polyListComponentConversion ('vert', fv=True, tuv=True ) # Fails
#cmds.polyListComponentConversion (vert, tuv=True ) # Fails
cmds.polyListComponentConversion ('vert', tuv=True ) # No error, but no conversion.
Anyone?
Thanks.
|
|
goleafsgo
10-07-2009, 05:52 PM
Should work (haven't run it though...):
tmpVerts = cmds.ls (sl = 1)
uvs = cmds.polyListComponentConversion (tmpVerts, tuv=True )
print uvs
EightBit
10-08-2009, 02:49 AM
Thanks.
Your script executes and prints a list of UVs, but in the UV Editor, the selected verts don't get converted to a UV Selection. What I'm looking for is the same functionality as the UV Editor's Select/Convert Selection to UVs.
EDIT:
I got it:
In addition to your code:
cmds.select (uvs)
Thanks again.
if you are just trying to change the selection and don't care about storing the list:
import maya.mel as mm
mm.eval("ConvertSelectionToUVs")
or with pymel (which makes things more Pythonic):
from pymel import *
mel.ConvertSelectionToUVs()
goodvibrato
06-17-2010, 11:33 AM
or you could just do
cmds.select(cmds.polyListComponentConversion(tuv = True))
then if you wanted to store the selection
selectedUVs = cmds.polyEditUV(query = True)
CGTalk Moderation
06-17-2010, 11:33 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©2000-2013, Jelsoft Enterprises Ltd.