A modifier plug-in may have parameters which are animated or which are constant. The developer decides which of the modifier's parameters may be animated. Typically in 3ds Max, every parameter is animatable (provided it makes sense). For instance, the angle and direction parameters of the Bend modifier are animated while the Axis of the bend is not.
For a parameter to be animatable, it must have a controller to control the animation. Different parameter types require different controller types. For instance, a floating point value, like the angle parameter, requires a floating point controller. A node transformation matrix requires a transform controller. The full details of parameter management using controllers is covered in the Animation, Time, and Controllers section. The parameter block system greatly simplifies the animating of parameters.
One of the main purposes of a parameter block is to manage the complexity of maintaining different controllers for different parameters. The developer's job is simplified because to store and retrieve animated values, one simply uses the methods GetValue()
and SetValue()
. The parameter block stores values in an efficient a manner as possible. If the value hasn't yet been animated, that is, SetValue()
hasn't been called with time not equal to 0, then a constant value is stored. When SetValue()
is called with time not equal to 0, and Max's 'Animate' button is on, a new instance of the default controller for the parameter type is plugged in to the parameter block and initialized with the parameter's values. Plug-ins are required to display their animated parameters in the track view. If all the plug-in's parameters are handled by a parameter block, then the parameter block will take care of this task as well.
In the Bend example, a parameter block is used to handle the Angle, Direction, Axis, DoRegion, From and To parameters. The base class SimpleMod
and SimpleMod2
manages this parameter block. The parameter block is part of the SimpleMod2 class:
class SimpleMod2 : publicSimpleMod {
public:
IParamBlock2* pblock2;
Getting a value at any time is as simple as calling
float to;
u->pblock2->GetValue(bend_to,t,to,FOREVER);
or
float from = 45.4
u->pblock2->SetValue(bend_to,t,from);
See the topics on Parameter Blocks for more info.