Creating the Parameter Block and Referencing It
 
 
 

A parameter block 1 must be created from the parameter block descriptors (ParamBlockDescID). Items in the parameter block are referred to by index. The index is derived from the order in which the descriptors appear in the ParamBlockDescID array.

#define PB_RADIUS 0
#define PB_SEGS 1
#define PB_SMOOTH 2
#define PB_HEMI 3
#define PB_SQUASH 4
#define PB_RECENTER 5
static  ParamBlockDescID descVer1[] = {
 { TYPE_FLOAT, NULL, TRUE, 0 }, // Radius
 { TYPE_INT, NULL, TRUE, 1 }, // Segs
 { TYPE_INT, NULL, TRUE, 2 }, // Smooth
 { TYPE_FLOAT, NULL, TRUE, 3 }, // Hemi
 { TYPE_INT, NULL, FALSE, 4 }, // Squash
 { TYPE_INT, NULL, FALSE, 5 } }; // Recenter
#define PBLOCK_LENGTH 6

A reference is made to the parameter block as well. For more information on references see topic on Reference System. After the parameter block is created, default values are initialized. This is done using the SetValue() method of the parameter block. The developer must pass the index of the parameter, the time to set the value at, and the value to set.

SphereObject::SphereObject()
{
    ReplaceReference(CreateParameterBlock(descVer1, PBLOCK_LENGTH, CURRENT_VERSION));
    assert(pblock);
    pblock->SetValue(PB_RADIUS,0,crtRadius);
    pblock->SetValue(PB_SMOOTH,0,dlgSmooth);
    pblock->SetValue(PB_SEGS,0,dlgSegments);
    pblock->SetValue(PB_SQUASH,0,0);
}