Expression Controllers

Note: These classes are not available in Autodesk VIZ.

 

The Expression controllers have been rewritten and completely exposed to MAXScript via the IExprCtrl interface documented below. In versions prior to 3ds Max 8, there were no properties or methods accessible for Expression controllers.

The following Expression controllers are available:

Float_Expression : FloatController

Point3_Expression : Point3Controller

Position_Expression : PositionController

Scale_Expression : ScaleController

Properties:

<expression_controller>.ThrowOnError Bool default:true

Controls whether to throw when an error occurs in the expression.

Interfaces:

All expression controllers expose the IExprCtrl Interface since 3ds Max 8. This interface provides all methods to access the controller through MAXScript:

IExprCtrl - Expression Controller Interface

Methods:

<boolean>SetExpression <&TSTR>Expression

Expression is In parameter

Sets the expression string to the string passed by-reference. Returns true on success, false otherwise.

<TSTR by value>GetExpression()

Returns the expression string.

<integer>NumScalars()

Returns the number of scalars defined in the controller.

<integer>NumVectors()

Returns the number of vectors defined in the controller.

<boolean>AddScalarTarget <&TSTR>Name <value>Target Offset:<time> Owner:<maxObject>

Name is In parameter

Offset default value: 0f

Owner default value: undefined

Adds a scalar target. The first argument is the name of the scalar. The second argument is the target to be connected to the scalar.

<boolean>AddVectorTarget <&TSTR>Name <value>Target Offset:<time> Owner:<maxObject>

Name is In parameter

Offset default value: 0f

Owner default value: undefined

Adds a vector target. The first argument is the name of the vector. The second argument is the target to be connected to the vector.

<boolean>AddVectorNode <&TSTR>Name <node>Node Offset:<time>

Name is In parameter

Offset default value: 0f

Adds a vector node. The first argument is the name of the vector. The second argument is the node to be connected to the vector.

<boolean>AddScalarConstant <&TSTR>Name <float>Constant

Name is In parameter

Adds a scalar constant. The first argument is the name of the scalar. The second argument is the constant value to be assigned to the scalar.

<boolean>AddVectorConstant <&TSTR>Name <point3>Constant

Name is In parameter

Adds a vector constant. The first argument is the name of the vector. The second argument is the constant value to be assigned to the vector.

<boolean>SetScalarTarget <value>Which <value>Target Owner:<maxObject>

Owner default value: undefined

Sets the target of the given scalar variable. Returns true on success, false otherwise. The optional Owner parameter can be supplied to specify the owner of the target track in case the target is instanced across multiple objects.

<boolean>SetVectorTarget <value>Which <value>Target Owner:<maxObject>

Owner default value: undefined

Sets the target of the given vector variable. Returns true on success, false otherwise. The optional Owner parameter can be supplied to specify the owner of the target track in case the target is instanced across multiple objects.

<boolean>SetVectorNode <value>Which <node>Node

Sets the node of the given vector variable. Returns true on success, false otherwise.

<boolean>SetScalarConstant <value>Which <float>Constant

Sets the value of the given scalar variable to the specified constant value. Returns true on success, false otherwise.

<boolean>SetVectorConstant <value>Which <point3>Constant

Sets the value of the given vector variable to the specified constant value. Returns true on success, false otherwise.

<boolean>DeleteVariable <&TSTR>Name

Name is In parameter

Deletes the variable with the given name. Returns true on success, false otherwise.

<TSTR by value>GetDescription()

Returns the description string of the controller.

<boolean>SetDescription <&TSTR>Description

Description is In parameter

Sets the description string of the controller to the specified by-reference string argument.

<time>GetOffset <&TSTR>Name

Name is In parameter

Returns the offset of the given variable.

<boolean>SetOffset <&TSTR>Name <time>Offset

Name is In parameter

Sets the offset of the given variable to the specified time value.

<void>Update()

Updates the controller.

<boolean>VariableExists <&TSTR>Name

Name is In parameter

Returns true if the named variable exists, false otherwise.

<float>GetScalarConstant <value>Which

Returns the value of the given scalar constant.

<value>GetScalarTarget <value>Which asController:<boolean>

asController default value: false

Returns the target of the given scalar variable. If the optional asController parameter is set to true, the result will be a controller value.

<point3 by value>GetVectorConstant <value>Which

Returns the value of the given vector constant.

<value>GetVectorTarget <value>Which asController:<boolean>

asController default value: false

Returns the target of the given vector variable. If the optional asController parameter is set to true, the result will be a controller value.

<node>GetVectorNode <value>Which

Returns the node of the given vector variable.

<float>GetScalarValue <value>Which

Returns the value of the given scalar variable.

<point3 by value>GetVectorValue <value>Which

Returns the value of the given vector variable.

<fpvalue>GetValue <&TSTR>Name

Name is In parameter

Returns the value of the named variable.

<enum>GetScalarType <value>Which

GetScalarType enums: {#unknown | #scalarTarget | #scalarConstant | #vectorTarget | #vectorConstant | #vectorNode}

Returns the type of the given scalar variable.

<enum>GetVectorType <value>Which

GetVectorType enums: {#unknown | #scalarTarget | #scalarConstant | #vectorTarget | #vectorConstant | #vectorNode}

Returns the type of the given vector variable.

<enum>GetValueType <&TSTR>Name

GetValueType enums: {#unknown | #scalarTarget | #scalarConstant | #vectorTarget | #vectorConstant | #vectorNode}

Name is In parameter

Returns the value type of the given variable.

<TSTR by value>GetScalarName <index>Index

Returns the name of the indexed scalar variable.

<TSTR by value>GetVectorName <index>Index

Returns the name of the indexed vector variable.

<index>GetScalarIndex <&TSTR>Name

Name is In parameter

Returns the index of the named scalar variable.

<index>GetVectorIndex <&TSTR>Name

Name is In parameter

Returns the index of the named vector variable.

<TSTR by value>PrintDetails()

Prints information about the expression controller, including description string, expression code, scalars and vectors details.

 

 

Notes:

 

Note:

There is a discontinuity between the MAXScript Debugger window, getting variable values via Function Publishing System and evaluating the expression controller.

This means that while 'NT' might show one value in the Debugger dialog, its value in the evaluation may be different!

 

See also

Controller Common Properties, Operators, and Methods

MAXWrapper Common Properties, Operators, and Methods

Value Common Properties, Operators, and Methods