MAXScript Tools and Interaction with 3ds Max > Interacting with the 3ds Max User Interface > Time Control >

# Time Control

The following methods and 3ds Max system global variables are associated with the 3ds Max Time Controls:

    animButtonEnabled

A Boolean value that specifies whether the user can change the state of the Auto Key button. If set to false , the user can not change the Auto Key button state. If set to true , the user can change the Auto Key button state. A script can change the state of the Auto Key button using animButtonState regardless of the animButtonEnabled value.

    animButtonState

Lets you to get and set the state of the Auto Key button. A Boolean value - true if Auto Keyis on, false if Auto Key is off.

HISTORY:
In the early 3ds Max versions, there was no Set Key mode and the Auto Key button was called the Animate button. The name is still used for compatibility reasons.

    sliderTime

Lets you get and set a Time value that defines the time associated with the 3ds Max time slider.

Two functions are provided for starting and stopping the 3ds Max animation playback, which are essentially equivalent to pressing the Play button in the 3ds Max user interface. The functions are:

    playAnimation [ #selOnly ] immediateReturn:<boolean>

    stopAnimation()

If you specify the optional argument, #selOnly , to playAnimation() only the currently selected objects are animated.

If immediateReturn is set to false or not specified, and Real Time Playback is on ( realTimePlayback = true ), the method does not return until animation playback is stopped.

If immediateReturn is set to true , or Real Time Playback is off ( realTimePlayback = false ),the method returns immediately.

There is an important restriction to understand when using these functions:

Calling playAnimation() is a thread-blocking call internally in 3ds Max and does not return until the playback is stopped by the user clicking the Stop Play button or another thread executing a stopAnimation() . The only way to achieve the latter in MAXScript currently is to call stopAnimation() from a scripted rollout panel handler such as a button press handler or from a scripted controller script. If you invoke playAnimation() in code run from the Listener, you will not be able to invoke stopAnimation() from the Listener, because the Listener is blocked inside the playAnimation() call.

    isAnimPlaying()

Returns true if the animation is currently playing, false otherwise. Available in 3ds Max 2008 and higher. Previously available in the Avguard Extensions.

Also see Time Configuration Dialog for methods for setting options in the Time Configuration dialog.