Share

Writing Reference Targets

Most plug-ins are reference targets (i.e. derived from ReferenceTarget) meaning that they can send notifications to observers.

The primary responsibility of a reference target is to notify its dependents of any changes to its structure of exposed values.

The following is a list of some of the important functions that must be implemented by a reference target.

  • ReferenceTarget::NotifyDependents() - Your reference target should call this whenever it wants to notify observers of a change to the reference target. 3ds Max will automatically notify dependents if the target is deleted.
  • ReferenceTarget::Clone() - Called by 3ds Max when an object is cloned by the user or via a call to RemapDir::CloneRef() or CloneRefHierarchy(). An override should creates an instance of the new object, and then calls ReferenceTarget::BaseClone().
  • ReferenceTarget::BaseClone() - This is called by a plug-in from ReferenceTarget::Clone() and allows an object to copy any custom data, and allow derived classes to copy this data in their clone implementations.

Was this information helpful?