Updating from ParamBlock1 to Paramblock2

This topic provides an overview of the "new" parameter block system (based on Paramblock2), and a walk-through of how to convert plug-ins from the legacy Paramblock to the new Paramblock2 system.

Overview

3ds Max 3 introduced a new Parameter Block and Parameter Map mechanism. The goal of this new mechanism was to make it possible for plug-ins to host all of their user-visible parameters in one or more parameter blocks, including complex parameters such as ReferenceTargets, Sub-Anims, dynamic parameter tables (Tabs<>), and class parameters. Further, the new parameter blocks make handling of old-version loading and reference management automatic.

To help support these new parameters the Parameter Map mechanism was updated to provide automatic UI creation for the new parameter types, including common 3ds Max controls such as node pickers, texmap selectors, and list boxes for tabular parameters. For plug-ins using a Qt UI, the new parameter types provide automatic mapping to Qt widgets. The new parameter block system exposed the plug-in data to systems like the MAXScript, the Macro Recorder and the Schematic View.

Overview of the Main new Classes

ClassDesc2

All plug-ins have a ClassDesc. From 3ds Max R3 a new class descriptor, sub-classed from ClassDesc is used. ClassDesc2 maintains a table of ParamBlockDesc2's and allows for automatic creation of the User Interface.

IParamBlock2

This is the interface into the parameter blocks. It contains all the necessary GetValue() and SetValue() methods needed to access the new forms of data.

ParamBlockDesc2

An instance of this class contains the descriptive data for a ParamBlock2 and all the parameters it contains. These are created using a var-args constructor, the arguments to which define the block and its parameters. A table of all the parameter block descriptors for a plug-in class is kept in its ClassDesc2 instance. A ParamBlockDesc2 contains an array of ParamDef instances, one for each parameter, and a set of block-level flags and UI information. A ParamDef structure contains a list of flags and descriptions for describing the user interface.

ParamBlock2PLCB

Instances of this class are given to ILoad::RegisterPostLoadCallback() to enable automatic conversion of old-parameter block versions of the plug-in. Developers give the constructor for this class a ParamVersionDesc array and the current ParamBlockDesc2 and it will load old parameter block objects into ParamBlock2 objects.