FEntityManager

Top-level manager class that is responsible for all entity data and interaction/

Windows
MacOS
Linux

Inheritance Hierarchy

References

Module

MovieScene

Header

/Engine/Source/Runtime/MovieScene/Public/EntitySystem/MovieSceneEntityManager.h

Include

#include "EntitySystem/MovieSceneEntityManager.h"

Syntax

class FEntityManager : public FUObjectArray::FUObjectDeleteListener

Remarks

Top-level manager class that is responsible for all entity data and interaction/

An entity is a stable index into the manager's EntityLocations, which defines the location for that entity's data. This allows the manager to relocate entity data at will without invalidating client held entity IDs. An entity may contain 0 or more components. Components are concrete pieces of data with a unique type identifier. Additionally, tags can be added to entities or whole batches of entities with zero memory overhead.

Entity Component data is stored in allocations organized by each unique combination of components. Each component type is stored as a contiguous array within each allocation, with each entity's component being a fixed offset from the start of each component array. This enables efficient read/write access into specific component arrays and makes issuing parallel tasks that require component data trivial. See FEntityAllocation for a more detailed explanation of entity component data layout.

Constructors

Name Description

Public function

FEntityManager()

Public function

FEntityManager

(
    const FEntityManager&
)

Public function

FEntityManager

(
    FEntityManager&&
)

Destructors

Name Description

Public function

~FEntityManager()

Functions

Name Description

Public function Const

void

 

AccumulateMask

(
    const FEntityComponentFilter& InFi...,
    FComponentMask& OutMask
)

Accumulate a mask from all entity types that match the specified filter

Public function

void

 

AddChild

(
    FMovieSceneEntityID ParentID,
    FMovieSceneEntityID ChildID
)

Set up an entity to be a child of another.

Public function

void

 

AddComponent

(
    FMovieSceneEntityID EntityID,
    FComponentTypeID ComponentTypeID,
    EEntityRecursion Recursion
)

Add the specified component value to an entity

Public function

void

 

AddComponent

(
    FMovieSceneEntityID EntityID,
    TComponentTypeID< T > ComponentType...,
    ValueType&& InValue
)

Add the specified component value to an entity

Public function

void

 

AddComponent

(
    FMovieSceneEntityID EntityID,
    FComponentTypeID ComponentTypeID
)

Add the specified component type to an entity. The component value will be default-initialized.

Public function

void

 

AddComponents

(
    FMovieSceneEntityID EntityID,
    const FComponentMask& EntityCompon...,
    EEntityRecursion Recursion
)

Add the specified components to an entity.

Public function

void

 

AddComponents

(
    FMovieSceneEntityID EntityID,
    const FComponentMask& EntityCompon...
)

Add the specified components to an entity.

Public function

void

 

AddMutualComponents()

Run through all entities in this entity manager, ensuring that all mutual components exist

Public function

void

 

AddReferencedObjects

(
    FReferenceCollector& ReferenceColl...
)

Explicitly add referenced objects from an external source.

Public function

FEntityDataL...

 

AllocateContiguousEntities

(
    const FComponentMask& EntityCompon...,
    int32* InOutNum
)

Attempt to allocate a number of entities of the same type contiguously in memory @note May allocate fewer than the desired number due to allocation capacity constraints.

Public function

FEntityInfo

 

AllocateEntity

(
    const FComponentMask& EntityCompon...
)

Allocate a single entity with the specified components

allocated components and tags.

Public function

FMovieSceneE...

 

AllocateEntity()

Allocate a new entity with no components

Public function

void

 

ChangeEntityType

(
    FMovieSceneEntityID InEntity,
    const FComponentMask& InNewMask
)

Changes the components that exist on an entity to a new mask

Public function Const

void

 

CheckCanChangeStructure()

Public function

void

 

CombineComponents

(
    FMovieSceneEntityID DestinationEnti...,
    FMovieSceneEntityID SourceEntityID,
    const FComponentMask* Optional...
)

Combine the components from one entity into another, overwriting any pre-existing component values.

Public function

void

 

Compact()

Goes through all entity data and compacts like-for-like allocations into as few allocations as possible, resulting in the optimal data layout

Public function Const

bool

 

Contains

(
    const FEntityComponentFilter& InFi...
)

Efficiently test whether this entity manager contains any allocations that match the specified filter

Public function Const

bool

 

ContainsAllComponents

(
    std::initializer_list< FComponentTy...
)

Check whether all of the specified components exist anywhere in this entity manager @note Does not check whether the components exist on the same entity, just that they are present in the manager.

Public function Const

bool

 

ContainsAnyComponent

(
    std::initializer_list< FComponentTy...
)

Check whether any entity in this manager has any of the specified components

Public function Const

bool

 

ContainsComponent

(
    FComponentTypeID ComponentTypeID
)

Check whether any entity in this manager has the specified component

Public function

bool

 

CopyComponent

(
    FMovieSceneEntityID SrcEntityID,
    FMovieSceneEntityID DstEntityID,
    FComponentTypeID ComponentTypeID
)

Copy the specified component type from an entity if it exists.

Public function

void

 

CopyComponents

(
    FMovieSceneEntityID SrcEntityID,
    FMovieSceneEntityID DstEntityID,
    const FComponentMask& ComponentsTo...
)

Copy any and all the specified component types from one entity onto another.

Public function

void

 

CountMemory

(
    FArchive& Ar,
    FMovieSceneEntityID EntityID
)

Run a serialization routine over the specified entity to approximate the memory it is using @note Does not consider per-allocation overhead such as header sizes and other per-allocation meta-data

Public function

int32

 

DefineInstancedChildInitializer

Defines a new child initializer that applies only to entities factoried within this entity manager

Public function

void

 

Destroy()

Destroy this entity manager and all the entities and components contained within it, resetting it back to its default state

Public function

void

 

DestroyInstancedChildInitializer

(
    int32 Index
)

Destroy a previously registered instanced child initializer using its index

Public function

FMovieSceneE...

 

DuplicateEntity

(
    FMovieSceneEntityID InOther
)

Duplicate an entity, by creating an exact copy with a new ID

Public function Const

void

 

EnterIteration()

Efficiently test whether this entity manager contains any allocations that match the specified filter

Public function Const

void

 

ExitIteration()

Public function

void

 

FilterComponents

(
    FMovieSceneEntityID EntityID,
    const FComponentMask& EntitiesToKe...
)

Remove all but the specified components from an entity.

Public function Static

IComponentTy...

 

FindComponentTypeHandler

(
    const FGuid& ComponentGuid
)

Find a component type hander from its registered GUID

Public function

int32

 

FreeEntities

(
    const FEntityComponentFilter& Filt...,
    TSet< FMovieSceneEntityID >* O...
)

Free all entities that match the specified filter

Public function

int32

 

FreeEntities

(
    const FFreeEntityOperation& Operat...,
    TSet< FMovieSceneEntityID >* O...
)

Free all entities defined by the specified operation

Public function

void

 

FreeEntity

(
    FMovieSceneEntityID EntityID
)

Free an entity and relinquish its entity ID

Public function Const

const FCompo...

 

GetAccumulatedMask()

Retrieve an up-to-date accumulation of all components present on entities in this manager

Public function Const

void

 

GetChildren_ParentFirst

(
    FMovieSceneEntityID ParentID,
    TArray< FMovieSceneEntityID >& Out...
)

Retrieve all children, grandchildren etc of the specified entity using a parent first traversal @note the array will not be emptied by this function - that is the responsibility of the callee, if desired.

Public function Const

FComponentRe...

 

GetComponents()

Public function Const

ENamedThread...

 

GetDispatchThread()

Public function Const

FEntityInfo

 

GetEntity

(
    FMovieSceneEntityID EntityID
)

Retrieve an entity's allocation and component offset from its ID

Public function

FEntityHandl...

 

GetEntityHandle

(
    FMovieSceneEntityID EntityID
)

Retrieve a handle to an entity

Public function Const

FComponentMa...

 

GetEntityType

(
    FMovieSceneEntityID InEntity
)

Retrieve the type mask for this component

Public function Const

ENamedThread...

 

GetGatherThread()

Public function Const

const FEntit...

 

GetGlobalIterationFilter()

Retrieve the entity filter that should be used for any entity iteration.

Public function Const

uint32

 

GetHandleGeneration()

Public function Const

void

 

GetImmediateChildren

(
    FMovieSceneEntityID ParentID,
    TArray< FMovieSceneEntityID >& Out...
)

Retrieve the immediate children of the specified entity @note the array will not be emptied by this function - that is the responsibility of the callee, if desired.

Public function Const

uint64

 

GetSystemSerial()

Get the current serial number for any system ovserving this entity manager.

Public function Const

EEntityThrea...

 

GetThreadingModel()

Compute and retrieve this entity manager's threading model

Public function Const

bool

 

HasComponent

(
    FMovieSceneEntityID EntityID,
    FComponentTypeID ComponentTypeID
)

Check whether the specified component has a component of the specified type

Public function Const

bool

 

HasStructureChangedSince

(
    uint64 CachedSerial
)

Check whether the structure of this entity manager has changed at all since the specified serial number

Public function

void

 

IncrementSystemSerial()

Increment the current serial number for systems observing this manager.

Public function

void

 

InitializeChildAllocation

(
    const FComponentMask& ParentType,
    const FComponentMask& ChildType,
    const FEntityAllocation* Paren...,
    TArrayView< const int32 > ParentAll...,
    const FEntityRange& InChildEntityR...
)

Runs all initializers for the specified parent/child allocation

Public function

void

 

InitializeMutualComponents

(
    FMovieSceneEntityID EntityID
)

Initialize a single entity using the mutual initializers

Public function Const

bool

 

IsAllocated

(
    FMovieSceneEntityID EntityID
)

Check whether an entity is allocated.

Public function Const

bool

 

IsHandleValid

(
    FEntityHandle EntityID
)

Check whether the specified entity handle is still valid

Public function Const

bool

 

IsLockedDown()

Public function Const

FEntityAlloc...

 

Iterate

(
    const FEntityComponentFilter* ...
)

Iterate through all the allocations that match the specified component filter

Public function Const

void

 

IterateChildren_ParentFirst

(
    FMovieSceneEntityID ParentID,
    IteratorType&& Iterator
)

Iterate all children, grandchildren etc of the specified entity using a parent first traversal

Public function Const

void

 

IterateImmediateChildren

(
    FMovieSceneEntityID ParentID,
    IteratorType&& Iterator
)

Itereate the immediate children of the specified entity @note the array will not be emptied by this function - that is the responsibility of the callee, if desired.

Public function

void

 

LockDown()

Public function

void

 

MimicStructureChanged()

Called in order to mimic the entity structure changing, even if it has not

Public function

FEntityCompo...

 

ModifyGlobalIterationFilter()

Modify the entity filter that should be used for any entity iteration.

Public function

int32

 

MutateAll

(
    const FEntityComponentFilter& Filt...,
    const IMovieSceneEntityMutation& M...
)

Efficiently mutate all entities that match a filter.

Public function

void

 

OverwriteEntityWithDuplicate

(
    FMovieSceneEntityID& InOutEntity,
    FMovieSceneEntityID InEntityToDupli...
)

Duplicate an entity over the top of an existing entity ID

Public function Const

TComponentLo...

 

ReadComponent

(
    FMovieSceneEntityID Entity,
    TComponentTypeID< T > ComponentType...
)

Attempt to read a component from an entity.

Public function Const

T

 

ReadComponentChecked

(
    FMovieSceneEntityID Entity,
    TComponentTypeID< T > ComponentType...
)

Read a component value from an entity that is known to exist.

Public function

void

 

ReleaseLockDown()

Public function

void

 

RemoveComponent

(
    FMovieSceneEntityID EntityID,
    FComponentTypeID ComponentTypeID
)

Remove the specified component type from an entity if it exists.

Public function

void

 

RemoveComponent

(
    FMovieSceneEntityID EntityID,
    FComponentTypeID ComponentTypeID,
    EEntityRecursion Recursion
)

Remove the specified component type from an entity if it exists.

Public function

void

 

RemoveComponents

(
    FMovieSceneEntityID EntityID,
    const FComponentMask& ComponentsTo...
)

Remove the specified components from an entity, if they exist.

Public function

void

 

RemoveComponents

(
    FMovieSceneEntityID EntityID,
    const FComponentMask& ComponentsTo...,
    EEntityRecursion Recursion
)

Remove the specified components from an entity, if they exist.

Public function

void

 

ReplaceEntityID

(
    FMovieSceneEntityID& InOutEntity,
    FMovieSceneEntityID EntityToDiscard
)

Replace an entity ID with the components from another, discarding the provided entity ID in the process

Public function

void

 

SetComponentRegistry

(
    FComponentRegistry* InComponen...
)

Public function

void

 

SetDebugName

(
    FString&& InNewDebugName
)

Set a debug name for this entity manager

Public function

void

 

SetDispatchThread

(
    ENamedThreads::Type InDispatchThrea...
)

Public function

void

 

SetGatherThread

(
    ENamedThreads::Type InGatherThread
)

Public function

void

 

TouchEntity

(
    FMovieSceneEntityID EntityID
)

Touch the specified entity, cause the allocation and component serial numbers to be incremented.

Public function

TComponentLo...

 

WriteComponent

(
    FMovieSceneEntityID Entity,
    TComponentTypeID< T > ComponentType...
)

Attempt to write to an entity's component.

Public function Const

void

 

WriteComponentChecked

(
    FMovieSceneEntityID Entity,
    TComponentTypeID< T > ComponentType...,
    ValueType&& Value
)

Write a component value that is known to exist to an entity.

Operators

Name Description

Public function

void

 

operator=

(
    FEntityManager&&
)

Public function

void

 

operator=

(
    const FEntityManager&
)

Enums

Name

Description

Private enum

ELockdownState

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey
Dismiss