Control Virtual Methods
The following methods of Control are often overridden by a plug-in controller.
- Control::Copy() - When a controller is assigned to a track in the track view, the new controller
is plugged into the parameter and this method is called on the new controller. A pointer
to the old controller is passed in to this method. The new controller can attempt
to copy any data that it can from the old controller. At the very least it should
initialize itself to the value of the old controller at frame 0.
- Control::IsKeyable() - Indicates if the controller is a keyframe controller. This means the controller
stores keys at certain frames and interpolates between keys at other times. It returns
a nonzero value if the controller is a keyframe controller or zero otherwise. The
default implementation returns one indicating that it is a keyframe controller.
- Control::IsLeaf() - Indicates whether the controller is a leaf controller. If a controller is a leaf
controller, then it must not by definition have any sub-controllers or references.
The controller should return TRUE if it has no sub-controllers. For example, a PRS controller is not a leaf controller
(because it has sub-controllers for Position, Rotation and Scale), but a simple key-framed
float controller is a leaf controller. The default implementation returns TRUE indicating the controller is a leaf controller.
- Control::GetValue() - Retrieves the value of the controller at the specified time, and updates the validity
interval passed in to reflect the interval of the controller. This method is responsible
for handling Out of Range Types, Ease Curves and Multiplier Curves.
- Control::SetValue() - This method sets the value of the controller at the specified time. This method
is responsible for handling Out of Range Types, Ease Curves and Multiplier Curves.
- Control::CommitValue() - This method, along with SetValue() comprise an "inner" hold and restore mechanism (see the topic Undo and Redo in a Controller). When the controller's SetValue() method is called, if the commit parameter is nonzero, then the controller should
save the value of the controller at the current time into its cache and also 'commit'
the value. For example, this stores a key in the case of a keyframe controller. If
the set value was not committed then RestoreValue() may be called to restore the previous value. The default implementation does nothing.
- Control::RestoreValue() - This method is the other half of the "inner" hold and restore mechanism. This method
is called to restore a previously saved value. This method restores the current cache
value to the value that was set before SetValue() was last called. The way the standard 3ds Max controllers handle this is as follows:
When SetValue() is called a temporary hold mechanism (TempStore defined in control.h) is used to hold the current value. Then the new value is set. If RestoreValue() is later called then it restores the current value from the temporary storage. Note
that in addition to restoring from the TempStore, another way a controller may restore the current value is to re-interpolate the
keys. The default implementation does nothing.