Responding to Node Deletion
 
 
 

Nodes may be deleted by the user by selecting the node and pressing the delete key. If an item has a reference to the node the user may still delete it. The reference maker that references the deleted node will receive the message REFMSG_TARGET_DELETED via ReferenceMaker::NotifyRefChanged(), so that it can respond appropriately to the deletion.

Alternatively, to respond to the deletion of a node you could register a notification callback with the Broadcast Notification System. To respond to node deletion you can handle the notifications NOTIFY_SCENE_PRE_DELETED_NODE or NOTIFY_SCENE_POST_DELETED_NODE. These messages are sent with a callParam containing a Tab<INode*>. The following snippet demonstrates the process of registered a callback to handle the NOTIFY_SCENE_PRE_DELETED_NODE message.

//Declare the callback function  
static void NodeDeleteNotify(void *param, NotifyInfo *info){
  // Get the nodes being deleted
  Tab<INode *> *tNode = (Tab<INode*>)(info->callParam);
  
  // Do custom processing
   ...
}
 
// Register the callback
RegisterNotification(NodeDeleteNotify, this, NOTIFY_SCENE_PRE_DELETED_NODE);
 
...
 
// When done, unregister the callback
UnRegisterNotification(NodeDeleteNotify, this, NOTIFY_SCENE_PRE_DELETED_NODE);