[WML-Source: ScriptButtons.wml][TOC][Part00]
[chapter]
[section]ScriptButtons
[subsection]ScriptLinks - Linking scripts to Blender
Python scripts can be attached to DataBlocks with the ScriptButtons
window, and assigned events that define when they should be called.
The ScriptButtons are accessed via the icon in the the
ButtonsWindow header.
ScriptLinks can be added for the following DataBlocks
- Objects - Available when an Object is active
- Cameras - Available when the active Object is a Camera
- Lamps - Available when the active Object is a Lamp
- Materials - Available when the active Object has a Material
- Worlds - Available when the current scene contains a World
When you are able to add a script link an icon appears in the header,
similar to the ones that are used in the IPO Window. Selecting one of
the icons brings up the ScriptLink buttons group in the left of the
ScriptButtons window.
DataBlocks can have an arbitrary number of ScriptLinks attached
to them - additional links can be added and deleted with the
"New" and "Del" buttons, similar to Material Indices.
Scripts are executed in order, beginning with
the script linked at index one.
When you have at least one scriptlink the Event type and link
buttons are displayed. The link button should be filled in
with the name of the Text object to be executed. The Event
type indicates at what point the script will be executed,
- FrameChanged - This event is executed every time the user
changes frame, and during rendering and animation playback.
To provide more user interaction this script is also executed
continuously during editing for Objects.
- Redraw - This event is executed every time Blender redraws its Windows.
Scripts that are executed because of events being triggered
receive additional input by objects in the Blender module.
- The Blender.bylink object is set to True to indicate that
the script has been called by a ScriptLink (as opposed to the
user pressing Alt-P in the Text window).
- The Blender.link object is set to contain the DataBlock
which referenced the script, this may be a Material, Lamp, Object,
etc.
- The Blender.event object is set to the name of the event
which triggered the ScriptLink execution. This allows one script
to be used to process different event types.
[point]Scene ScriptLinks
The ScriptLink buttons for Scenes are always available in
the ScriptButtons, and function exactly
in the manner described above. Events available for SceneScriptLinks are:
- FrameChanged - This event is executed every time the user
changes frame, and during rendering and animation playback.
- OnLoad - This event is executed whenever the Scene is
loaded, ie. when the file is initially loaded, or when the
user switches to the current scene.
- Redraw - This event is executed every time Blender redraws its Windows.
-cw-
Last modified: Tue Oct 24 18:01:40 CEST 2000