A script node is a node that is saved with the scene and runs when a configurable event occurs. You can find existing script nodes in the Outliner by disabling Display DAG objects only, or in the Expression Editor ( ) when filtering By Script node Name.
To create a script node
- Open the Expression Editor ( ).
- In the
Expression Editor, select
Select Filter > By Script Node Name.
Any existing Script Nodes are displayed in the Script Nodes list.
- Enter a name for the node in the Script Node Name box.
- Type the script in the
Script box.
Click Test Script to try out the script. The results appear in the Script Editor.
- Click Create.
- Choose what event triggers the node. Use the chart under “Events” below for how to set the Execute On and Script options.
- Click Edit.
- If you want to create another script node, first click New Script Node to clear the form.
To edit a script node
- Open the Expression Editor ( ).
- In the Expression Editor, select Select Filter > By Script Node Name.
- Click the script node you want to edit in the Script Nodes list.
- Edit the script in the
Script box.
If you need to undo your changes, click Reload.
To delete a script node
- Open the Expression Editor ( ).
- In the Expression Editor, select Select Filter > By Script Node Name.
- Click the script node you want to edit in the Script Nodes list.
- 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.
Note: For this, and all other commands, consult the commands list in the
Maya Technical Documentation.
|
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.