Defines a class for monitoring a ReferenceTarget.
Defines a class for monitoring a ReferenceTarget by holding a weak reference to it (IsRealDependency returns false) and passing NotifyRefChanged messages to the owner of the class instance. The owner would create an instance of this class passing itself as the owner and the ReferenceTarget to watch as the target. The owner must derive from IRefTargMonitor, and would typically derive from IIndirectReferenceMaker. If the owner derives from IIndirectReferenceMaker, during scene load IIndirectReferenceMaker::SetIndirectReference is called to set the indirect reference. Thus, you wouldn't normally call this class's Save or Load methods from the owner if it derives from IRefTargMonitor.
#include <IRefTargMonitor.h>
Public Member Functions |
|
CoreExport Class_ID | ClassID () |
Retrieves a constant that uniquely
identifies the plugin class. |
|
CoreExport | RefTargMonitorRefMaker (IRefTargMonitor &myOwner, RefTargetHandle theTarget=NULL) |
Constructor for class instances. |
|
CoreExport void | SetRef (RefTargetHandle theTarget) |
Set the object being watched. |
|
CoreExport RefTargetHandle | GetRef () |
Get the object being watched. |
|
IOResult | Save (ISave *isave) |
Save a pointer to the object being watched.
|
|
IOResult | Load (ILoad *iload) |
Load a pointer to the object being watched.
|
|
int | Proc (RemapDir &remap) |
The PostPatchProc used when cloning.
|
|
RefResult | NotifyRefChanged (Interval changeInt, RefTargetHandle hTarget, PartID &partID, RefMessage message) |
This method will notify the RefTargMonitorRefMaker
of changes to the watched object. |
|
int | NumRefs () |
Get the number of references instance makes.
|
|
RefTargetHandle | GetReference (int i) |
Get the indexed reference. |
|
BOOL | IsRealDependency (ReferenceTarget *rtarg) |
Specifies that this reference to the watched
object should not prevent the watched object from being deleted.
|
|
int | DoEnumDependentsImpl (DependentEnumProc *dep) |
Allows a reference target to enumerate all
references to it. |
|
void | DeleteThis () |
Delete this instance. |
|
Protected Member Functions |
|
virtual void | SetReference (int i, RefTargetHandle rtarg) |
Set the indexed reference. |
CoreExport RefTargMonitorRefMaker | ( | IRefTargMonitor & | myOwner, |
RefTargetHandle | theTarget =
NULL |
||
) |
Constructor for class instances.
myOwner | - The owner of the instance. The owner is responsible for deleting this instance. The owner must implement the IRefTargMonitor interface. |
theTarget | - The object instance to be watched. |
CoreExport Class_ID ClassID | ( | ) | [virtual] |
Retrieves a constant that uniquely identifies the plugin class.
This method must return the unique ID for the plugin class. If two ClassIDs conflict, the system will only load the first conflicting one it finds. A program (gencid.exe) is provided to generate unique class id values.
Reimplemented from Animatable.
CoreExport void SetRef | ( | RefTargetHandle | theTarget | ) |
Set the object being watched.
theTarget | - The object instance to be watched. |
CoreExport RefTargetHandle GetRef | ( | ) |
Get the object being watched.
Save a pointer to the object being watched.
The owner can call this method from its Save method it it wants to persistently watch the object across of load/save. As noted above, if the owner derives from IIndirectReferenceMaker, the owner typically would not call this method.
isave | - The ISave pointer passed to the owner's Save method. |
Reimplemented from ReferenceMaker.
Load a pointer to the object being watched.
The owner can call this method from its Load method it it wants to persistently watch the object across of load/save. The owner would create a new RefTargMonitorRefMaker setting itself as an owner, and then call this method using that instance. As noted above, if the owner derives from IIndirectReferenceMaker, the owner typically would not call this method.
iload | - The ILoad pointer passed to the owner's Load method. |
Reimplemented from ReferenceMaker.
int Proc | ( | RemapDir & | remap | ) | [virtual] |
The PostPatchProc used when cloning.
The PostPatchProc is used when cloning since the watched object may or may not have also been cloned. When the owner is cloned, it would typically create a new RefTargMonitorRefMaker pointing at the cloned watched object. At the time the owner is cloned, the watched object may not have been cloned yet, or it may not be cloned at all. The owner should check to see if the watched object has been cloned already, and set the new RefTargMonitorRefMaker to watch it if so. If not, the new RefTargMonitorRefMaker should be set to watch the original watch object, and register this proc via remap.AddPostPatchProc. This proc will check after the cloning is complete whether the watch object was cloned, and if so set the clone as the watched object. If it was not cloned, the original object will be watched by the new RefTargMonitorRefMaker.
remap | - The RemapDir passed to the owner's Clone method. |
Implements PostPatchProc.
RefResult NotifyRefChanged | ( | Interval | changeInt, |
RefTargetHandle | hTarget, | ||
PartID & | partID, | ||
RefMessage | message | ||
) | [virtual] |
This method will notify the RefTargMonitorRefMaker of changes to the watched object.
Implemented by the system. Changes to the watched object cause messages to be passed to this method, and the implementation of this method passes those messages to the owner via the owner's ProcessRefTargMonitorMsg callback
Implements ReferenceMaker.
int NumRefs | ( | ) | [virtual] |
Get the number of references instance makes.
Implemented by the system. RefTargMonitorRefMaker makes 1 reference - the watched object.
Reimplemented from ReferenceMaker.
RefTargetHandle GetReference | ( | int | i | ) | [virtual] |
Get the indexed reference.
Implemented by the system. The watched object should be accessed via GetRef and SetRef. This method is used by the system.
Reimplemented from ReferenceMaker.
virtual void SetReference | ( | int | i, |
RefTargetHandle | rtarg | ||
) | [protected, virtual] |
Set the indexed reference.
Implemented by the system. Sets the watched object. The watched object should be accessed via GetRef and SetRef. This method is used by the system.
Reimplemented from ReferenceMaker.
BOOL IsRealDependency | ( | ReferenceTarget * | rtarg | ) | [virtual] |
Specifies that this reference to the watched object should not prevent the watched object from being deleted.
Implemented by the system.
Reimplemented from ReferenceMaker.
int DoEnumDependentsImpl | ( | DependentEnumProc * | dep | ) | [virtual] |
Allows a reference target to enumerate all references to it.
Implemented by the system. This method allows a reference target to enumerate all references to it. The implementation of this method passes the DependentEnumProc to the owner via the owner's ProcessEnumDependents callback.
Reimplemented from ReferenceMaker.
void DeleteThis | ( | ) | [virtual] |