Last active
October 11, 2016 19:55
-
-
Save Onefabis/8fb9547550d504a5359b5a91ab1896e8 to your computer and use it in GitHub Desktop.
Transfers current UV set to the default one
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Transfer current UV to the default one | |
import maya.cmds as mc | |
import maya.mel as mel | |
x=0 | |
if not mc.selectMode( q=1, object=True ): | |
x=1 | |
mel.eval('toggleSelMode; ') | |
mel.eval('changeSelectMode -object;') | |
selO=[] | |
uvList=[] | |
selO = mc.ls( sl=1 ) | |
uvList = mc.polyUVSet( selO, q=1, auv=1 ) | |
curUV = mc.polyUVSet( selO, q=1, cuv=1 ) | |
if curUV[0] != uvList[0]: | |
mc.polyUVSet( copy=1, nuv=uvList[0], uvSet=curUV[0] ) | |
mc.polyUVSet( d=1, uvSet=curUV[0] ) | |
if x==1: | |
mc.selectMode( component=True ) | |
# Transfer all UVs to the default one | |
import maya.cmds as mc | |
import maya.mel as mel | |
x=0 | |
if not mc.selectMode( q=1, object=True ): | |
x=1 | |
mel.eval('toggleSelMode; ') | |
mel.eval('changeSelectMode -object;') | |
selO=[] | |
uvList=[] | |
selO = mc.ls( sl=1 ) | |
uvList = mc.polyUVSet( selO, q=1, auv=1 ) | |
curUV = mc.polyUVSet( selO, q=1, cuv=1 ) | |
uvList.remove( 'map1' ) | |
if uvList > 0: | |
for u in uvList: | |
mc.polyUVSet( copy=1, nuv='map1', uvSet=u ) | |
mc.polyUVSet( d=1, uvSet=u ) | |
if x==1: | |
mc.selectMode( component=True ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment