pymel.core.modeling.polyUVSet

polyUVSet(*args, **kwargs)

Command to do the following to uv sets: - delete an existing uv set. - rename an existing uv set. - create a new empty uv set. - copy the values from one uv set to a another pre-existing uv set. - set the current uv set to a pre-existing uv set. - modify sharing between instances of per-instance uv sets - query the current uv set. - set the current uv set to the last uv set added to an object. - query the names of all uv sets.

Flags:

Long Name / Short Name Argument Types Properties
allUVSets / auv bool ../../../_images/query.gif ../../../_images/edit.gif
  This flag when used in in a query will return a list of all of the uv set names
allUVSetsIndices / uvn bool ../../../_images/query.gif ../../../_images/edit.gif
  This flag when queried will return a list of the logical plug indices of all the uv sets in the sparse uv set array.
allUVSetsWithCount / awc bool ../../../_images/query.gif ../../../_images/edit.gif
  This flag when used in a query will return a list of all of the uv set family names, with a count appended to the perInstance sets indicating the number of instances in the uv set shared by the specified or selected shape.
copy / cp bool ../../../_images/create.gif ../../../_images/query.gif ../../../_images/edit.gif
  This flag when used will result in the copying of the uv set corresponding to name specified with the uvSet flag to the uvset corresponding to the name specified with the newUVSet flag
create / cr bool ../../../_images/create.gif ../../../_images/query.gif ../../../_images/edit.gif
  This flag when used will result in the creation of an empty uv set corresponding to the name specified with the uvSet flag. If a uvSet with that name already exists, then no new uv set will be created.
currentLastUVSet / luv bool ../../../_images/create.gif ../../../_images/query.gif ../../../_images/edit.gif
  This flag when used will set the current uv set that the object needs to work on, to be the last uv set added to the object. If no uv set exists for the object, then no uv set name will be returned.
currentPerInstanceUVSet / cpi bool ../../../_images/query.gif ../../../_images/edit.gif
  This is a query-only flag for use when the current uv set is a per-instance uv set family. This returns the member of the set family that corresponds to the currently select instance.
currentUVSet / cuv bool ../../../_images/create.gif ../../../_images/query.gif ../../../_images/edit.gif
  This flag when used will set the current uv set that the object needs to work on, to be the uv set corresponding to the name specified with the uvSet flag. This does require that a uvSet with the specified name exist. When queried, this returns the current uv set.
delete / d bool ../../../_images/create.gif ../../../_images/query.gif ../../../_images/edit.gif
  This flag when used will result in the deletion of the uv set corresponding to the name specified with the uvSet flag.
newUVSet / nuv unicode ../../../_images/create.gif ../../../_images/query.gif ../../../_images/edit.gif
  Specifies the name that the uv set corresponding to the name specified with the uvSet flag, needs to be renamed to.
perInstance / pi bool ../../../_images/create.gif ../../../_images/query.gif ../../../_images/edit.gif
  This flag can be used in conjunction with the create flag to indicate whether or not the uv set is per-instance. When you create a per-instance uv set, the set will be applied as shared between all selected instances of the shape unless the unshared flag is used. The perInstance flag can be used in query mode with the currentUVSet or allUVSets flag to indicate that the set family names (i.e. not containing instance identifiers) will be returned by the query. In query mode, this flag can accept a value.
projections / pr bool ../../../_images/query.gif ../../../_images/edit.gif
  This flag when used in a query will return a list of polygon uv projection node names. The order of the list is from most-recently-applied to least-recently- applied.
rename / rn bool ../../../_images/create.gif ../../../_images/query.gif ../../../_images/edit.gif
  This flag when used will result in the renaming of the uv set corresponding to the name specified with the uvSet flag to the name specified using the newUVSet flag.
shareInstances / si bool ../../../_images/create.gif ../../../_images/query.gif ../../../_images/edit.gif
  This flag is used to modify the sharing of per-instance uv sets within a given uv set family so that all selected instances share the specified set. In query mode, it returns a list of the instances that share the set specified by the uvSet flag.
unshared / us bool ../../../_images/create.gif ../../../_images/query.gif ../../../_images/edit.gif
  This flag can be used in conjunction with the create and perInstance flags to indicate that the newly created per-instance set should be created with a separate set per instance.
uvSet / uvs unicode ../../../_images/create.gif ../../../_images/query.gif ../../../_images/edit.gif
  Specifies the name of the uv set that this command needs to work on. This flag has to be specified for this command to do anything meaningful other than query the current uv set. Flag can have multiple arguments, passed either as a tuple or a list.

Derived from mel command maya.cmds.polyUVSet

Example:

import pymel.core as pm

# start with poly object
pm.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.
pm.polyUVSet( copy=True, uvSet='map1' )
# Create a new empty uv set
pm.polyUVSet( create=True, uvSet='map2' )
# To set the current uv set to be "map2".
pm.polyUVSet( currentUVSet=True,  uvSet='map2')
# To set the current uv set to the last uv set added to an object.
pm.polyUVSet( currentLastUVSet=True )
# To query the current uv set.
pm.polyUVSet( query=True, currentUVSet=True )
# To rename a currently existing uv set from "map2" to "map3".
pm.polyUVSet(rename=True, newUVSet='map3', uvSet= 'map2')
# Rename the current uv set (if any) to "map4".
pm.polyUVSet(rename=True, newUVSet='map4' )
# To delete a currently existing uv set "map4".
pm.polyUVSet( delete=True, uvSet='map4')
# To delete the current uv set (if any)
pm.polyUVSet( delete=True )
# Copy values of uvset "map1" to "map2"
pm.polyUVSet( copy=True, nuv='map2', uvSet='map1' )
# Copy values of the current uvset to "map2"
pm.polyUVSet( copy=True, nuv='map2' )
# Create a new empty uv set with a generate new name
# The newly generated name is returned.
pm.polyUVSet( create=True )
# To query all of the uv sets
pm.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 = pm.polyUVSet(node, query=True, allUVSetsIndices=True)
for i in indices[:]:
        name = pm.getAttr(node+".uvSet["+str(i)+"].uvSetName")
        print("Found uv set called " + name )
# To create a new per-instance uv set named "myMap"
pm.polyUVSet(create=True,perInstance=True,uvSet='myMap');