Navigation
API > API/Plugins > API/Plugins/ModelingComponentsEditorOnly
FLevelObjectsObserver is a utility class that tracks the active-set of Actors in a World, in the Editor, and emits events when the set changes. The goal is to guarantee that:
- OnActorAdded will be emitted when an Actor comes into existence
- OnActorRemoved will be emitted when an Actor ceases to exist (possibly after GC, though)
- these signals will be unique, ie once per Actor
This is a surprisingly complicated problem in the Editor due to the many ways that Actors might be created or destroyed, in particular via Undo/Redo.
Note that it is not possible to guarantee that OnActorRemoved() fires before an Actor is GC'd. So, listeners should maintain TWeakObjectPtr<>'s on Actors if they need to know this information.
| Name | FLevelObjectsObserver |
| Type | class |
| Header File | /Engine/Plugins/Runtime/MeshModelingToolset/Source/ModelingComponentsEditorOnly/Public/Scene/LevelObjectsObserver.h |
| Include Path | #include "Scene/LevelObjectsObserver.h" |
Syntax
class FLevelObjectsObserver : public FEditorUndoClient
Inheritance Hierarchy
- FEditorUndoClient → FLevelObjectsObserver
Destructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual ~FLevelObjectsObserver() |
Destructor. | Scene/LevelObjectsObserver.h |
Typedefs
| Name | Type | Remarks | Include Path |
|---|---|---|---|
| FActorAddRemoveSignature | TMulticastDelegate_OneParam< void, AActor * > | Scene/LevelObjectsObserver.h |
Variables
Public
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| OnActorAdded | FActorAddRemoveSignature | OnActorAdded is emitted when a new Actor is detected | Scene/LevelObjectsObserver.h | |
| OnActorRemoved | FActorAddRemoveSignature | OnActorRemoved is emitted when an existing Actor is destroyed. | Scene/LevelObjectsObserver.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
void Initialize
(
UWorld* WorldIn |
Begin watching WorldIn. This will emit OnActorAdded for all Actors in the World. | Scene/LevelObjectsObserver.h | |
virtual void PostRedo
(
bool bSuccess |
Scene/LevelObjectsObserver.h | ||
virtual void PostUndo
(
bool bSuccess |
FEditorUndoClient implementation. | Scene/LevelObjectsObserver.h | |
void Shutdown () |
Stop watching WorldIn. | Scene/LevelObjectsObserver.h |
Protected
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
void HandleActorAddedEvent
(
AActor* Actor |
Scene/LevelObjectsObserver.h | ||
void HandleActorDeletedEvent
(
AActor* Actor |
Scene/LevelObjectsObserver.h | ||
void OnUntrackedLevelChange() |
Scene/LevelObjectsObserver.h |