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

Synopsis

directionalLight([decayRate=int], [discRadius=linear], [intensity=float], [name=string], [rgb=[float, float, float]], [shadowColor=[float, float, float]], [shadowDither=float], [shadowSamples=int], [softShadow=boolean], [useRayTraceShadows=boolean])

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

directionalLight is undoable, queryable, and editable.

The directionalLight command is used to edit the parameters of existing directionalLights, or to create new ones. The default behaviour is to create a new directionallight.

Return value

stringLight shape name

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

Related

ambientLight, exclusiveLightCheckBox, lightList, lightlink, pointLight, spotLight, spotLightPreviewPort

Flags

decayRate, discRadius, intensity, name, rgb, shadowColor, shadowDither, shadowSamples, softShadow, useRayTraceShadows
Long name (short name) Argument types Properties
decayRate(d) int createqueryedit
decay rate of the light (0-no decay, 1-slow, 2-realistic, 3-fast)
discRadius(drs) linear createqueryedit
radius of the disc around the light
intensity(i) float createqueryedit
intensity of the light (expressed as a percentage)
name(n) string createqueryedit
specify the name of the light
rgb(rgb) [float, float, float] createqueryedit
color of the light (0-1)
shadowColor(sc) [float, float, float] createqueryedit
the shadow color
shadowDither(sd) float createqueryedit
dither the shadow
shadowSamples(sh) int createqueryedit
number of shadow samples.
softShadow(ss) boolean createqueryedit
soft shadow
useRayTraceShadows(rs) boolean createqueryedit
ray trace shadows

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 directional light
light = cmds.directionalLight(rotation=(45, 30, 15))

# Change the light intensity
cmds.directionalLight( light, e=True, intensity=0.5 )

# Query it
cmds.directionalLight( light, q=True, intensity=True )
# Result:0.5#