Time is stored internally in 3ds Max as an integer number of ticks. Each second of an animation is divided into 4800 ticks. This value is chosen in part because it is evenly divisible by the standard frame per second settings in common use (24 -- Film, 25 -- PAL, and 30 -- NTSC).
The data type used to store a specific instance of time is the TimeValue
. A TimeValue
stores the number of ticks the time represents. When a developer specifies time to almost all the functions in the SDK they use TimeValues
.
In 3ds Max, time may be displayed in one of four formats. These are just display formats (the internal representation never changes). The formats are:
hours
:minutes:seconds:frames. 3ds Max abbreviates this by not including the hours designation to minutes
:seconds.frames.A developer may get and set the current time displayed format. The functions to accomplish this are GetTimeDisplayMode()
and SetTimeDisplayMode()
. When these settings are changed a message is sent throughout 3ds Max to handle updating any UI controls that reflect time settings (including plug-in custom controls).
A developer can retrieve the number of ticks per frame using the function GetTicksPerFrame()
, and can set this number using SetTicksPerFrame()
.
A developer can also get and set the current frame rate. This is the number of frames per second. The functions for this are GetFrameRate()
and SetFrameRate()
. This is just an alternate way to specify the number of ticks per frame.
There are also functions to convert between the numeric and ASCII representations of time. The functions for this are TimeToString()
and StringToTime()
.
Note that some methods related to time are part of various interface classes. For example Class Interface
provides methods to retrieve the current frame slider setting and the current animation range. These methods are GetTime()
and GetAnimRange()
. You can also set these using SetTime()
and SetAnimRange()
. There is also a method RegisterTimeChangeCallback()
that allows a plug-in to be notified every time the user changes the frame slider.