Creating a Parameter Block
 
 
 

Parameter blocks are created from parameter block descriptors (ParamBlockDesc2). There are two methods for a plug-in to create a parameter block. The most common method is through a call to ClassDesc2::MakeAutoParamBlocks(). This will ask 3ds Max to automatically create all parameter blocks that have been registered with the class descriptor using the method, ClassDesc2::AddParamBlockDesc(). In order for this approach to work, parameter block descriptions needs to have the P_AUTO_CONSTRUCT flag set.

It is standard practice to call the ClassDesc2::MakeAutoParamBlocks() when the plug-in object gets created - usually this is done in the plug-in's constructor function. For example:

const BlockID paramBlockID = 0;
 
static MyClassDesc2 classDesc;
 
static  ParamBlockDesc2 blockDesc(paramBlockID, "my_class",
  MY_ROLLOUT_TITLE_RES_STRING_ID, &classDesc, P_AUTO_CONSTRUCT | P_AUTO_UI | ..., ...);
 
MyClass::MyClass()
{
    classDesc.MakeAutoParamBlocks(this);
}

The global function CreateParameterBlock2() from the file iparamb2.h can also be used to create a parameter block manually.