ReferenceMaker

3DS Max Plug-In SDK

ReferenceMaker

See Also: Class ReferenceMaker.

Any entity that makes references must be derived from this class. A reference creates an official record of the dependency between a ReferenceMaker and a ReferenceTarget. 3ds max uses a messaging system to notify ReferenceMakers about changes in their ReferenceTargets.

ReferenceMaker provides two methods associated with this system.

NotifyDependents()

A plug-in calls this method any time it needs to broadcast a message to all its dependents. Typically this is a REFMSG_CHANGE message indicating the plug-in has changed.

NotifyRefChanged()

This method is called by the system when one of the entities a plug-in references calls NotifyDependents() to broadcast a message. The plug-in implements NotifyRefChanged() to receive the messages.

A reference maker must provide access to its references via the following methods:

NumRefs(), GetReference(i), SetReference(i)

The system calls these methods when the plug-in creates and deletes references.

ReferenceMaker has additional methods for creating, replacing and deleting references.

MakeRefByID()

Makes a new reference given the reference target and the index of the reference within the reference maker.

ReplaceReference()

Deletes a reference if it is non-null and makes a new reference to a new target.

DeleteReference()

Deletes a particular reference.

DeleteAllRefsFromMe()

This method deletes all references that the reference maker has.

DeleteAllRefs()

This deletes all references to AND from the reference maker.

EnumDependents()

This allows a reference target to enumerate all reference to it. All reference targets have a list of backpointers to entities that reference it. This method enumerates those back pointers calling the given callback object once per dependent.

ReferenceMaker also has methods for the loading and saving of plug-ins.

Load()

This method is called when a 3ds max file itself is being loaded. The plug-in would respond by loading its data through the given interface pointer. If the plug-in has references to other sub components, the system will automatically call Load() on the sub-components.

Save()

This method is called when a 3ds max file itself is being saved. The plug-in would respond by saving its data through the given interface pointer.