Virtually all plug-ins derive from ReferenceMaker. This allows them to be notified of changes to that certain functions must be implemented. See the topic Reference Makers and Reference Targets for more information.
In the case of a plug-in derived from the base class SimpleObject2 or SimpleMod2 these are implemented automatically for you. In the case of more complex plug-ins such as controllers, you will have to do this manually.
If a plug-in has a parameter block 3ds Max will automatically call ReferenceMaker::SetReference() passing it a pointer to the parameter block.
The following example demonstrates a simple implementation of ReferenceMaker for a plug-in with a single parameter block and no other referenced objects:
class MyPlugIn : MyPlugInBase { ParamBlock2* pblock; RefTargetHandle GetReference(int i) { switch (i) { case 0: return pblock; } return NULL; } intNumRefs() { return 1; } voidSetReference(inti, RefTargetHandle rtarg) { switch (i) { case 0: { IParamBlock* tmp = dynamic_cast<IParamBlock2*>(rtarg); if (tmp != NULL) pblock = tmp; } break; } } RefResult NotifyRefChanged(Interval iv, RefTargetHandle hTarg, PartID& partID, RefMessage msg) { return REF_DONTCARE; } };