Most plug-ins are reference makers (i.e. derived from ReferenceMaker
). If a plug-in wants to observe an object, it is responsible for implementing functions from ReferenceMaker
for managing the reference links and to respond to reference messages from the objects it references.
A class derived from ReferenceMaker
will usually manage its observed reference targets via member variables. These member variables should be initialized to NULL in its constructor.
The following are some methods of ReferenceMaker
that must be implemented by a class that wishes to observe reference targets:
ReferenceMaker::NotifyRefChanged()
- This method is called by 3ds Max when a referenced target has sent a reference message.ReferenceTarget::NotifyDependents()
- If a plug-in wishes for its dependents to be notified of the same message it should call on itself.ReferenceMaker::NumRefs()
- Returns the number of references a maker has.ReferenceMaker::GetReference()
- Provides access to a reference maker's references. This allows 3ds Max to access a reference maker's references.ReferenceMaker::SetReference()
- Allows 3ds Max to set the reference maker's references. Normally you would not call this method directly, instead you would call ReferenceMaker::ReplaceReference()
which would call this method.ReferenceMaker::IsRealDependency()
- Indicates whether a given reference is strong or not.A reference maker is also responsible to call ReferenceTarget::NotifyDependents()
whenever it changes in ways that it can affect reference makers that depend on it. It sends a reference message that encodes the nature of the change to the dependents of the reference target. This method is implemented by 3ds Max.
ReferenceTarget
and ReferenceMaker
some functions accept the typedefs RefTargetHandle
and RefMakerHandle
:typedef ReferenceTarget* RefTargetHandle;
tyepdef ReferenceMaker* RefMakerHandle;