Module Lamp
[hide private]
[frames] | no frames]

Module Lamp

source code

The Blender.Lamp submodule.

New: Lamp.clearScriptLinks accepts a parameter now.

Lamp Data

This module provides control over Lamp Data objects in Blender.

Example:

       from Blender import Lamp, Scene
       l = Lamp.New('Spot')            # create new 'Spot' lamp data
       l.setMode('Square', 'Shadow')   # set these two lamp mode flags
       scn = Scene.GetCurrent()
       ob = scn.objects.new(l)
Classes [hide private]
  Lamp
This object gives access to Lamp-specific data in Blender.
Functions [hide private]
Blender Lamp
New(type='Lamp', name='LampData')
Create a new Lamp Data object.
source code
Blender Lamp or a list of Blender Lamps
Get(name=None)
Get the Lamp Data object(s) from Blender.
source code
Variables [hide private]
read-only dictionary Falloffs
The lamp falloff types.
read-only dictionary Modes
The lamp modes.
read-only dictionary Types
The lamp types.
  __package__ = None
Function Details [hide private]

New(type='Lamp', name='LampData')

source code 

Create a new Lamp Data object.

Parameters:
  • type (string) - The Lamp type: 'Lamp', 'Sun', 'Spot', 'Hemi', 'Area', or 'Photon'.
  • name (string) - The Lamp Data name.
Returns: Blender Lamp
The created Lamp Data object.

Get(name=None)

source code 

Get the Lamp Data object(s) from Blender.

Parameters:
  • name (string) - The name of the Lamp Data.
Returns: Blender Lamp or a list of Blender Lamps
It depends on the name parameter:
  • (name): The Lamp Data object with the given name;
  • (): A list with all Lamp Data objects in the current scene.

Variables Details [hide private]

Falloffs

The lamp falloff types.
  • CONSTANT - Constant falloff
  • INVLINEAR - Inverse linear
  • INVSQUARE - Inverse square
  • CUSTOM - Custom curve
  • LINQUAD - Lin/Quad weighted
Type:
read-only dictionary

Modes

The lamp modes. Modes may be ORed together.
  • 'Shadows'
  • 'Halo'
  • 'Layer'
  • 'Quad'
  • 'Negative'
  • 'OnlyShadow'
  • 'Sphere'
  • 'Square'
  • 'NoDiffuse'
  • 'NoSpecular'
  • 'RayShadow'

    Example:

           from Blender import Lamp, Object
           # Change the mode of selected lamp objects.
           for ob in Object.GetSelected():   # Loop through the current selection
                   if ob.getType() == "Lamp":      # if this is a lamp.
                           lamp = ob.getData()           # get the lamp data.
                           if lamp.type == Lamp.Types["Spot"]:  # Lamp type is not a flag
                                   lamp.mode &= ~Lamp.Modes["RayShadow"] # Disable RayShadow.
                                   lamp.mode |= Lamp.Modes["Shadows"]    # Enable Shadowbuffer shadows
    
Type:
read-only dictionary

Types

The lamp types.
  • 'Lamp': 0
  • 'Sun' : 1
  • 'Spot': 2
  • 'Hemi': 3
  • 'Area': 4
  • 'Photon': 5
Type:
read-only dictionary