Module Lamp :: Class Lamp

Class Lamp

source code

The Lamp Data object

This object gives access to Lamp-specific data in Blender.


Warning: Most member variables assume values in some [Min, Max] interval. When trying to set them, the given parameter will be clamped to lie in that range: if val < Min, then val = Min, if val > Max, then val = Max.

Instance Methods
string
getName()
Get the name of this Lamp Data object.
source code
 
setName(name)
Set the name of this Lamp Data object.
source code
int
getType()
Get this Lamp's type.
source code
 
setType(type)
Set this Lamp's type.
source code
int
getMode()
Get this Lamp's mode flags.
source code
 
setMode(m=None, m2=None, m3=None, m4=None, m5=None, m6=None, m7=None, m8=None)
Set this Lamp's mode flags.
source code
int
getSamples()
Get this lamp's samples value.
source code
 
setSamples(samples)
Set the samples value.
source code
int
getRaySamplesX()
Get this lamp's raytracing sample value on the X axis.
source code
int
setRaySamplesX()
Set the lamp's raytracing sample value on the X axis, between 1 and 16.
source code
int
getRaySamplesY()
Get this lamp's raytracing sample value on the Y axis.
source code
int
setRaySamplesY()
Set the lamp's raytracing sample value on the Y axis, between 1 and 16.
source code
int
getAreaSizeX()
Get this lamp's size on the X axis.
source code
int
setAreaSizeX()
Set this lamp's size on the X axis.
source code
int
getAreaSizeY()
Get this lamp's size on the Y axis.
source code
int
setAreaSizeY()
Set this lamp's size on the Y axis.
source code
int
getBufferSize()
Get this lamp's buffer size.
source code
 
setBufferSize(bufsize)
Set the buffer size value.
source code
int
getHaloStep()
Get this lamp's halo step value.
source code
 
setHaloStep(hastep)
Set the halo step value.
source code
float
getEnergy()
Get this lamp's energy intensity value.
source code
 
setEnergy(energy)
Set the energy intensity value.
source code
float
getDist()
Get this lamp's distance value.
source code
 
setDist(distance)
Set the distance value.
source code
float
getSpotSize()
Get this lamp's spot size value.
source code
 
setSpotSize(spotsize)
Set the spot size value.
source code
float
getSpotBlend()
Get this lamp's spot blend value.
source code
 
setSpotBlend(spotblend)
Set the spot blend value.
source code
float
getClipStart()
Get this lamp's clip start value.
source code
 
setClipStart(clipstart)
Set the clip start value.
source code
float
getClipEnd()
Get this lamp's clip end value.
source code
 
setClipEnd(clipend)
Set the clip end value.
source code
float
getBias()
Get this lamp's bias value.
source code
 
setBias(bias)
Set the bias value.
source code
float
getSoftness()
Get this lamp's softness value.
source code
 
setSoftness(softness)
Set the softness value.
source code
float
getHaloInt()
Get this lamp's halo intensity value.
source code
 
setHaloInt(haloint)
Set the halo intensity value.
source code
float
getQuad1()
Get this lamp's quad 1 value.
source code
 
setQuad1(quad1)
Set the quad 1 value.
source code
float
getQuad2()
Get this lamp's quad 2 value.
source code
 
setQuad2(quad2)
Set the quad 2 value.
source code
list
getScriptLinks(event)
Get a list with this Lamp's script links of type 'event'.
source code
 
clearScriptLinks(links=None)
Delete script links from this Lamp.
source code
 
addScriptLink(text, event)
Add a new script link to this Lamp.
source code
Ipo
getIpo()
Get the Ipo associated with this Lamp object, if any.
source code
 
setIpo(ipo)
Link an ipo to this Lamp object.
source code
 
clearIpo()
Unlink the ipo from this Lamp object.
source code
 
insertIpoKey(keytype)
Inserts keytype values in lamp ipo at curframe.
source code
Lamp
__copy__()
Make a copy of this lamp
source code
Instance Variables
float B
Lamp color blue component.
float G
Lamp color green component.
float R
Lamp color red component.
float areaSizeX
Lamp X size (X is used for the Y axis with square area lamps) Value is clamped to the range [0.01,100.0].
float areaSizeY
Lamp Y size (Y is only used for rectangle area lamps).
float bias
Lamp shadow map sampling bias.
int bufferSize
Lamp shadow buffer size.
float clipEnd
Lamp shadow map clip end.
float clipStart
Lamp shadow map clip start.
RGB tuple col
Lamp RGB color triplet.
float dist
Lamp clipping distance.
float energy
Lamp light intensity.
bool fakeUser
When set to True, this datablock wont be removed, even if nothing is using it.
int falloffType
Lamp falloff type.
float haloInt
Lamp spotlight halo intensity.
int haloStep
Lamp volumetric halo sampling frequency.
Blender Ipo ipo
Lamp Ipo.
string or None lib
path to the blend file this datablock is stored in (readonly).
int mode
Lamp mode bitfield.
string name
unique name within each blend file.
IDGroup properties
Returns an IDGroup reference to this datablocks's ID Properties.
float quad1
Quad lamp linear distance attenuation.
float quad2
Quad lamp quadratic distance attenuation.
int raySamplesX
Lamp raytracing X samples (X is used for the Y axis with square area lamps).
int raySamplesY
Lamp raytracing Y samples (Y is only used for rectangle area lamps).
int samples
Lamp shadow map samples.
float softness
Lamp shadow sample area size.
float spotBlend
Lamp spotlight edge softness.
float spotSize
Lamp spotlight beam angle (in degrees).
bool tag
A temporary tag that to flag data as being used within a loop.
int type
Lamp type.
int users
The number of users this datablock has.
Method Details

setName(name)

source code 
Set the name of this Lamp Data object.
Parameters:
  • name (string) - The new name.

setType(type)

source code 
Set this Lamp's type.
Parameters:
  • type (string) - The Lamp type: 'Lamp', 'Sun', 'Spot', 'Hemi', 'Area', or 'Photon'

getMode()

source code 
Get this Lamp's mode flags.
Returns: int

OR'ed value. Use the Modes dictionary to check which flags are 'on'.

Example:
       flags = mylamp.getMode()
       if flags & mylamp.Modes['Shadows']:
               print "This lamp produces shadows"
       else:
               print "The 'Shadows' flag is off"

setMode(m=None, m2=None, m3=None, m4=None, m5=None, m6=None, m7=None, m8=None)

source code 
Set this Lamp's mode flags. Mode strings given are turned 'on'. Those not provided are turned 'off', so lamp.setMode() -- without arguments -- turns off all mode flags for Lamp lamp.
Parameters:
  • m (string) - A mode flag. From 1 to 8 can be set at the same time.

setSamples(samples)

source code 
Set the samples value.
Parameters:
  • samples (int) - The new samples value.

getRaySamplesX()

source code 
Get this lamp's raytracing sample value on the X axis. This value is only used for area lamps.
Returns: int

setRaySamplesX()

source code 
Set the lamp's raytracing sample value on the X axis, between 1 and 16. This value is only used for area lamps.
Returns: int

getRaySamplesY()

source code 
Get this lamp's raytracing sample value on the Y axis. This value is only used for rectangle area lamps.
Returns: int

setRaySamplesY()

source code 
Set the lamp's raytracing sample value on the Y axis, between 1 and 16. This value is only used for rectangle area lamps.
Returns: int

getAreaSizeX()

source code 
Get this lamp's size on the X axis. This value is only used for area lamps.
Returns: int

setAreaSizeX()

source code 
Set this lamp's size on the X axis. This value is only used for area lamps.
Returns: int

getAreaSizeY()

source code 
Get this lamp's size on the Y axis. This value is only used for rectangle area lamps.
Returns: int

setAreaSizeY()

source code 
Set this lamp's size on the Y axis. This value is only used for rectangle area lamps.
Returns: int

setBufferSize(bufsize)

source code 
Set the buffer size value.
Parameters:
  • bufsize (int) - The new buffer size value.

setHaloStep(hastep)

source code 
Set the halo step value.
Parameters:
  • hastep (int) - The new halo step value.

setEnergy(energy)

source code 
Set the energy intensity value.
Parameters:
  • energy (float) - The new energy value.

setDist(distance)

source code 
Set the distance value.
Parameters:
  • distance (float) - The new distance value.

setSpotSize(spotsize)

source code 
Set the spot size value.
Parameters:
  • spotsize (float) - The new spot size value.

setSpotBlend(spotblend)

source code 
Set the spot blend value.
Parameters:
  • spotblend (float) - The new spot blend value.

setClipStart(clipstart)

source code 
Set the clip start value.
Parameters:
  • clipstart (float) - The new clip start value.

setClipEnd(clipend)

source code 
Set the clip end value.
Parameters:
  • clipend (float) - The new clip end value.

setBias(bias)

source code 
Set the bias value.
Parameters:
  • bias (float) - The new bias value.

setSoftness(softness)

source code 
Set the softness value.
Parameters:
  • softness (float) - The new softness value.

setHaloInt(haloint)

source code 
Set the halo intensity value.
Parameters:
  • haloint (float) - The new halo intensity value.

getQuad1()

source code 
Get this lamp's quad 1 value.
Returns: float

Warning: this only applies to Lamps with the 'Quad' flag on.

setQuad1(quad1)

source code 
Set the quad 1 value.

Warning: this only applies to Lamps with the 'Quad' flag on.

getQuad2()

source code 
Get this lamp's quad 2 value.
Returns: float

Warning: this only applies to Lamps with the 'Quad' flag on.

setQuad2(quad2)

source code 
Set the quad 2 value.
Parameters:
  • quad2 (float) - The new quad 2 value.

Warning: this only applies to Lamps with the 'Quad' flag on.

getScriptLinks(event)

source code 
Get a list with this Lamp's script links of type 'event'.
Parameters:
  • event (string) - "FrameChanged", "Redraw" or "Render".
Returns: list
a list with Blender Text names (the script links of the given 'event' type) or None if there are no script links at all.

clearScriptLinks(links=None)

source code 
Delete script links from this Lamp. If no list is specified, all script links are deleted.
Parameters:
  • links (list of strings) - None (default) or a list of Blender Text names.

addScriptLink(text, event)

source code 
Add a new script link to this Lamp.
Parameters:
  • text (string) - the name of an existing Blender Text.
  • event (string) - "FrameChanged", "Redraw" or "Render".

getIpo()

source code 
Get the Ipo associated with this Lamp object, if any.
Returns: Ipo
the wrapped ipo or None.

setIpo(ipo)

source code 
Link an ipo to this Lamp object.
Parameters:
  • ipo (Blender Ipo) - a "lamp data" ipo.

clearIpo()

source code 
Unlink the ipo from this Lamp object.
Returns:
True if there was an ipo linked or False otherwise.

insertIpoKey(keytype)

source code 
Inserts keytype values in lamp ipo at curframe. Uses module constants.
Parameters:
  • keytype (Integer) - -RGB -ENERGY -SPOTSIZE -OFFSET -SIZE
Returns:
None

__copy__()

source code 
Make a copy of this lamp
Returns: Lamp
a copy of this lamp

Instance Variable Details

B

Lamp color blue component. Value is clamped to the range [0.0,1.0].
Type:
float

G

Lamp color green component. Value is clamped to the range [0.0,1.0].
Type:
float

R

Lamp color red component. Value is clamped to the range [0.0,1.0].
Type:
float

areaSizeY

Lamp Y size (Y is only used for rectangle area lamps). Value is clamped to the range [0.01,100.0].
Type:
float

bias

Lamp shadow map sampling bias. Value is clamped to the range [0.01,5.0].
Type:
float

bufferSize

Lamp shadow buffer size. Value is clamped to the range [512,5120].
Type:
int

clipEnd

Lamp shadow map clip end. Value is clamped to the range [1.0,5000.0].
Type:
float

clipStart

Lamp shadow map clip start. Value is clamped to the range [0.1,1000.0].
Type:
float

col

Lamp RGB color triplet. Components are clamped to the range [0.0,1.0].
Type:
RGB tuple

dist

Lamp clipping distance. Value is clamped to the range [0.1,5000.0].
Type:
float

energy

Lamp light intensity. Value is clamped to the range [0.0,10.0].
Type:
float

fakeUser

When set to True, this datablock wont be removed, even if nothing is using it. All data has this disabled by default except for Actions.
Type:
bool

falloffType

Lamp falloff type. See Falloffs for values.
Type:
int

haloInt

Lamp spotlight halo intensity. Value is clamped to the range [0.0,5.0].
Type:
float

haloStep

Lamp volumetric halo sampling frequency. Value is clamped to the range [0,12].
Type:
int

ipo

Lamp Ipo. Contains the Ipo if one is assigned to the object, None otherwise. Setting to None clears the current Ipo..
Type:
Blender Ipo

lib

path to the blend file this datablock is stored in (readonly).

lib will be None unless you are using external blend files with (File, Append/Link)

Note: the path may be relative, to get the full path use Blender.sys.expandpath
Type:
string or None

mode

Lamp mode bitfield. See Modes for values.
Type:
int

name

unique name within each blend file.

The name is case sensitive and 21 characters maximum length.

Note: a blend file may have naming collisions when external library data is used, be sure to check the value of lib.

Note: Setting a value longer then 21 characters will be shortened
Type:
string

quad1

Quad lamp linear distance attenuation. Value is clamped to the range [0.0,1.0].
Type:
float

quad2

Quad lamp quadratic distance attenuation. Value is clamped to the range [0.0,1.0].
Type:
float

raySamplesX

Lamp raytracing X samples (X is used for the Y axis with square area lamps). Value is clamped to the range [1,16].
Type:
int

raySamplesY

Lamp raytracing Y samples (Y is only used for rectangle area lamps). Value is clamped to the range [1,16].
Type:
int

samples

Lamp shadow map samples. Value is clamped to the range [1,16].
Type:
int

softness

Lamp shadow sample area size. Value is clamped to the range [1.0,100.0].
Type:
float

spotBlend

Lamp spotlight edge softness. Value is clamped to the range [0.0,1.0].
Type:
float

spotSize

Lamp spotlight beam angle (in degrees). Value is clamped to the range [1.0,180.0].
Type:
float

tag

A temporary tag that to flag data as being used within a loop. always set all tags to True or False before using since blender uses this flag for its own internal operations.
Type:
bool

type

Lamp type. See Types for values.
Type:
int

users

The number of users this datablock has. (readonly) Zero user datablocks are de-allocated after reloading and saving.
Type:
int