Adding the Roll-up to the Command Panel

When the user may edit an object's parameters the rollup pages must be added to the command panel. This can be done using the CreateCPParamMap() function. This function creates a parameter map to handle the display of parameters in the command panel. Shown below are two samples from the sphere's Animatable::BeginEditParams() method.

This first call to CreateCPParamMap() manages the variables of the Sphere Object (not the parameter block).

The CreateCPParamMap() method takes several arguments. The first is the array of ParamUIDescs, one element for each control to be managed. The second is the number of items in this array. The third parameter is a pointer to the virtual array of parameters. The example below uses the this pointer of the sphere object to indicate which parameter array. The this pointer means the SphereObject itself is the IParamArray pointer (the SphereObject was derived from IParamArray). In this way, the parameter map may access the variables of the sphere object. The fourth parameter is the interface pointer passed into the BeginEditParams() method. The fifth parameter is the DLL instance handle of the plugin. The sixth parameter is the dialog template for the rollup page (created using the resource editor). The next parameter is the title displayed in the rollup page title bar. The final parameter is a set of flags to control settings of the rollup page. After this call finishes, the "Creation Method" rollup has been added to the command panel.

pmapCreate = CreateCPParamMap(
 descCreate,CREATEDESC_LENGH,
 this,
 ip,
 hInstance,
 MAKEINTRESOURCE(IDD_SPHEREPARAM1),
 _T("Creation Method"),
 0);

The example below is similar, however it uses the parameter block pointer pblock to indicate which virtual array to manage. The parameters in this case are all stored as part of the parameter block (the IParamBlock class is derived from IParamArray). After this call finishes, the "Parameters" rollup has been added to the command panel.

pmapParam = CreateCPParamMap(
 descParam,PARAMDESC_LENGH,
 pblock,
 ip,
 hInstance,
 MAKEINTRESOURCE(IDD_SPHEREPARAM2),
 _T("Parameters"),
 0);