Indirect References
 
 
 

An indirect reference from a reference maker to a reference target means that the reference maker contains a member reference member, which holds a direct reference to the target. Indirect references allow limited circular reference hierarchies. This could be useful, for example, if a script and expression controller variable points to a node, where the controller is under the node in the reference hierarchy.

An example of a plug-in that uses indirect references is Ring Array. The Ring Array plug-in master controller needs to know about the nodes in the system object at the same time that the slave controllers of each node that is part of a Ring Array system object need to reference the master controller in order to react to changes in the parameters it holds. Thus, the master controller cannot reference the nodes, since they reference the slave controllers which reference the master controller. The Ring Array master controller holds indirect references to the nodes that are part of the system.

An indirect reference is implemented as an IIndirectReferenceMaker interface on a reference maker.

The member reference member is not exposed as a direct reference by the parent reference maker, as a result notifications and reference hierarchy enumerations aren't automatically performed between the parent and the member. If needed, the member passes notifications to the parent, and the parent passes enumerations to the member, in an implementation specific manner.

The reference from the member to the target must be a weak directreference. Otherwise, we could end up with undeletable "islands" ofreferences. For example, if A holds a strong reference to B, and Bholds an indirect reference to A, if the indirect reference to Awas strong, then A would never be deleted because there is alwaysat least one strong reference to it, and B would not be deletedbecause A is never deleted. If the method IIndirectReferenceMaker::ShouldPersistIndirectRef() returns FALSE,which it does by default, saving or loading the reference makerimplementing IIndirectReferenceMaker does not force the target to be saved or loaded. Thus indirectreferences would normally not be forced to save or load when themaker is saved or loaded. Typical cases where an implementation ofthis method would return true is if the indirect reference is to anode (such as in NodeTransformMonitor) or post-load callbacksare used to check and process the indirect reference. If ShouldPersistIndirectRef returns FALSE, it is possible that thetarget will be saved or loaded due to other references. In thiscase, the indirect reference link between the reference maker andthe reference target will be retained.