Managing Variable Number of References
 
 
 

Some plug-ins may need to manage a variable number of ReferenceTarget objects (e.g. references to other plug-ins). This should be done by creating an instance of the interface IRefTargContainer as follows:

IRefTargContainer* myRefTargets = static_cast< IRefTargContainer*>( Interface::CreateInstance(REF_TARGET_CLASS_ID,  REFTARG_CONTAINER_CLASS_ID));
 

A strong reference must then be made from the plug-in to the instance. This way your plug-in will always have a fixed number of references, which is significantly easier to manage, and do correctly.

The 3ds Max implementation of this interface will persist itself and automatically support undo and redo of any operations performed on it.