Reference Messages During Animation
 
 
 

When playing back an animation the messaging system is quiet (e.g. there are no change notification messages) because it is known (through validity intervals) what is changing and what is not. The exception is in the geometry pipeline where we actually use the messaging system to track caches (which multiple entities may have pointers into) as they are discarded during updating.

The message in particular is REFMSG_OBJECT_CACHE_DUMPED. Nodes need to know about this message because they hold the final object cache. However dependents on a node do not need to receive this message because it doesn't mean that the object actually changed, it just means that the location in memory where the object that results from the pipeline is stored has changed. For example, the path controller doesn't care if a cache was dumped when updating the spline which the path controller references. The shape of that spline hasn't changed therefore the path controller's result hasn't changed.

The problem is in BaseNode::NotifyRefChanged() which handles the following two messages as one combined case:

case REFMSG_OBJECT_CACHE_DUMPED:
case REFMSG_CHANGE:

Consider a node 'A' with a path controller that references node 'B' (a spline object with an animated pipeline). When updating B's object pipeline, B receives a RESMSG_OBJECT_CACHE_DUMPED message. It processes this message as it should however the message is then propagated to node B's dependents, in this case the path controller for node A. The path controller doesn't respond to RESMSG_OBJECT_CACHE_DUMPED but it is still propagated to its dependents - ultimately node A. Node A then thinks that its object's cache was dumped.

Also a side affect of the fact that BaseNode::NotifyRefChanged() handles REFMSG_CHANGE along with the cache dumped message results in a bug:

case RESMSG_OBJECT_CACHE_DUMPED:
case REFMSG_CHANGE:
  if (hTarg==tmControl) {
    InvalidateTreeTM();
    ...

The cache dumped message did come through the tmControl (because it came from the connection the path controller made (in affect) from node A to node B). The result is that if trajectory display is turned on, things get pretty slow because the trajectory for node A is constantly invalidated as the spline from node B updates.

The way to handle the problem is when receiving a RESMSG_OBJECT_CACHE_DUMPED message in a controllers, stop the propagation of the message by returning REF_STOP.