10#define UE_API MASSENTITY_API
12#define UE_CHECK_OWNER_THREADID() checkf(OwnerThreadId == FPlatformTLS::GetCurrentThreadId(), TEXT("%hs: all FObserverLock operations are expected to be run in a single thread"), __FUNCTION__)
17 struct FProcessingContext;
18 namespace ObserverManager
21 UE_DEPRECATED(5.7,
"The type is no longer being used, replaced by EMassObservedOperation")
24 Add =
static_cast<uint8>(EMassObservedOperation::Add),
25 Remove =
static_cast<uint8>(EMassObservedOperation::Remove),
49 template<
typename TComposition>
57 template<
typename TComposition,
typename TEntities>
65 template<
typename TEntities>
149 if (
A.GetIndex() ==
B.GetIndex())
151 switch (
A.GetIndex())
153 case FCompositionDescription::IndexOfType<FEmptyComposition>():
155 case FCompositionDescription::IndexOfType<FMassArchetypeCompositionDescriptor>():
157 case FCompositionDescription::IndexOfType<FMassFragmentBitSet>():
159 case FCompositionDescription::IndexOfType<FMassTagBitSet>():
169 template<
typename TEntities>
227 return WeakEntityManager;
232 ensureMsgf(CreationHandle == CreationNotificationIndex,
TEXT(
"Given creation handle doesn't match this Lock's data"));
233 checkf(BufferedNotifications.IsValidIndex(CreationHandle),
TEXT(
"Given CreationHandle doesn't match stored notifications"));
234 BufferedNotifications[CreationHandle].DirtyAffectedEntities();
239 ensureMsgf(CreationHandle == CreationNotificationIndex,
TEXT(
"Given creation handle doesn't match this Lock's data"));
240 checkf(BufferedNotifications.IsValidIndex(CreationHandle),
TEXT(
"Given CreationHandle doesn't match stored notifications"));
242 return BufferedNotifications[CreationHandle];
248 int32 GetOrCreateCreationNotification()
254 CreationNotificationIndex = BufferedNotifications.Num();
259 return CreationNotificationIndex;
262 bool ReleaseCreationNotification(FCreationNotificationHandle CreationHandle)
265 checkf(BufferedNotifications.IsValidIndex(CreationHandle),
TEXT(
"Given CreationHandle doesn't match stored notifications"));
274 ensureMsgf(CreationHandle == CreationNotificationIndex,
TEXT(
"Given creation handle doesn't match this Lock's data"));
283 CreationNotificationIndex = BufferedNotifications.Num();
285 , FBufferedNotification::FEmptyComposition{}
290 BufferedNotifications[CreationNotificationIndex].AddHandle(
CreatedEntity);
293 return CreationNotificationIndex;
301 CreationNotificationIndex = BufferedNotifications.Num();
303 , FBufferedNotification::FEmptyComposition{}
308 BufferedNotifications[CreationNotificationIndex].AppendEntities(
InCreatedEntities);
311 return CreationNotificationIndex;
319 CreationNotificationIndex = BufferedNotifications.Num();
328 return CreationNotificationIndex;
337 CreationNotificationIndex = BufferedNotifications.Num();
339 , FBufferedNotification::FEmptyComposition{}
344 BufferedNotifications[CreationNotificationIndex].AppendEntities<T>(
InEntityCollection);
347 return CreationNotificationIndex;
350 template<
typename TEntities>
363 if (BufferedNotifications.Num()
364 && BufferedNotifications.Last().Type == OperationType
377 UE_API void ForceUpdateCurrentThreadID();
394 #if WITH_MASSENTITY_DEBUG
414 UE_DEPRECATED(5.6,
"Use the other GetEntityCollections flavor insteand")
420 UE_DEPRECATED(5.6,
"Manually adding entities directly to the creation context is not longer supported and is not taking place automatically")
422 UE_DEPRECATED(5.6,
"Manually adding entities directly to the creation context is not longer supported and is not taking place automatically")
424 UE_DEPRECATED(5.5,
"This constructor is now deprecated and defunct. Use one of the others instead.")
426 UE_DEPRECATED(5.5,
"This function is now deprecated since FEntityCreationContext can contain more than a single collection now. Use GetEntityCollections instead.")
435 Lock->MarkCreationNotificationDirty(CreationHandle);
457 return CreationHandle.IsSet();
462 FCreationNotificationHandle CreationHandle;
467#undef UE_CHECK_OWNER_THREADID
OODEFFUNC typedef void(OODLE_CALLBACK t_fp_OodleCore_Plugin_Free)(void *ptr)
#define checkSlow(expr)
Definition AssertionMacros.h:332
#define ensureMsgf( InExpression, InFormat,...)
Definition AssertionMacros.h:465
#define checkf(expr, format,...)
Definition AssertionMacros.h:315
#define UE_DEPRECATED_FORGAME
Definition CoreMiscDefines.h:377
@ INDEX_NONE
Definition CoreMiscDefines.h:150
#define UE_DEPRECATED(Version, Message)
Definition CoreMiscDefines.h:302
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
@ Composition
Definition HairStrandsComposition.cpp:43
EMassObservedOperation
Definition MassEntityTypes.h:579
#define UE_CHECK_OWNER_THREADID()
Definition MassObserverNotificationTypes.h:12
#define UE_API
Definition SColorGradingComponentViewer.h:12
UE_INTRINSIC_CAST UE_REWRITE constexpr std::remove_reference_t< T > && MoveTemp(T &&Obj) noexcept
Definition UnrealTemplate.h:520
Definition SharedPointer.h:153
void Emplace(ArgTypes &&... Args)
Definition TVariant.h:211
U & Get() UE_LIFETIMEBOUND
Definition TVariant.h:146
U * TryGet() UE_LIFETIMEBOUND
Definition TVariant.h:174
Definition SharedPointer.h:1295
EObservedOperationNotification
Definition MassObserverNotificationTypes.h:23
Definition MassArchetypeData.h:21
Definition MassEntityTypes.h:74
Definition MassArchetypeTypes.h:93
EDuplicatesHandling
Definition MassArchetypeTypes.h:147
@ NoDuplicates
Definition MassArchetypeTypes.h:148
Definition MassEntityHandle.h:13
Definition MassEntityManager.h:96
Definition MassObserverManager.h:67
Definition MassEntityCollection.h:26
MASSENTITY_API void AddHandle(FMassEntityHandle Handle)
Definition MassEntityCollection.cpp:64
Definition MassObserverNotificationTypes.h:41
Definition MassObserverNotificationTypes.h:39
void DirtyAffectedEntities()
Definition MassObserverNotificationTypes.h:139
FCompositionDescription CompositionChange
Definition MassObserverNotificationTypes.h:45
FBufferedNotification(const EMassObservedOperation InType, TComposition &&Composition, FEntitiesContainer &&Entities)
Definition MassObserverNotificationTypes.h:50
static bool AreCompositionsEqual(const FCompositionDescription &A, const FCompositionDescription &B)
Definition MassObserverNotificationTypes.h:147
void AppendEntities(const TConstArrayView< FMassEntityHandle > InEntityHandles)
Definition MassObserverNotificationTypes.h:100
void AppendEntities(const TConstArrayView< FMassEntityHandle > InEntityHandles, FMassArchetypeEntityCollection &&EntityCollection)
Definition MassObserverNotificationTypes.h:112
EMassObservedOperation Type
Definition MassObserverNotificationTypes.h:43
void AppendEntities(const FMassEntityHandle EntityHandle)
Definition MassObserverNotificationTypes.h:95
FBufferedNotification(const EMassObservedOperation InType, TComposition &&Composition, TEntities &&Entities)
Definition MassObserverNotificationTypes.h:58
TVariant< FEmptyComposition, FMassArchetypeCompositionDescriptor, FMassFragmentBitSet, FMassTagBitSet > FCompositionDescription
Definition MassObserverNotificationTypes.h:44
bool IsCreationNotification() const
Definition MassObserverNotificationTypes.h:80
void AppendEntities(T &&InEntityCollection)
Definition MassObserverNotificationTypes.h:127
void AddHandle(const FMassEntityHandle EntityHandle)
Definition MassObserverNotificationTypes.h:85
FBufferedNotification(const EMassObservedOperation InType, FCompositionDescription &&Composition, const FMassArchetypeEntityCollection &Entities)
Definition MassObserverNotificationTypes.h:73
FBufferedNotification(const EMassObservedOperation InType, FCompositionDescription &&Composition, TEntities &&Entities)
Definition MassObserverNotificationTypes.h:66
FEntitiesContainer AffectedEntities
Definition MassObserverNotificationTypes.h:47
Definition MassObserverNotificationTypes.h:404
UE_API void AppendEntities(const TConstArrayView< FMassEntityHandle >)
Definition MassObserverManager.cpp:949
UE_API const FMassArchetypeEntityCollection & GetEntityCollection() const
Definition MassObserverManager.cpp:961
static UE_API TSharedRef< FCreationContext > DebugCreateDummyCreationContext()
Definition MassObserverNotificationTypes.cpp:70
UE_API bool DebugAreEntityCollectionsUpToDate() const
Definition MassObserverNotificationTypes.cpp:101
UE_API bool IsDirty() const
Definition MassObserverManager.cpp:944
UE_API ~FCreationContext()
Definition MassObserverNotificationTypes.cpp:59
UE_API TConstArrayView< FMassArchetypeEntityCollection > GetEntityCollections() const
Definition MassObserverManager.cpp:934
UE_API int32 GetSpawnedNum() const
Definition MassObserverManager.cpp:939
void MarkDirty()
Definition MassObserverNotificationTypes.h:433
Definition MassObserverNotificationTypes.h:183
bool IsSet() const
Definition MassObserverNotificationTypes.h:184
Definition MassObserverNotificationTypes.h:221
TWeakPtr< FMassEntityManager > GetWeakEntityManager() const
Definition MassObserverNotificationTypes.h:225
UE_API ~FObserverLock()
Definition MassObserverNotificationTypes.cpp:32
const FBufferedNotification & GetCreationNotification(FCreationNotificationHandle CreationHandle) const
Definition MassObserverNotificationTypes.h:237
void MarkCreationNotificationDirty(FCreationNotificationHandle CreationHandle)
Definition MassObserverNotificationTypes.h:230