Script Context

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. Just one Panel, Scriptlinks is present.

ScriptLinks can be added for the following DataBlocks

These can be selected with the top row of Toggle Buttons in the Panel. Please note that only the Buttons which are applicable are present.

Selecting one of the Toggle Buttons brings up the Selected Scriptlink Buttons group in the middle of the Panel.

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 Menu and link buttons are displayed. The link button should be filled in with the name of the Text Object containing the script to be executed. The Event type indicates at what point the script will be triggered:

Scripts that are executed because of events being triggered receive additional input by objects in the Blender module.

Scene ScriptLinks

The ScriptLink buttons for Scenes are always available at the bottom of the Scriptlink Panel, and function exactly in the manner described above, but on a scene wide context. 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.