scriptNodes contain scripts that are executed when a file is loaded or when the script node is deleted. If a script modifies a referenced node, the changes will be tracked as reference edits unless the scriptNode was created with the ignoreReferenceEdits flag. The scriptNode command is used to create, edit, query, and test scriptNodes. In query mode, return type is based on queried flag.
Long name (short name) | Argument Types | Properties | |
---|---|---|---|
afterScript (afterScript) | unicode | ||
|
|||
beforeScript (bs) | unicode | ||
|
|||
executeAfter (ea) | bool | ||
|
|||
executeBefore (eb) | bool | ||
|
|||
ignoreReferenceEdits (ire) | bool | ||
Sets whether changes made to referenced nodes during the execution of the script should be recorded as reference edits. This flag must be set when the scriptNode is created. If this flag is not set, changes to referenced nodes will be recorded as edits by default.Flag can appear in Create mode of commandFlag can have multiple arguments, passed either as a tuple or a list. |
|||
name (n) | unicode | ||
|
|||
scriptType (st) | int | ||
Specifies when the script is executed. The following values may be used: 0Execute on demand.1Execute on file load or on node deletion.2Execute on file load or on node deletion when not in batch mode.3Internal4Execute on software render5Execute on software frame render6Execute on scene configuration7Execute on time changedC: The default value is 0.Q: When queried, this flag returns an int. |
|||
sourceType (stp) | unicode | ||
|
Derived from mel command maya.cmds.scriptNode
Example:
import pymel.core as pm
# Create a scriptNode named script that creates a sphere when a file
# containing this node is loaded.
#
nodeName = pm.scriptNode( st=2, bs='pm.sphere()', n='script', stp='python')
# Test the before script.
#
pm.scriptNode( nodeName, executeBefore=True )
# Add a script to create a cone when the script node is deleted.
#
pm.scriptNode( nodeName, e=True, as='pm.cone()', stp='python' )
# Test the after script
#
pm.scriptNode( nodeName, executeAfter=True )