Weak References
 
 
 

The weak direct reference represents simply the observer relationship with no additional semantics (e.g. lifetime management). Weak direct references do not prevent reference targets from being removed from a scene.

A reference maker informs 3ds Max that a reference is weak, by returning FALSE in the implementation ReferenceMaker::IsRealDependency() for the specified reference target.

If the method ReferenceMaker::ShouldPersistWeakRef() returns FALSE, which it does by default, saving or loading the reference maker does not force the target to be saved or loaded. If the target is a weak reference and ReferenceMaker::ShouldPersistWeakRef() returns FALSE, it is still possible that the target will be saved or loaded due to other references. Int his case, the weak reference link between the maker and the target will be retained.

Weak references would normally not force a save or load of the reference target when the maker is saved or loaded. If the target is a weak reference, and ReferenceMaker::ShouldPersistWeakRef() returns TRUE, it is possible that on reloading the saved file that the reference maker will hold the only reference to the target. If something else temporarily creates a direct reference to the target, the target will be deleted when that reference is dropped. From the user's perspective, this will seem to be a randomly occurring event. Also, if a maker holds the target as a weak reference, most of the time there is no way via the maker to view the user interface for the target. For example, consider a case where a weak reference is held to the parameter block of another object. If the object "owning" the parameter block is not also loaded, there is no way to display the UI for the parameter block. Typical cases where an implementation of ReferenceMaker::ShouldPersistWeakRef() would return true is when post-load callbacks are used to check and process the references, checking for things like ownerless parameter blocks.