modeling / uv / polyUVSet examples
modeling / uv / polyUVSet examples

import maya.cmds as cmds

# start with poly object
cmds.polySphere(n='plg', cuv=1, r=10.0)
# Make a copy of "map1" to a new uvset. The
# name of which is automatically generated and returned.
cmds.polyUVSet( copy=True, uvSet='map1' )
# Create a new empty uv set
cmds.polyUVSet( create=True, uvSet='map2' )
# To set the current uv set to be "map2".
cmds.polyUVSet( currentUVSet=True,  uvSet='map2')
# To set the current uv set to the last uv set added to an object.
cmds.polyUVSet( currentLastUVSet=True )
# To query the current uv set.
cmds.polyUVSet( query=True, currentUVSet=True )
# To rename a currently existing uv set from "map2" to "map3".
cmds.polyUVSet(rename=True, newUVSet='map3', uvSet= 'map2')
# Rename the current uv set (if any) to "map4".
cmds.polyUVSet(rename=True, newUVSet='map4' )
# To delete a currently existing uv set "map4".
cmds.polyUVSet( delete=True, uvSet='map4')
# To delete the current uv set (if any)
cmds.polyUVSet( delete=True )
# Copy values of uvset "map1" to "map2"
cmds.polyUVSet( copy=True, nuv='map2', uvSet='map1' )
# Copy values of the current uvset to "map2"
cmds.polyUVSet( copy=True, nuv='map2' )
# Create a new empty uv set with a generate new name
# The newly generated name is returned.
cmds.polyUVSet( create=True )
# To query all of the uv sets
cmds.polyUVSet( query=True, allUVSets=True )
# To query the logical indices of the uv sets in the
# uv set array of the node
node = "plg"
indices = cmds.polyUVSet(node, query=True, allUVSetsIndices=True)
for i in indices[:]:
	name = cmds.getAttr(node+".uvSet["+str(i)+"].uvSetName")
	print("Found uv set called " + name )
# To create a new per-instance uv set named "myMap"
cmds.polyUVSet(create=True,perInstance=True,uvSet='myMap');
satishgoda/Maya