Go to: Synopsis. Return value. Related. Flags. Python examples.
directionalLight([decayRate=int], [discRadius=linear], [exclusive=boolean], [intensity=float], [name=string], [position=[linear, linear, linear]], [rgb=[float, float, float]], [rotation=[angle, angle, angle]], [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.
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 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.
This is the commmand that instantiates an directionalLight
or edits the parameters of an existing one.
TdirectionalLightCmd inherits from TnonExtendedLightCmd
which defines softShadow flags.
See TlightCmd for a global picture of the light commands.
TdirectionalLightCmd behaves like any other command, it
has flags, saves undo information etc. the only slightly
different behaviour is that it calls up to
TnonExtendedLightCmd to complete the functionality of
the command.
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 |
int | rate of light decay, when querying the decayRate flag |
int | Number 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 |
string | Light shape name |
In query mode, return type is based on queried flag.
ambientLight, exclusiveLightCheckBox, lightList, lightlink, pointLight, spotLight, spotLightPreviewPort
decayRate, discRadius, exclusive, intensity, name, position, rgb, rotation, shadowColor, shadowDither, shadowSamples, softShadow, useRayTraceShadows
Long name (short name) |
Argument types |
Properties |
|
decayRate(d)
|
int
|
|
|
Decay rate of the light (0-no decay, 1-slow, 2-realistic, 3-fast)
|
|
discRadius(drs)
|
linear
|
|
|
exclusive(exc)
|
boolean
|
|
|
True if the light is exclusively assigned
|
|
intensity(i)
|
float
|
|
|
name(n)
|
string
|
|
|
position(pos)
|
[linear, linear, linear]
|
|
|
rgb(rgb)
|
[float, float, float]
|
|
|
rotation(rot)
|
[angle, angle, angle]
|
|
|
Rotation of the light for orientation, where applicable
|
|
shadowColor(sc)
|
[float, float, float]
|
|
|
Color of the light's shadow
|
|
shadowDither(sd)
|
float
|
|
|
shadowSamples(sh)
|
int
|
|
|
Numbr of shadow samples to use
|
|
softShadow(ss)
|
boolean
|
|
|
True if soft shadowing is to be enabled
|
|
useRayTraceShadows(rs)
|
boolean
|
|
|
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.
|
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#