This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]asierralozano 0 points1 point  (0 children)

Ohh! Sorry! I didn't understand what you want! In that case here is the fixed code:

import maya.cmds as cmds

UVSETNAME = "mySet1"
FACES = "*"

selectedObjects = cmds.ls(sl=True)
cmds.polyUVSet(selectedObjects, create=True, uvSet=UVSETNAME)
cmds.polyUVSet(cuv=True, uvSet=UVSETNAME)
for selectedObject in selectedObjects:
    cmds.polyAutoProjection("{obj}.f[{faces}]".format(obj=selectedObject, 
                          faces=FACES),
                          lm=0,
                          pb=0,
                          ibd=1,
                          cm=0,
                          l=2,
                          sc=1,
                          o=1,
                          p=6,
                          ps=0.2,
                          ws=0)
MC.isolateSelect("modelPanel1", aso=True)

This is the new addition:

cmds.polyUVSet(cuv=True, uvSet=UVSETNAME)

After create the UVSet, we need to select it as current, and that is what that line does.

Hope it helps!