Create or edit a script node

A script node is a node that is saved with the scene and runs when a configurable event occurs.

To create a script node

  1. Open the Expression Editor (Windows > Animation Editors > Expression Editor).
  2. In the Expression Editor, select Select Filter > By Script Node Name.

    Any existing Script Nodes are displayed in the Script Nodes list.

  3. Enter a name for the node in the Script Node Name box.
  4. Type the script in the Script box.

    Click Test Script to try out the script. The results appear in the Script Editor.

  5. Click Create.
  6. Choose what event triggers the node. Use the chart under “Events” below for how to set the Execute On and Script options.
  7. Click Edit.
  8. If you want to create another script node, first click New Script Node to clear the form.

To edit a script node

  1. Open the Expression Editor (Windows > Animation Editors > Expression Editor).
  2. In the Expression Editor, select Select Filter > By Script Node Name.
  3. Click the script node you want to edit in the Script Nodes list.
  4. Edit the script in the Script box.

    If you need to undo your changes, click Reload.

To delete a script node

  1. Open the Expression Editor (Windows > Animation Editors > Expression Editor).
  2. In the Expression Editor, select Select Filter > By Script Node Name.
  3. Click the script node you want to edit in the Script Nodes list.
  4. Click Delete.

Events

To trigger the script when... Set...
You open the scene in Maya. Execute On pull-down menu to GUI Open/Close.Script to Before.
You close or de-reference the scene in Maya, or when the node is deleted. Execute On to GUI Open/Close.Script to After.
You open the scene in batch mode. Execute On to Open/Close.Script to Before.
You close or de-reference the scene in batch mode, or when the node is deleted. Execute On to Open/Close.Script to After.
Before or after an animation is rendered. Execute On to Software Render.Script to Before or After.
Before or after each animation frame is rendered. Execute On to Software Frame Render.Script to Before or After.
You specifically call it with a scriptNode command. Execute On to Demand.

Internals

UI Configuration event

The before script contains the user interface configuration information. It is automatically generated either by Maya or a plug-in to save the panel layout and editor state information. This script node executes its script when you open a file. After execution, the node is deleted. The after script is never executed. This node will not exist if a file is referenced or imported.