Weak References To Nodes in the Expression/Script Controller

This feature is available in 3ds Max 8 and higher

Two new classes have been implemented: NodeTransformMonitor and RefTargMonitorRefMaker classes. NodeTransformMonitor is derived from ReferenceTarget, and holds a pointer to a RefTargMonitorRefMaker, which derives from ReferenceMaker.

RefTargMonitorRefMaker holds a reference to the node, and passes notification messages to the NodeTransformMonitor through a callback method. The NodeTransformMonitor just looks for REFMSG_CHANGE/PART_TM messages and passes those on to its dependents, unless a message is already being passed on. This prevents potential recursion. Since the NodeTransformMonitor doesn't hold the node as a reference, we don't have a circular reference hierachy. If object A has a NodeTransformMonitor that points at Node B, and object A is saved, Node B is also saved. Likewise on merge/xref object, loading object A will cause Node B to be loaded. Also, using NodeTransformMonitor the base object of a node can point at its owning node to get its TM changed messages.

Expression controller variables that point at nodes now use the nodeTransformMonitor class to hold the reference to the node. This will speed up scenes where expression controllers with node variables are used since only REFMSG_CHANGE/PART_TM messages are being sent to and invalidating the expression controller and its dependents. Previously, all messages from the node, not just REFMSG_CHANGE/PART_TM, would invalidate the expression controller and its dependents.

NodeTransformMonitor : ReferenceTarget

NodeTransformMonitor - superclass: ReferenceTarget; super-superclass:MAXWrapper - 2:2 - classID: #(418912514, 419643346)

NodeTransformMonitor interfaces:

Interface: INodeTransformMonitor

Properties:

.node : node : Read|Write

Get/set the node to monitor.

.forwardTransformChangeMsgs : bool : Read|Write

If true (default), node transform messages from the monitored node invalidate the dependents of the NodeTransformMonitor instance. If false, only deletion of the monitored node invalidates the dependents of the NodeTransformMonitor instance.

See also

MAXScript Language Improvements in 3ds Max 8