Open 3D Engine LmbrCentral Gem API Reference 23.10.0
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
LmbrCentral::DependencyMonitor Class Reference

#include <DependencyMonitor.h>

Inherits AZ::Data::AssetBus::MultiHandler, AZ::EntityBus::MultiHandler, AZ::TransformNotificationBus::MultiHandler, ShapeComponentNotificationsBus::MultiHandler, and DependencyNotificationBus::MultiHandler.

Public Types

using EntityNotificationFunction = AZStd::function< void(const AZ::EntityId &ownerId, const AZ::EntityId &dependentId, const AZ::Aabb &dirtyRegion)>
 
using AssetNotificationFunction = AZStd::function< void(const AZ::EntityId &ownerId, const AZ::Data::AssetId &assetId)>
 

Public Member Functions

 AZ_CLASS_ALLOCATOR (DependencyMonitor, AZ::SystemAllocator)
 
 AZ_RTTI (DependencyMonitor, "{C7756A84-58D2-4171-A448-F8D3B84DF2F0}")
 
void Reset ()
 
void ConnectOwner (const AZ::EntityId &entityId)
 
void ConnectDependency (const AZ::EntityId &entityId)
 
void ConnectDependencies (const AZStd::vector< AZ::EntityId > &entityIds)
 
void ConnectDependency (const AZ::Data::AssetId &assetId)
 
void ConnectDependencies (const AZStd::vector< AZ::Data::AssetId > &assetIds)
 
void SetEntityNotificationFunction (EntityNotificationFunction entityNotificationFn)
 
void SetAssetNotificationFunction (AssetNotificationFunction assetNotificationFn)
 
void SetDefaultNotificationFunctions ()
 
void SetRegionChangedEntityNotificationFunction ()
 

Detailed Description

The DependencyMonitor is a convenience class to track multiple types of changes in entities and assets and distill the changes down to a single propagated notification that downstream listeners can handle. Specifically, it listens for the following:

  • Entity activated / deactivated
  • Transform changed
  • Shape changed
  • Asset ready / reloaded / unloaded / moved
  • Entity's dependencies changed All of those get distilled into a single notification that by default will trigger an OnCompositionChanged() message on the DependencyNotificationBus. However, this is sometimes a little too distilled, so an entity can override the notification functions to perform custom logic. For example, if the dependent entity has provided a dirty region via OnCompositionRegionChanged(), a function can be installed to examine the region and determine whether or not it should be propagated, changed, or ignored.

The documentation for this class was generated from the following files: