Share

Exposing Parameter Blocks to 3ds Max

If a plug-in uses parameter blocks, and inherits from Animatable, it must expose the parameter blocks to 3ds Max by overriding the following methods of Animatable:

  • Animatable::NumParamBlocks() - Returns the number of parameter blocks used by the plug-in. Returns 0 by default.
  • Animatable::GetParamBlock() - Returns the nth parameter block in this instance (or NULL if not available). By default this returns NULL.
  • Animatable::GetParamBlockByID() - Returns a pointer to a ParamBlock2 as specified by the ID passed. By default this returns NULL. Note that the ID is not the same as the index.

The following example shows a typical implementation for a plug-in with only one parameter block:

class MyPlugin : SimpleObject2
{
  intNumParamBlocks() {
    return 1;
  }
 
  IParamBlock2* GetParamBlock(int i)  {
    return i == 0 ? pblock2 : NULL;
  }
 
  IParamBlock2* GetParamBlockByID(BlockID id) {
    return (pblock2->ID() == id) ? pblock2 : NULL;
  }
};

Note that even if you override these functions, you will still haveto expose a parameter block as a reference. See the topic Exposing and Managing References for more information.

Was this information helpful?