Describes how observers are notified of tree changes
The core of VRTree implements the Observer pattern to perform change subscription / notification. Node instances can be observed, meaning that callback functions are called in repsonse to changes to the tree structure or other node data.
The following observed events are exposed by the C API:
Called immediately when a node is created
Called immediately when a node is destroyed. Note that deleting nodes usually puts them in the recycle bin, which does not trigger this event.
Property Value Change
Called during the next notify traversal (not immediately) when a property of a node changes. Multiple property changes are queued up into a single call to this callback, and the VRIsDirty function is used to determine whether a particular property has changed. It is important that this callback does not directly make further property modifications, as those may be missed by other observers that had already been notified during this traversal.
Called immediately when a node is renamed
Node Child Added
Called immediately when a node is added as a child of the observed node
Node Child Removed
Called immediately when a node is removed as a child of the observed node
Node Parent Change
Called immediately when a node's parent changes (i.e. when the observed node is moved somewhere else in the tree)
The Lua API (and by extension the C API via FFI) provides some additional observers to respond to internal scenegraph events, monitoring world transform and world enabled state of assemblies.
This is discussed in this article: Lua Observers