Go to: Synopsis. Return value. Flags. Python examples.

Synopsis

uvLink( [objects] , [b=boolean], [isValid=boolean], [make=boolean], [queryObject=name], [texture=name], [uvSet=name])

Note: Strings representing object names and arguments must be separated by commas. This is not depicted in the synopsis.

uvLink is undoable, queryable, and NOT editable.

This command is used to make, break and query UV linking relationships between UV sets on objects and textures that use those UV sets.

If no make, break or query flag is specified and both uvSet and texture flags are present, the make flag is assumed to be specified.

If no make, break or query flag is specified and only one of the uvSet and texture flags is present, the query flag is assumed to be specified.

The term "texture" in the context of UV linking is a bit of an oversimplification. In fact, UV sets can be linked to any node which takes UV coordinates as input. However in most cases it will be a texture to which you wish to link a UV set.

Return value

stringor array of strings for query boolean for isValid

In query mode, return type is based on queried flag.

Flags

b, isValid, make, queryObject, texture, uvSet
Long name (short name) Argument types Properties
make(m) boolean create
The presence of this flag on the command indicates that the command is being invoked to make links between UV sets and textures.
b(b) boolean create
The presence of this flag on the command indicates that the command is being invoked to break links between UV sets and textures.
uvSet(uvs) name create
The argument to the uvSet flag specifies the UV set to be used by the command in performing the action.
texture(t) name create
The argument to the texture flag specifies the texture to be used by the command in performing the action.
queryObject(qo) name create
This flag should only be used in conjunction with a query of a texture. This flag is used to indicate that the results of the query should be limited to UV sets of the object specified by this flag.
isValid(iv) boolean create
This flag is used to verify whether or not a texture or UV set is valid for the purposes of UV linking. It should be used in conjunction with either the -texture flag or the -uvSet flag, but not both at the same time.

Flag can appear in Create mode of command Flag can appear in Edit mode of command
Flag can appear in Query mode of command Flag can have multiple arguments, passed either as a tuple or a list.

Python examples

import maya.cmds as cmds

cmds.uvLink( uvSet='pSphereShape1.uvSet[2].uvSetName', texture='checker1' )
# causes a UV link to be created between uvSet[2] on pSphereShape1
# and the checker1 texture.
# Note that no make, break or query flag is specified so make is
# assumed since both uvSet and texture are specified.

cmds.uvLink( make=True, uvSet='pCubeShape2.uvSet[0].uvSetName', texture='file8' )
# causes a UV link to be created between uvSet[0] of pCubeShape2 and
# the file8 file texture.

cmds.uvLink( uvSet='pCubeShape2.uvSet[0].uvSetName', texture='file8' )
# causes a UV link to be created between uvSet[0] of pCubeShape2 and
# the file8 file texture. Note: no make, break or query flag is
# specified so the make flag is assumed since both uvSet
# and texture are specified.

cmds.uvLink( query=True, uvSet='pCubeShape2.uvSet[0].uvSetName' )
# will return a string array of textures which use the UV set
# pCubeShape2.uvSet[0].setName. For example, the return value might
# be:
# file8 file9 checker4 slimeMap

cmds.uvLink( query=True, texture='checker4' )
# will return a string array of the UV sets that are used by the
# texture. For example, the return value might be
# pCubeShape2.uvSet[0].setName pCylinderShape1.uvSet[4].setName
# pCylinderShape2.uvSet[3].setName

cmds.uvLink( texture='checker4' )
# will return a string array of the UV sets that are used by the
# texture. For example, the return value might be
# pCubeShape2.uvSet[0].setName pCylinderShape1.uvSet[4].setName
# pCylinderShape2.uvSet[3].setName
# Note that no make, break or query flag is specified, so query is
# assumed since no uvSet was specified.

cmds.uvLink( b=True, uvSet='pCylinderShape2.uvSet[3].uvSetName', texture='checker4' )
# causes the checker4 texture to no longer use the UV set
# pCylinderShape2.uvSet[3].setName.
# The texture will use the default UV set on pCylinderShape2 instead.
# If checker4 wasn't using pCylinderShape2.uvSet[3].setName,
# nothing changes and a warning is produced.

cmds.uvLink( isValid=True, texture='myTexture' )
# Returns true if myTexture is a texture to which a UV set can be
# linked, or false otherwise.

myPlug = getSomePlugFromSomewhere()
cmds.uvLink( isValid=True, uvSet=myPlug )
# Returns true if $myPlug is a UV set, or false otherwise.