FLevelObjectsObserver

[FLevelObjectsObserver](API\Plugins\ModelingComponentsEditorOnly\Scene\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.

Choose your operating system:

Windows

macOS

Linux

Inheritance Hierarchy

FEditorUndoClient

FLevelObjectsObserver

References

Module

ModelingComponentsEditorOnly

Header

/Engine/Plugins/Runtime/MeshModelingToolset/Source/ModelingComponentsEditorOnly/Public/Scene/LevelObjectsObserver.h

Include

#include "Scene/LevelObjectsObserver.h"

Syntax

class FLevelObjectsObserver : public FEditorUndoClient

Remarks

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.

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.

Variables

Name Description

Protected variable

TSet< AActor &#...

 

Actors

Public variable

FActorAddRemove...

 

OnActorAdded

OnActorAdded is emitted when a new Actor is detected

Protected variable

FDelegateHandle

 

OnActorAddedHandle

Protected variable

FDelegateHandle

 

OnActorDeletedHandle

Protected variable

FDelegateHandle

 

OnActorListChangedHandle

Public variable

FActorAddRemove...

 

OnActorRemoved

OnActorRemoved is emitted when an existing Actor is destroyed.

Protected variable

UWorld *

 

World

Functions

Name Description

Protected function

void

 

HandleActorAddedEvent

(
    AActor* Actor
)

Protected function

void

 

HandleActorDeletedEvent

(
    AActor* Actor
)

Public function

void

 

Initialize

(
    UWorld* WorldIn
)

Begin watching WorldIn. This will emit OnActorAdded for all Actors in the World.

Protected function

void

 

OnUntrackedLevelChange()

Public function

void

 

Shutdown()

Stop watching WorldIn.

Overridden from FEditorUndoClient

Name Description

Public function Virtual

void

 

PostRedo

(
    bool bSuccess
)

Signal that client should run any PostRedo code

Public function Virtual

void

 

PostUndo

(
    bool bSuccess
)

FEditorUndoClient implementation.

Typedefs

Name

Description

FActorAddRemoveSignature