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

Synopsis

spotLight([barnDoors=boolean], [bottomBarnDoorAngle=angle], [coneAngle=angle], [decayRate=int], [discRadius=linear], [dropOff=float], [exclusive=boolean], [intensity=float], [leftBarnDoorAngle=angle], [name=string], [penumbra=angle], [position=[linear, linear, linear]], [rgb=[float, float, float]], [rightBarnDoorAngle=angle], [rotation=[angle, angle, angle]], [shadowColor=[float, float, float]], [shadowDither=float], [shadowSamples=int], [softShadow=boolean], [topBarnDoorAngle=angle], [useRayTraceShadows=boolean])

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

spotLight is undoable, queryable, and editable.

TlightCmd is the base class for other light commands. TnonAmbientLightCmd is a class that looks like a command but is not. It is a base class for the extended/nonExtended lights. TnonExtendedLightCmd is a base class and not a real command. It is inherited by several lights: TpointLight, TdirectionalLight, TspotLight etc. The spotLight command is used to edit the parameters of existing spotLights, or to create new ones. The default behaviour is to create a new spotlight.

Return value

stringLight shape name boolean Barn door enabled state angle Left barn door angle angle Right barn door angle angle Top barn door angle angle Bottom barn door angle angle Cone angle angle Penumbra angle float Dropoff value
double[]when querying the rgb or shadowColor flags double when querying the intensity flag boolean when querying the useRayTraceShadows or exclusive flags linear[] when querying the position flag angle[] when querying the rotation flag string when querying the name flag
intrate of light decay, when querying the decayRate flag
intNumber of shadow samples, when querying the shadowSamples flag boolean True if soft shadows are enabled, when querying the softShadow flag float Shadow dithering value, when querying the shadowDither flag float Disc radius value, when querying the discRadius flag

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

Related

ambientLight, directionalLight, exclusiveLightCheckBox, lightList, lightlink, pointLight, spotLightPreviewPort

Flags

barnDoors, bottomBarnDoorAngle, coneAngle, decayRate, discRadius, dropOff, exclusive, intensity, leftBarnDoorAngle, name, penumbra, position, rgb, rightBarnDoorAngle, rotation, shadowColor, shadowDither, shadowSamples, softShadow, topBarnDoorAngle, useRayTraceShadows
Long name (short name) Argument types Properties
barnDoors(bd) boolean createqueryedit
Are the barn doors enabled?
bottomBarnDoorAngle(bbd) angle createqueryedit
Angle of the bottom of the barn door.
coneAngle(ca) angle createqueryedit
angle of the spotLight
decayRate(d) int create
Decay rate of the light (0-no decay, 1-slow, 2-realistic, 3-fast)
discRadius(drs) linear createquery
Radius of shadow disc.
dropOff(do) float createqueryedit
dropOff of the spotLight
exclusive(exc) boolean createquery
True if the light is exclusively assigned
intensity(i) float createquery
Intensity of the light
leftBarnDoorAngle(lbd) angle createqueryedit
Angle of the left of the barn door.
name(n) string createquery
Name of the light
penumbra(p) angle createqueryedit
specify penumbra region
position(pos) [linear, linear, linear] createquery
Position of the light
rgb(rgb) [float, float, float] createquery
RGB colour of the light
rightBarnDoorAngle(rbd) angle createqueryedit
Angle of the right of the barn door.
rotation(rot) [angle, angle, angle] createquery
Rotation of the light for orientation, where applicable
shadowColor(sc) [float, float, float] createquery
Color of the light's shadow
shadowDither(sd) float createquery
Shadow dithering value.
shadowSamples(sh) int createquery
Numbr of shadow samples to use
softShadow(ss) boolean createquery
True if soft shadowing is to be enabled
topBarnDoorAngle(tbd) angle createqueryedit
Angle of the top of the barn door.
useRayTraceShadows(rs) boolean createquery
True if ray trace shadows are to be used

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

# Create a spot light
light = cmds.spotLight(coneAngle=45)

# Change the cone angle value
cmds.spotLight( light, e=True, coneAngle=33 )

# Query it
cmds.spotLight( light, q=True, coneAngle=True )
# Result:33#