UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
MovieSceneComponentTypeInfo.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "CoreTypes.h"
12
13struct FObjectKey;
14template <typename> class TObjectKey;
15template <typename> struct TObjectPtr;
16
17namespace UE
18{
19namespace MovieScene
20{
21
22struct FNotImplemented;
24
26
31inline FNotImplemented* AddReferencedObjectForComponent(...) { return nullptr; }
32
34template<typename T>
36{
37 // Ideally this would be a compile-time check buyt
38 constexpr bool bTypeDependentFalse = !std::is_same_v<T, T>;
39 static_assert(bTypeDependentFalse, "Raw object pointers are no longer supported. Please use TObjectPtr<T> instead.");
40}
41
42template<typename T>
47
48// Hack to enable garbage collection path for object keys
51
52template<typename T>
55
56template<typename T, typename U = decltype(T::StaticStruct())>
58{
59 for (TPropertyValueIterator<const FObjectProperty> It(T::StaticStruct(), Component); It; ++It)
60 {
61 ReferenceCollector->AddReferencedObject(It.Key()->GetObjectPtrPropertyValueRef(It.Value()));
62 }
63}
64
65template<typename T>
67{
68 static constexpr bool Value = !std::is_same_v< FNotImplemented*, decltype( AddReferencedObjectForComponent((FReferenceCollector*)0, (T*)0) ) >;
69};
70
75{
77 virtual void ConstructItems(void* Dest, int32 Num) const = 0;
78 virtual void DestructItems(void* Dest, int32 Num) const = 0;
79 virtual void CopyItems(void* Dest, const void* Src, int32 Num) const = 0;
80 virtual void RelocateConstructItems(void* Dest, void* Src, int32 Num) const = 0;
82};
83
84
91{
101
104
105#if UE_MOVIESCENE_ENTITY_DEBUG
108#endif
109
115 uint8 bIsZeroConstructType : 1; // Whether TIsZeroConstructType<T> is true
116 uint8 bIsTriviallyDestructable : 1; // Whether std::is_trivially_destructible_v<T> is true
117 uint8 bIsTriviallyCopyAssignable : 1; // Whether TIsTriviallyCopyAssignable<T> is true
118 uint8 bIsPreserved : 1; // Whether this component should be preserved when an entity containing it is replaced or overwritten
119 uint8 bIsCopiedToOutput : 1; // Whether this component should be copied to an output entity if there are now multiple contributors to the same property/state
120 uint8 bIsMigratedToOutput : 1; // Whether this component should be migrated to an output entity if there are now multiple contributors to the same property/state
121 uint8 bHasReferencedObjects : 1; // Whether this component contains any data that should be reference collected
122
126 bool IsTag() const { return Sizeof == 0; }
127
131 void ConstructItems(void* Components, int32 Num) const
132 {
134 {
135 FMemory::Memset(Components, 0, Sizeof * Num);
136 }
137 else
138 {
140 ComplexComponentOps->ConstructItems(Components, Num);
141 }
142 }
143
147 void DestructItems(void* Components, int32 Num) const
148 {
150 {
152 ComplexComponentOps->DestructItems(Components, Num);
153 }
154 }
155
159 void CopyItems(void* Dest, const void* Source, int32 Num) const
160 {
162 {
163 FMemory::Memcpy(Dest, Source, Sizeof * Num);
164 }
165 else
166 {
168 ComplexComponentOps->CopyItems(Dest, Source, Num);
169 }
170 }
171
175 void RelocateConstructItems(void* Dest, void* Source, int32 Num) const
176 {
178 {
179 FMemory::Memmove(Dest, Source, Sizeof * Num);
180 }
181 else
182 {
184 ComplexComponentOps->RelocateConstructItems(Dest, Source, Num);
185 }
186 }
187
192 {
193 if (ComplexComponentOps.IsValid())
194 {
196 }
197 }
198
202 template<typename T>
207
211 template<typename T>
216
220 template<typename T>
225
226private:
227
228 template<typename T>
229 struct TComplexComponentOpsBase : IComplexComponentOps
230 {
231 virtual void ConstructItems(void* Components, int32 Num) const
232 {
233 T* TypedComponents = static_cast<T*>(Components);
235 }
236 virtual void DestructItems(void* Components, int32 Num) const
237 {
238 T* TypedComponents = static_cast<T*>(Components);
240 }
241 virtual void CopyItems(void* Dest, const void* Source, int32 Num) const
242 {
243 T* TypedDst = static_cast<T*>(Dest);
244 const T* TypedSrc = static_cast<const T*>(Source);
245
246 while (Num-- > 0)
247 {
248 (*TypedDst++) = (*TypedSrc++);
249 }
250 }
251 virtual void RelocateConstructItems(void* Dest, void* Source, int32 Num) const
252 {
254
255 T* TypedDst = static_cast<T*>(Dest);
256 T* TypedSrc = static_cast<T*>(Source);
257
258 while (Num-- > 0)
259 {
260 new (TypedDst) T(MoveTemp(*TypedSrc));
261 TypedSrc->RelocateItemsElementTypeTypedef::~RelocateItemsElementTypeTypedef();
262
263 ++TypedDst;
264 ++TypedSrc;
265 }
266 }
267 virtual void AddReferencedObjects(FReferenceCollector& ReferenceCollector, void* ComponentStart, int32 Num)
268 {}
269 };
270 template<typename T>
271 struct TComplexComponentOps : TComplexComponentOpsBase<T>
272 {
273 virtual void AddReferencedObjects(FReferenceCollector& ReferenceCollector, void* ComponentStart, int32 Num)
274 {
275 T* ComponentData = static_cast<T*>(ComponentStart);
276 while (Num-- > 0)
277 {
279
280 ++ComponentData;
281 }
282 }
283 };
284 template<typename T>
285 struct TComplexComponentOpsCustomRefCollection : TComplexComponentOpsBase<T>
286 {
287 FComponentReferenceCollectionPtr RefCollectionPtr;
288 TComplexComponentOpsCustomRefCollection(FComponentReferenceCollectionPtr InRefCollectionPtr)
289 : RefCollectionPtr(InRefCollectionPtr)
290 {}
291
292 virtual void AddReferencedObjects(FReferenceCollector& ReferenceCollector, void* ComponentStart, int32 Num)
293 {
294 (*RefCollectionPtr)(ReferenceCollector, ComponentStart, Num);
295 }
296 };
297};
298
299
300
301} // namespace MovieScene
302} // namespace UE
OODEFFUNC typedef void(OODLE_CALLBACK t_fp_OodleCore_Plugin_Free)(void *ptr)
#define checkSlow(expr)
Definition AssertionMacros.h:332
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
FORCEINLINE void RelocateConstructItems(void *Dest, SourceElementType *Source, SizeType Count)
Definition MemoryOps.h:201
FORCEINLINE constexpr void DestructItems(ElementType *Element, SizeType Count)
Definition MemoryOps.h:81
FORCEINLINE void ConstructItems(void *Dest, const SourceElementType *Source, SizeType Count)
Definition MemoryOps.h:108
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
@ Num
Definition MetalRHIPrivate.h:234
UE_INTRINSIC_CAST UE_REWRITE constexpr std::remove_reference_t< T > && MoveTemp(T &&Obj) noexcept
Definition UnrealTemplate.h:520
uint8_t uint8
Definition binka_ue_file_header.h:8
Definition UObjectGlobals.h:2492
Definition MovieScene.Build.cs:6
Definition EnableIf.h:20
Definition ObjectKey.h:228
Definition UnrealType.h:7597
Definition UniquePtr.h:107
void AddReferencedObjectForComponent(FReferenceCollector *ReferenceCollector, FObjectComponent *ComponentData)
Definition BuiltInComponentTypes.cpp:250
void(*)(FReferenceCollector &, void *, int32) FComponentReferenceCollectionPtr
Definition MovieSceneComponentTypeInfo.h:25
Definition AdvancedWidgetsModule.cpp:13
static UE_FORCEINLINE_HINT void * Memmove(void *Dest, const void *Src, SIZE_T Count)
Definition UnrealMemory.h:109
static UE_FORCEINLINE_HINT void * Memcpy(void *Dest, const void *Src, SIZE_T Count)
Definition UnrealMemory.h:160
static UE_FORCEINLINE_HINT void * Memset(void *Dest, uint8 Char, SIZE_T Count)
Definition UnrealMemory.h:119
Definition ObjectKey.h:19
Definition ObjectPtr.h:488
Definition MovieSceneComponentTypeInfo.h:91
uint8 bIsTriviallyDestructable
Definition MovieSceneComponentTypeInfo.h:116
uint8 bIsPreserved
Definition MovieSceneComponentTypeInfo.h:118
uint8 Sizeof
Definition MovieSceneComponentTypeInfo.h:111
void MakeComplexComponentOps(FComponentReferenceCollectionPtr RefCollectionPtr)
Definition MovieSceneComponentTypeInfo.h:221
void CopyItems(void *Dest, const void *Source, int32 Num) const
Definition MovieSceneComponentTypeInfo.h:159
void MakeComplexComponentOps()
Definition MovieSceneComponentTypeInfo.h:203
void DestructItems(void *Components, int32 Num) const
Definition MovieSceneComponentTypeInfo.h:147
uint8 bHasReferencedObjects
Definition MovieSceneComponentTypeInfo.h:121
void AddReferencedObjects(FReferenceCollector &ReferenceCollector, void *ComponentStart, int32 Num) const
Definition MovieSceneComponentTypeInfo.h:191
uint8 Alignment
Definition MovieSceneComponentTypeInfo.h:113
uint8 bIsTriviallyCopyAssignable
Definition MovieSceneComponentTypeInfo.h:117
uint8 bIsMigratedToOutput
Definition MovieSceneComponentTypeInfo.h:120
void RelocateConstructItems(void *Dest, void *Source, int32 Num) const
Definition MovieSceneComponentTypeInfo.h:175
FComponentTypeInfo()
Definition MovieSceneComponentTypeInfo.h:92
TUniquePtr< IComplexComponentOps > ComplexComponentOps
Definition MovieSceneComponentTypeInfo.h:103
bool IsTag() const
Definition MovieSceneComponentTypeInfo.h:126
void ConstructItems(void *Components, int32 Num) const
Definition MovieSceneComponentTypeInfo.h:131
uint8 bIsCopiedToOutput
Definition MovieSceneComponentTypeInfo.h:119
void MakeComplexComponentOpsNoAddReferencedObjects()
Definition MovieSceneComponentTypeInfo.h:212
uint8 bIsZeroConstructType
Definition MovieSceneComponentTypeInfo.h:115
Definition MovieSceneComponentTypeInfo.h:75
virtual void AddReferencedObjects(FReferenceCollector &ReferenceCollector, void *ComponentStart, int32 Num)=0
virtual void ConstructItems(void *Dest, int32 Num) const =0
virtual ~IComplexComponentOps()
Definition MovieSceneComponentTypeInfo.h:76
virtual void DestructItems(void *Dest, int32 Num) const =0
virtual void RelocateConstructItems(void *Dest, void *Src, int32 Num) const =0
virtual void CopyItems(void *Dest, const void *Src, int32 Num) const =0
Definition MovieSceneComponentTypeInfo.h:67
static constexpr bool Value
Definition MovieSceneComponentTypeInfo.h:68