MAXScript Language Reference > 3ds Max Objects > Animation Controllers > Controller Common Properties, Operators, and Methods >

# Controller Common Properties, Operators, and Methods

Value > MAXWrapper > Animation Controllers > Controller

| Animation Controllers - Quick Navigation

Properties

All controllers have the following properties:

    <controller>.keys MAXKeyArray -- read-only, the controller’s key array
    <controller>.value varies -- get or set the current controller value

The keys and value properties g

ive you access to the value and keys in a free-standing controller, which is useful when working with the global tracks controllers that are accessible in MAXScript. Those controllers that are not keyframeable return an empty KeyArray for their keys property.

The value property is sensitive to the current time and animate contexts, so you can use it to evaluate a controller at various times or to plant keyframes in those controllers that support keys.

You can only assign a value to a controller’s value property if the controller is a key-based controller. The only exception to this is that you can assign a Matrix3 value to a PRS controller’s value property. MAXScript will automatically set the individual position, rotation, and scale values to the values represented in the Matrix3 value.

If an Ease Curve has been assigned to a controller, the following controller-related sub-property is available:

    <controller>.Ease_Curve Float -- the controller’s ease curve value

If a MultiplierCurve has been assigned to a controller, the following controller-related sub-property is available:

    <controller>.Multiplier_Curve Float -- the controller’s multiplier curve value

See Ease and Multiplier Curve Functions for methods and notes related toEase andMultiplier curves.

EXAMPLE:
    globaltracks.float.mycontroller.value
    globaltracks.float.mycontroller.keys[2]

Associated Properties

All animatable properties in 3ds Max objects let you reference several controller-related sub-properties. These are:

    <property>.controller

The property’s controller.

    <property>.track

A synonym for .controller.

    <property>.isAnimated

A boolean indicating whether the property is animated.

    <property>.keys

Read-only, gets the property’s controller’s key array

    <property>.supportsKeys

Read-only, boolean, true if controller is key-framable

    <property>.keyable

Boolean, true if controller is keyable, false if set to unkeyable

    <property>.isHSV

Read-only, boolean, true if controller's value represent HSV colors

The track property is a simple synonym for controller . If an animatable property does not yet have a controller assigned, the isAnimated property returns false and the controller , track , and keys properties return undefined .

EXAMPLE:
    $foo.pos.controller
    bend_mod1.angle.isAnimated
    $bar.taper.gizmo.scale.keys[2]

You create controllers as you do other 3ds Max objects by calling the class' constructorfunction:

EXAMPLE:
    c = bezier_position()

and assign them to animatable properties by assigning to the controller property in those animatables.

EXAMPLE:
    $foo.pos.controller = c
    $baz.bend.gizmo.rotation.controller = tcb_rotation()
    $box01.length = linear_float()

Methods

    getPointControllers {<editable_mesh_node> | <editable_spline_node>}

Returns an array of controllers assigned to the vertices in the mesh or spline. If no controller has been assigned to a vertex, the array element value will be undefined. For editable splines, each knot consists of 3 vertices: the in vector, the knot, and the out vector. The array of controllers returned is a "snapshot" of the current controllers. If controllers are assigned or changed for a vertex, this change is not reflected in the array. If a vertex is added/deleted, the array is not resized to reflect the change in number of vertices.

    getPointController <editable_mesh_node> <vertex_index_integer>

Returns the controller currently assigned to the vertex, undefined if no controller assigned.

    getPointController <editable_spline_node> <spline_index_integer> <vertex_index_integer>

Returns the controller for specified vertex in the specified spline, undefined if no controller assigned. Each spline knot consists of 3 vertices: the in vector, the knot, and the out vector.

Note

Applying a controller to a property causes the controller to take on the properties value at frame 0. If keys are present for the controller before the assignment to the property, all keys will be adjusted by the difference between the controller’s value at frame 0 and the property’s value. This is shown in the following example.

SCRIPT
    a=bezier_float ()
    addnewkey a 0
    addnewkey a 10
    a.keys[1].value=10
    a.keys[2].value=100
    b=box()
    b.height
    b.height.controller=a
    b.height
    at time 10 b.height
OUTPUT
    Controller:Bezier_Float-- result line 1
    #Bezier Float key(1 @ 0f)-- result line 2
    #Bezier Float key(2 @ 10f)-- result line 3
    10-- result line 4, key value at time 0
    100-- result line 5, key value at time 10
    $Box:Box01 @ [0.0,0.0,0.0]-- result line 6
    25.0-- result line 7, default property value
    Controller:Bezier_Float-- result line 8
    25.0-- result line 9, key value changed from 10 to 25 (delta= +15)
    115.0-- result line 10, key value changed by delta = +15
A somewhat strange situation can arise when a single controller is assigned to multiple object properties. The value actually stored in a controller may not necessarily be the same value seen in Track View or in the command panels, nor the same value returned by accessing the property value in MAXScript. Part of a MAXWrapper property definition is scaling value that is applied when reading or setting the true value stored in a controller. For example, the slice_to and slice_from properties associated with many of the geometry primitives is displayed in degrees. The actual value stored in the controller associated with these properties are in radians. This scaling factor is an internal property of the MAXWrapper property, and not an internal property of the controller. Both 3ds Max and MAXScript automatically apply the specified scaling factor when accessing properties, so this scaling is normally invisible to the user. If the same controller is assigned to two properties which have different scaling factors, the question arises as to which scaling factor to apply to the output of the controller. If you are accessing the controller’s value through a MAXWrapper property, the scaling factor associated with that property is applied to the controller’s value. MAXScript also internally stores the last scaling factor applied to the controller’s value. If you are directly accessing the value property of the controller, or the value property of a key in the controller, the stored scaling factor is used. This can result in a controller’s value property returning different values at different times in a script, based on how the controller was last accessed. Because of this, it is highly recommended that you do not instance a controller onto multiple MAXWrapper properties which have different scaling factors. The scaling factor, if any, is listed for each MAXWrapper property in the documentation of the MAXWrapper classes.

    displayControlDialog <controller> <string>

Displays the modal controller dialog, if any. The string will be in the dialog title bar. If the controller is a keyframe controller, the key info dialog will be displayed for the selected keys. If no keys are selected, no dialog will be displayed.

    clearControllerNewFlag <controller>

Clears the 'new' flag on the MAXScript wrapper for the controller.

When this flag is set, when you assign the controller to a property, the initial value of the controller is set to the property value.

When you create an instance of a controller, this flag is set.

It is normally cleared only after the controller is assigned to a property.

Available in 3ds Max 2008 and higher. Previously available in the Avguard Extensions .

Controllers that can be keyframed support several time and key-related functions, as described in the following topics:

Controller Time Functions

Controller Key Functions

Controller Out-Of-Range Functions

Controller Ease and Multiplier Curve Functions

Controller Key Reducer

ControllermapKeys() method

#### See Also

- Key Common Properties, Operators, and Methods

- MAXWrapper Common Properties, Operators, and Methods

- Value Common Properties, Operators, and Methods