float_script : floatController point3_script : point3Controller position_script : positionController rotation_script : rotationController scale_script : scaleController
Value > MAXWrapper > Controllers > Script Controllers |
Script controllers have been significantly enhanced in 3ds Max 8. See Using Script Controllers for details on the changes.
Lets you programmatically get and set the expression text of a script controller.
See Script Controller Assignment Behavior Changes in 3ds Max 8 for some history notes on the changes introduced to this property's behavior in 3ds Max 8.
Controls whether to throw when an error occurs in the expression.
Available in 3ds Max 8 and higher.
There is a discontinuity between the MAXScript Debugger window, getting variable values using the Function Publishing System, and evaluating the script controller.
When working with the Debugger dialog, variable values are shown based on the current slider time.
When accessed using the Function Publishing System, the variable values returned are based on the current MXS time.
When evaluating the controller, the result is based on the current time value as well as the range of the controller, Out-Of-Range Type set for the controller, and any Ease curves applied to the controller.
This means that while 'NT' might show one value in the Debugger dialog, its value in the evaluation might be different.
All script controllers expose the IScriptCtrl Interface since 3ds Max 8.
This interface provides methods to access the controller through MAXScript.
A script controller supports four types of user-defined variables: Constant, Target, Object, and Node. The main difference between these variables is the type of value or reference they contain, which in turn determines the type of notification messages that will cause an update of the script controller.
Note that in the Script Controller UI, the creation of the variable and the assignment of the value is performed in two separate steps (the Create button always creates a Constant Variable with a value of 0) while in MAXScript, the creation and assignment are performed in a single step.
A constant variable can contain a constant value.
The MAXScript Expression assigned to the variable will be evaluated and if the return value is a constant, it will be used as the value of the variable. The constant variable creates no dependencies on other objects.
If the expression evaluates to a MAXWrapper (such as, a node, material, modifier, controller, and others), the result will be stored in an Object variable and will be updated dynamically. In other words, the .addConstant() method will behave like the .addObject() method and the resulting variable will not be a Constant variable, but an Object variable.
If the result of the expression evaluation is a subAnim, it will be stored as a Targetvariable. In other words, in this case .addConstant() will behave like the .addTarget() method.
Adds a constant variable to the controller. Corresponds to the "Create" and"Assign Constant" buttons in the Script Controller UI.
A constant variable returns the value of the MAXScript expression assigned to it. The expression can be any valid MAXScript expression that evaluates to a value.
The first argument is the name of the constant variable.
The second argument is the expression to be assigned to the variable.
Returns true on success, false on failure.
Sets the constant variable value.
The first argument is either the name of the variable as string, or the index of the variable as integer.
The second argument is the MAXScript expression providing the value.
Returns the value of the expression assigned to the constant variable specified by name or index.
Throws a Runtime error if the variable name does not exist or the variable does exist, but is not a constant variable.
A target variable contains a reference to a subAnim Track.
The script controller will be updated when a notification about subAnim changes is sent. For example, if a target variable contains a reference to the Angle subAnim of a Bend Modifier applied to a Teapot, changing any subAnim of the Teapot or Bend Modifier will cause an update of the script controller, including changing the Bend Angle, Teapot Radius, and others.
Transformations of the Node will not cause an update of the script controller unless the Node track itself or a transform track is selected as the reference.
While it is allowed to assign the Node as the subAnim to be stored in the variable, this will be highly inefficient since any change to any of the subAnims of the referenced node will cause an update of the controller. Use the Node Variable to make a dependency on a Node instead.
See Also Referencing Nodes and Controllers in Script Controllers FAQ for more details.
<boolean>AddTarget <&TSTR>Name <value>Target Offset:<time> Owner:<value> Name is In parameter Offset default value: 0f Owner default value: undefined
Adds a target variable to the controller. Corresponds to the "Create" and "Assign Track" buttons in the Script Controller UI.
The first argument is the name of the target variable.
The second argument is the Trackvalue to be assigned to the target variable.
The optional Offset: keyword can be used to define a time offset.
The optional Owner: keyword argument can be used to define the owner of the Track.
Returns true on success, false on failure.
Sets a taget variable specified by name or index in the first argument to the target (subAnimtrack) value specified by the second argument. Corresponds to the "Assign Track" buttons in the Script Controller UI.
The optional Owner: keyword argument can be used to define the owner of the subAnim track.
Returns true on success, false on failure.
Returns the reference target stored in the target variable specified by name or index in the first argument.
If the optional asObject: keyword argument is supplied and is true, the return value will be converted from a subAnim to a MAXObject.
An object variable can hold a MAXWrapper value including Animation Controller, Base Object, Modifier, Material, Scene Node, and others.
Most subAnim tracks in 3ds Max do not have a controller assigned by default. A controller is assigned automatically when a keyframe animation is first created or can be assigned manually using TrackView or MAXScript. Thus, the object variable can only hold a reference to an existing animation controller and cannot reference parameter subAnim tracks without a controller. For creating a reference to a subAnim, use the Target Variable instead.
Adds an object variable to the script controller. Corresponds to the "Create" and "Assign Controller" buttons in the Script Controller UI.
The first argument is the name of the object variable.
The second argument is the Controller to be assigned to the object variable.
Returns true on success, false on failure.
Sets the object variable specified by name or index in the first argument to the controller object value specified by the second argument.
Returns true on success, false on failure.
Returns the controller object referenced by the object variable specified by name or index in the first argument.
A node variable can hold a reference to a Scene Node only.
The script controller will be updated only when the node is changed, including changes to its Position, Rotation, and Scale transforms and deletion of the node.Changes to the object attached to the node or its sub-anims will NOT cause an update of the script controller.
This variable type is very useful for accessing data from the object the script controller is assigned to without causing circular dependency problems. See Script Controller - Avoiding Circular Dependency for details.
Adds a node variable to the controller. Corresponds to the "Create" and "Add Node" buttons in the Script Controller UI.
A node variable contains a reference to a scene node. Since the reference is name-independent, changing the name of the node stored in the variable does not affect the functioning of the script controller.
The first argument is the name of the node variable.
The second argument is the scene node to be assigned to the variable.
Returns true on success, false on failure.
Sets a given node variable to the specified scene node value. Returns true on success, false on failure.
Returns the scene node value stored in the specified node variable.
Deletes the user-defined variable specified by name or index.
Variables with index 1 to 4 are read-only and cannot be deleted - a Runtime error will be thrown if such an attempt is made. See .NumVariables() method documentation below for details. Thus, the argument must be either an index greater than four or a name of an existing user-defined variable.
Returns the number of variables defined in the controller.
A default controller with no user-defined variables already provides four pre-defined variables for time access:
1 - T, Current Time In Ticks, Constant
2 - S, Current Time In Seconds, Constant
3 - F, Current Time in Frames, Constant
4 - NT, Current Normalized Time, Constant
User-defined variables generally have an index higher than four.
Returns true if the given variable name exists in the controller, false if it does not exist.
Returns the type of the variable specified by name or index.
Returns the name of the indexed variable.
Renames the variable specified by name or index in the first argument to the name specified by the second argument.
Returns the value stored in the specified variable.
If the optional asObject argument is supplied as true, the return value will be converted to an object reference.
Returns the value stored in the specified variable.
The Time Offset can be applied to any variable and defines the time context in which the variable will be evaluated. The default offset is 0. In other words, the value of a variable can be the same or different than the time at which the controller is being evaluated.
Sets the time offset of the variable specified by name or index to the given time value.
The Expression is the MAXScript Expression evaluated by the script controller to determine its final value.
Sets the expression string of the script controller to the string passed by-reference.
Returns true on success, false otherwise.
The Description is a user-defined string value describing the features and functionality of the script to be read by other users of the 3ds Max scene containing the controller.
Returns the description string.
Prints information about the script controller, including the description string, expression code, and variable details.