Go to: Synopsis. Return value. Flags. MEL examples.

Synopsis

scriptNode [-afterScript string] [-beforeScript string] [-executeAfter] [-executeBefore] [-name string] [-scriptType int] [attributeList]

scriptNode is undoable, queryable, and editable.

scriptNodes contain scripts that are executed when a file is loaded or when the script node is deleted. The scriptNode command is used to create, edit, query, and test scriptNodes.

Return value

None

In query mode, return type is based on queried flag.

Flags

afterScript, beforeScript, executeAfter, executeBefore, name, scriptType
Long name (short name) Argument types Properties
-scriptType(-st) int createqueryedit
Specifies when the script is executed. The following values may be used:
0 Execute on demand.
1 Execute on file load or on node deletion.
2 Execute on file load or on node deletion when not in batch mode.
3 Internal
4 Execute on software render
5 Execute on software frame render
6 Execute on scene configuration
7 Execute on time changed
C: The default value is 0.
Q: When queried, this flag returns an int.
-beforeScript(-bs) string createqueryedit
The script executed during file load.
C: The default is an empty string.
Q: When queried, this flag returns a string.
-afterScript(-as) string createqueryedit
The script executed when the script node is deleted.
C: The default is an empty string.
Q: When queried, this flag returns a string.
-executeBefore(-eb) create
Execute the script stored in the .before attribute of the scriptNode. This script is normally executed when the file is loaded.
-executeAfter(-ea) create
Execute the script stored in the .after attribute of the scriptNode. This script is normally executed when the script node is deleted.
-name(-n) string create
When creating a new scriptNode, this flag specifies the name of the node. If a non-unique name is used, the name will be modified to ensure uniqueness.

Flag can appear in Create mode of command Flag can appear in Edit mode of command
Flag can appear in Query mode of command Flag can be used more than once in a command.

MEL examples

//    Create a scriptNode named script that creates a sphere when a file
//    containing this node is loaded.
//
string $nodeName = `scriptNode -st 2 -bs "sphere" -n "script"`;

//    Test the before script.
//
scriptNode -executeBefore $nodeName;

//    Add a script to create a cone when the script node is deleted.
//
scriptNode -e -as "cone" $nodeName;

//    Test the after script
//
scriptNode -executeAfter $nodeName;