This command is used to make, break and query light linking relationships between lights/sets of lights and objects/sets of objects. If no make, break or query flag is specified and both lights and objects 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 lights and objects flags is present, the query flag is assumed to be specified. You can specify as many lights and objects as you like, using the multiuse -light and -object flags. A better way to perform light linking is to make sets of lights and sets of geometry. If you create a set which contains lights (such as the ceiling lights in your scene) and a set which contains geometry (such as the geometry of your character), you can then link the setcontaining lights with the setcontaining geometry in order to get those lights to illuminate those pieces of geometry. In addition, you can add and remove lights and geometry from their respective sets without having to make and break light links.
Long name (short name) | Argument Types | Properties | |
---|---|---|---|
b (b) | bool | ||
|
|||
hierarchy (h) | bool | ||
When querying, specifies whether the result should include the hierarchy of transforms above shapes linked to the queried light/object. The transforms considered part of the hierarchy do not include the transform immediately above the shape. Default is true. |
|||
light (l) | PyNode | ||
The argument to the light flag specifies a node to be used by the command in performing the action as if the node is a light. This is a multiuse flag – many light nodes can be specified in a single invocation of the lightlink command. |
|||
make (m) | bool | ||
|
|||
object (o) | PyNode | ||
The argument to the object flag specifies a node to be used by the command in performing the action as if the node is an object. This is a multiuse flag – many object nodes can be specified in a single invocation of the lightlink command. |
|||
sets (set) | bool | ||
When querying, specifies whether the result should include sets linked to the queried light/object. Default is true.Flag can appear in Create mode of commandFlag can have multiple arguments, passed either as a tuple or a list. |
|||
shadow (shd) | bool | ||
shapes (shp) | bool | ||
|
|||
transforms (t) | bool | ||
|
|||
useActiveLights (ual) | bool | ||
useActiveObjects (uao) | bool | ||
Derived from mel command maya.cmds.lightlink
Example:
import pymel.core as pm
pm.lightlink( light=('spotLight1', 'pointLight2', 'ambientLight4'), object=('apple', 'orange', 'banana') )
# causes a light link to be "created between" each of the lights
# spotLight1, pointLight2, ambientLight4 and each of the objects
# apple, orange, banana. This creates 9 links. Note that no make,
# break or query flag is specified so make is assumed since both
# lights and objects are specified.
pm.lightlink( make=True, light='ceilingLightSet', object='apple' )
# causes a light link to be "created between" the ceiling lights and
# the apple geometry. If apple is already illuminated by
# ceilingLightSet, then nothing changes and a warning is produced.
pm.lightlink( object='stillLifeSet', light='spotLight1' )
# causes a light link to be "created between" spotLight1 and the still
# life. If stillLifeSet is already illuminated by spotLight1, then
# nothing changes and a warning is produced. Note: no make, break or
# query flag is specified so the make flag is assumed since both lights
# and objects are specified.
pm.lightlink( light=('ceilingLightSet', 'floorLightSet'), object='tableAndChairsSet' )
# causes a light link to be "created between" each of the light sets
# ceilingLightSet, floorLightSet and the object set tableAndChairsSet.
pm.lightlink( query=True, light='ceilingLightSet' )
# will return a string array of objects which are illuminated by the
# set ceilingLightSet. For example, the return value might be:
# stillLifeSet table chair floor roomWallsSet binky
pm.lightlink( query=True, object='apple' )
# will return a string array of lights which illuminate the object
# apple. For example, the return value might be ceilingLightSet
# spotLight1 spotLight2 ambientLight1
pm.lightlink( object='apple' )
# will return a string array of lights which illuminate the object
# apple. For example, the return value might be ceilingLightSet
# spotLight1 spotLight2 ambientLight1. Note that no make, break
# or query flag is specified, so query is assumed since no lights
# are specified.
pm.lightlink( b=True, light='ceilingLightSet', object='apple' )
# causes the light set ceilingLightSet to no longer illuminate the
# object apple. If ceilingLightSet was already not illuminating apple,
# nothing changes and a warning is produced.