5#include "Containers/Map.h"
39struct FPreAnimatedObjectGroupManager;
40struct FRestoreStateParams;
41struct FRootInstanceHandle;
141template<
typename StorageTraits>
145 using KeyType =
typename StorageTraits::KeyType;
176 if constexpr (StorageTraits::NeedsInitialize)
224 Traits.RestorePreAnimatedValue(CachedData.
Key, CachedData.
Value, Params);
235 Traits.RestorePreAnimatedValue(CachedData.
Key, CachedData.
Value, Params);
468 if constexpr (StorageTraits::SupportsGrouping)
489 if constexpr(StorageTraits::SupportsGrouping)
566 return CachedData.
Value;
620 .CombineFilter(
InParams.AdditionalFilter)
621 .Iterate_PerAllocation(&
Linker->EntityManager, VisitAllocation);
641 EntityMetaData->
BeginTrackingEntity(Entry, EntityID, RootInstanceHandle, bWantsRestoreState);
684 .Iterate_PerAllocation(&
Linker->EntityManager, VisitAllocation);
726 static_assert(StorageTraits::SupportsGrouping ==
false,
"Grouped pre-animated state requires passing a group handle");
737 ensureMsgf(GroupHandle.
IsValid() || !StorageTraits::SupportsGrouping,
TEXT(
"The group handle must be valid for pre-animated state that supports grouping, and invalid if not"));
806 .Iterate_PerAllocation(&
Linker->EntityManager, VisitAllocation);
812 if constexpr(StorageTraits::SupportsReplaceObject)
824 switch (TrackingMode)
852 ensureMsgf(
false,
TEXT(
"Unsupported tracking mode, no pre-animated state caching will occur!"));
863 switch (TrackingMode)
876 ensureMsgf(Entry.
IsValid() && this->ParentExtension->MetaDataExists(Entry),
TEXT(
"PreAnimatedStateEntry has allocated storage but no metadata exists to track it."));
889 ensureMsgf(
false,
TEXT(
"Unsupported tracking mode, no pre-animated state caching will occur!"));
956template<
typename InKeyType,
typename InStorageType>
964 SavedValue.RestoreState(Key, Params);
973template<
typename KeyType,
typename StorageType>
#define check(expr)
Definition AssertionMacros.h:314
#define ensureMsgf( InExpression, InFormat,...)
Definition AssertionMacros.h:465
#define ensure( InExpression)
Definition AssertionMacros.h:464
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
return true
Definition ExternalRpcRegistry.cpp:601
UE_INTRINSIC_CAST UE_REWRITE constexpr std::remove_reference_t< T > && MoveTemp(T &&Obj) noexcept
Definition UnrealTemplate.h:520
Definition UObjectGlobals.h:2492
Definition MovieScene.Build.cs:6
Definition UnrealString.h.inl:34
Definition SortedMap.h:20
Definition SparseArray.h:524
Definition MovieSceneEntitySystemLinker.h:113
void AddReferencedObjectForComponent(FReferenceCollector *ReferenceCollector, FObjectComponent *ComponentData)
Definition BuiltInComponentTypes.cpp:250
EPreAnimatedStorageRequirement
Definition MovieScenePreAnimatedStateTypes.h:32
EPreAnimatedCaptureSourceTracking
Definition MovieScenePreAnimatedStateStorage.h:45
Definition AdvancedWidgetsModule.cpp:13
@ false
Definition radaudio_common.h:23
U16 Index
Definition radfft.cpp:71
Definition ObjectKey.h:19
Definition BuiltInComponentTypes.h:578
struct UE::MovieScene::FBuiltInComponentTypes::@1489 Tags
FComponentTypeID NeedsLink
Definition BuiltInComponentTypes.h:789
FComponentTypeID Finished
Definition BuiltInComponentTypes.h:808
FComponentTypeID Ignored
Definition BuiltInComponentTypes.h:810
TComponentTypeID< FRootInstanceHandle > RootInstanceHandle
Definition BuiltInComponentTypes.h:604
static MOVIESCENE_API FBuiltInComponentTypes * Get()
Definition BuiltInComponentTypes.cpp:667
FComponentTypeID NeedsUnlink
Definition BuiltInComponentTypes.h:790
Definition MovieSceneEntityIDs.h:40
Definition MovieSceneEntitySystemTypes.h:977
MOVIESCENE_API const FEntityAllocation * GetAllocation() const
Definition MovieSceneEntitySystemTypes.cpp:144
int32 Num() const
Definition MovieSceneEntitySystemTypes.h:813
Definition MovieSceneEntitySystemTypes.h:295
FEntityComponentFilter & All(const FComponentMask &InComponentMask)
Definition MovieSceneEntitySystemTypes.h:308
Definition MovieSceneEntitySystemTask.h:1045
Definition MovieSceneEntityIDs.h:302
Definition MovieScenePreAnimatedCaptureSources.h:115
MOVIESCENE_API void BeginTrackingEntity(const FPreAnimatedStateEntry &Entry, FMovieSceneEntityID EntityID, FRootInstanceHandle RootInstanceHandle, bool bWantsRestoreState)
Definition MovieScenePreAnimatedCaptureSources.cpp:26
Definition MovieScenePreAnimatedStateTypes.h:134
FPreAnimatedStorageIndex StorageIndex
Definition MovieScenePreAnimatedStateTypes.h:139
Definition MovieScenePreAnimatedStateTypes.h:158
FPreAnimatedStateCachedValueHandle ValueHandle
Definition MovieScenePreAnimatedStateTypes.h:162
bool IsValid() const
Definition MovieScenePreAnimatedStateTypes.h:164
Definition MovieScenePreAnimatedStateExtension.h:73
MOVIESCENE_API void AddSourceMetaData(const FPreAnimatedStateEntry &Entry)
Definition MovieScenePreAnimatedStateExtension.cpp:815
MOVIESCENE_API void EnsureMetaData(const FPreAnimatedStateEntry &Entry)
Definition MovieScenePreAnimatedStateExtension.cpp:142
bool IsCapturingGlobalState() const
Definition MovieScenePreAnimatedStateExtension.h:205
MOVIESCENE_API FPreAnimatedEntityCaptureSource * GetOrCreateEntityMetaData()
Definition MovieScenePreAnimatedStateExtension.cpp:243
MOVIESCENE_API EPreAnimatedStorageRequirement GetStorageRequirement(const FPreAnimatedStateEntry &Entry) const
Definition MovieScenePreAnimatedStateExtension.cpp:127
MOVIESCENE_API bool MetaDataExists(const FPreAnimatedStateEntry &Entry) const
Definition MovieScenePreAnimatedStateExtension.cpp:147
Definition MovieScenePreAnimatedStateStorage.h:94
@ NeedsInitialize
Definition MovieScenePreAnimatedStateStorage.h:97
@ SupportsGrouping
Definition MovieScenePreAnimatedStateStorage.h:98
@ SupportsReplaceObject
Definition MovieScenePreAnimatedStateStorage.h:99
Definition MovieScenePreAnimatedStateTypes.h:86
bool IsValid() const
Definition MovieScenePreAnimatedStateTypes.h:101
Definition MovieScenePreAnimatedStorageID.h:14
Definition MovieScenePreAnimatedStateTypes.h:42
int32 Value
Definition MovieScenePreAnimatedStateTypes.h:82
Definition MovieScenePreAnimatedStateTypes.h:19
Definition MovieSceneRestoreStateParams.h:21
Definition MovieSceneSequenceInstanceHandle.h:58
Definition IMovieScenePreAnimatedStorage.h:32
Definition MovieSceneEntityIDs.h:283
TFilteredEntityTask< T... > FilterNone(const FComponentMask &InComponentMask)
Definition MovieSceneEntitySystemTask.h:208
TFilteredEntityTask< T... > CombineFilter(const FEntityComponentFilter &InFilter)
Definition MovieSceneEntitySystemTask.h:268
Definition MovieSceneComponentTypeInfo.h:67
Definition MovieScenePreAnimatedStateStorage.h:894
bool bPersistent
Definition MovieScenePreAnimatedStateStorage.h:916
StorageType Value
Definition MovieScenePreAnimatedStateStorage.h:914
FCachedData()
Definition MovieScenePreAnimatedStateStorage.h:895
bool bInitialized
Definition MovieScenePreAnimatedStateStorage.h:915
KeyType Key
Definition MovieScenePreAnimatedStateStorage.h:913
FCachedData(const KeyType &InKey, StorageType &&InValue)
Definition MovieScenePreAnimatedStateStorage.h:906
FCachedData(const KeyType &InKey)
Definition MovieScenePreAnimatedStateStorage.h:900
Definition MovieScenePreAnimatedStateStorage.h:151
virtual ~IRestoreMask()
Definition MovieScenePreAnimatedStateStorage.h:152
virtual bool CanRestore(const KeyType &InKey) const =0
Definition MovieScenePreAnimatedStateStorage.h:143
EPreAnimatedStorageRequirement RestorePreAnimatedStateStorage(FPreAnimatedStorageIndex StorageIndex, EPreAnimatedStorageRequirement SourceRequirement, EPreAnimatedStorageRequirement TargetRequirement, const FRestoreStateParams &Params) override
Definition MovieScenePreAnimatedStateStorage.h:201
void AddReferencedObjects(FReferenceCollector &ReferenceCollector) override
Definition MovieScenePreAnimatedStateStorage.h:346
void CachePreAnimatedValuesTask(UMovieSceneEntitySystemLinker *Linker, const TaskType &InParams, TComponentTypeID< ContributorTypes >... InComponentTypes)
Definition MovieScenePreAnimatedStateStorage.h:657
FPreAnimatedStorageID GetStorageType() const override
Definition MovieScenePreAnimatedStateStorage.h:183
FPreAnimatedStateEntry MakeEntry(KeyArgs &&... InKeyArgs)
Definition MovieScenePreAnimatedStateStorage.h:484
TPreAnimatedStateStorage()
Definition MovieScenePreAnimatedStateStorage.h:157
bool IsCapturingGlobalState() const
Definition MovieScenePreAnimatedStateStorage.h:499
void BeginTrackingAndCachePreAnimatedValuesTask(UMovieSceneEntitySystemLinker *Linker, const TaskType &InParams, TComponentTypeID< ContributorTypes >... InComponentTypes)
Definition MovieScenePreAnimatedStateStorage.h:769
bool IsStorageRequirementSatisfied(FPreAnimatedStorageIndex StorageIndex, EPreAnimatedStorageRequirement StorageRequirement) const
Definition MovieScenePreAnimatedStateStorage.h:436
typename StorageTraits::KeyType KeyType
Definition MovieScenePreAnimatedStateStorage.h:145
void BeginTrackingAndCachePreAnimatedValues(UMovieSceneEntitySystemLinker *Linker, TComponentTypeID< ContributorTypes >... InComponentTypes)
Definition MovieScenePreAnimatedStateStorage.h:760
FPreAnimatedStorageID StorageID
Definition MovieScenePreAnimatedStateStorage.h:942
FPreAnimatedStateExtension * ParentExtension
Definition MovieScenePreAnimatedStateStorage.h:936
void BeginTrackingEntitiesTask(UMovieSceneEntitySystemLinker *Linker, const TaskType &InParams, TComponentTypeID< ContributorTypes >... InComponentTypes)
Definition MovieScenePreAnimatedStateStorage.h:589
typename StorageTraits::StorageType StorageType
Definition MovieScenePreAnimatedStateStorage.h:147
FPreAnimatedStateEntry FindEntry(KeyArgs &&... InKeyArgs)
Definition MovieScenePreAnimatedStateStorage.h:463
void CacheTrackedPreAnimatedValue(EPreAnimatedCaptureSourceTracking TrackingMode, ContributorTypes... Values)
Definition MovieScenePreAnimatedStateStorage.h:702
TPreAnimatedStateStorage(const TPreAnimatedStateStorage &)=delete
void AssignPreAnimatedValue(FPreAnimatedStorageIndex StorageIndex, EPreAnimatedStorageRequirement StorageRequirement, StorageType &&InNewValue)
Definition MovieScenePreAnimatedStateStorage.h:403
bool ShouldTrackCaptureSource(EPreAnimatedCaptureSourceTracking TrackingMode, KeyArgs &&... InKeyArgs)
Definition MovieScenePreAnimatedStateStorage.h:822
void TrackCaptureSource(const FPreAnimatedStateEntry &Entry, EPreAnimatedCaptureSourceTracking TrackingMode)
Definition MovieScenePreAnimatedStateStorage.h:861
TSortedMap< FPreAnimatedStorageIndex, StorageType > TransientPreAnimatedStorage
Definition MovieScenePreAnimatedStateStorage.h:933
void CachePreAnimatedValues(UMovieSceneEntitySystemLinker *Linker, TComponentTypeID< ContributorTypes >... InComponentTypes)
Definition MovieScenePreAnimatedStateStorage.h:648
const StorageType & GetCachedValue(FPreAnimatedStorageIndex StorageIndex) const
Definition MovieScenePreAnimatedStateStorage.h:557
const IRestoreMask * RestoreMask
Definition MovieScenePreAnimatedStateStorage.h:939
void BeginTrackingEntity(FMovieSceneEntityID EntityID, const bool bWantsRestoreState, FRootInstanceHandle RootInstanceHandle, ContributorTypes... InComponents)
Definition MovieScenePreAnimatedStateStorage.h:630
TSparseArray< FCachedData > PreAnimatedStorage
Definition MovieScenePreAnimatedStateStorage.h:924
StorageTraits Traits
Definition MovieScenePreAnimatedStateStorage.h:947
void ReplaceKey(FPreAnimatedStorageIndex StorageIndex, const KeyType &NewKey)
Definition MovieScenePreAnimatedStateStorage.h:545
void Initialize(FPreAnimatedStorageID InStorageID, FPreAnimatedStateExtension *InParentExtension) override
Definition MovieScenePreAnimatedStateStorage.h:171
void CachePreAnimatedValue(ContributorTypes... Values)
Definition MovieScenePreAnimatedStateStorage.h:692
const KeyType & GetKey(FPreAnimatedStorageIndex StorageIndex) const
Definition MovieScenePreAnimatedStateStorage.h:537
TPreAnimatedStateStorage(StorageTraits &&InTraits)
Definition MovieScenePreAnimatedStateStorage.h:160
bool HasEverAnimated(FPreAnimatedStorageIndex StorageIndex) const
Definition MovieScenePreAnimatedStateStorage.h:529
TPreAnimatedStateStorage & operator=(const TPreAnimatedStateStorage &)=delete
FPreAnimatedStorageIndex GetOrCreateStorageIndex(const KeyType &InKey)
Definition MovieScenePreAnimatedStateStorage.h:376
void CachePreAnimatedValue(const KeyType &InKey, OnCacheValue &&CacheCallback, EPreAnimatedCaptureSourceTracking TrackingMode=EPreAnimatedCaptureSourceTracking::CacheIfTracked)
Definition MovieScenePreAnimatedStateStorage.h:724
EPreAnimatedStorageRequirement DiscardPreAnimatedStateStorage(FPreAnimatedStorageIndex StorageIndex, EPreAnimatedStorageRequirement SourceRequirement) override
Definition MovieScenePreAnimatedStateStorage.h:303
void BeginTrackingEntities(UMovieSceneEntitySystemLinker *Linker, TComponentTypeID< ContributorTypes >... InComponentTypes)
Definition MovieScenePreAnimatedStateStorage.h:578
void SetRestoreMask(const IRestoreMask *InRestoreMask)
Definition MovieScenePreAnimatedStateStorage.h:338
FPreAnimatedStorageIndex FindStorageIndex(const KeyType &InKey) const
Definition MovieScenePreAnimatedStateStorage.h:391
TMap< KeyType, FPreAnimatedStorageIndex > KeyToStorageIndex
Definition MovieScenePreAnimatedStateStorage.h:920
void OnObjectReplaced(FPreAnimatedStorageIndex StorageIndex, const FObjectKey &OldObject, const FObjectKey &NewObject) override
Definition MovieScenePreAnimatedStateStorage.h:809
void ForciblyPersistStorage(FPreAnimatedStorageIndex StorageIndex)
Definition MovieScenePreAnimatedStateStorage.h:510
bool IsStorageInitialized(FPreAnimatedStorageIndex StorageIndex) const
Definition MovieScenePreAnimatedStateStorage.h:521
void CachePreAnimatedValue(FPreAnimatedStorageGroupHandle GroupHandle, const KeyType &InKey, OnCacheValue &&CacheCallback, EPreAnimatedCaptureSourceTracking TrackingMode=EPreAnimatedCaptureSourceTracking::CacheIfTracked)
Definition MovieScenePreAnimatedStateStorage.h:735
Definition MovieScenePreAnimatedStateStorage.h:59
EPreAnimatedCaptureSourceTracking TrackingMode
Definition MovieScenePreAnimatedStateStorage.h:61
TPreAnimatedStateTaskParams()
Definition MovieScenePreAnimatedStateStorage.h:63
FEntityComponentFilter AdditionalFilter
Definition MovieScenePreAnimatedStateStorage.h:60
Definition MovieSceneComponentPtr.h:195
Definition MovieScenePreAnimatedStateStorage.h:975
Definition MovieScenePreAnimatedStateStorage.h:958
InStorageType StorageType
Definition MovieScenePreAnimatedStateStorage.h:960
InKeyType KeyType
Definition MovieScenePreAnimatedStateStorage.h:959
void RestorePreAnimatedValue(const KeyType &Key, StorageType &SavedValue, const FRestoreStateParams &Params)
Definition MovieScenePreAnimatedStateStorage.h:962