Module Lamp
[frames | no frames]

Module Lamp

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
 l = Lamp.New('Spot')            # create new 'Spot' lamp data
 l.setMode('Square', 'Shadow')   # set these two lamp mode flags
 ob = Object.New('Lamp')         # create new lamp object
 ob.link(l)                      # link lamp obj with lamp data

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

Function Summary
Blender Lamp or a list of Blender Lamps Get(name)
Get the Lamp Data object(s) from Blender.
Blender Lamp New(type, name)
Create a new Lamp Data object.

Variable Summary
read-only dictionary Modes: The lamp modes.
read-only dictionary Types: The lamp types.

Function Details

Get(name=None)

Get the Lamp Data object(s) from Blender.
Parameters:
name - The name of the Lamp Data.
           (type=string)
Returns:
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.

           (type=Blender Lamp or a list of Blender Lamps)

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

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

Variable Details

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

Generated by Epydoc 2.1 on Thu Jul 13 16:50:04 2006 http://epydoc.sf.net