UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
MovieScenePropertySystemTypes.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"
6#include "UObject/Class.h"
7#include "UObject/Object.h"
8#include "UObject/NameTypes.h"
14
15class UClass;
17
18
19namespace UE::MovieScene
20{
21
26
28{
30
35
36 int32 AsIndex() const
37 {
38 return TypeIndex;
39 }
40
41 explicit operator bool() const
42 {
43 return TypeIndex != INDEX_NONE;
44 }
45
46private:
48
49 friend class FPropertyRegistry;
50 int32 TypeIndex;
51};
52
53
54template<typename PropertyTraits>
57
58namespace Private
59{
61 template<typename, typename = void>
62 constexpr bool PropertyTraitsHaveCustomAccessorStorageType = false;
63
64 template<typename T>
65 constexpr bool PropertyTraitsHaveCustomAccessorStorageType<T, std::void_t<decltype(sizeof(typename T::CustomAccessorStorageType))>> = true;
66
68 template<typename PropertyTraits, bool Custom>
69 struct TCustomPropertyAccessorStorageTypeImpl;
70
71 template<typename PropertyTraits>
72 struct TCustomPropertyAccessorStorageTypeImpl<PropertyTraits, false>
73 {
74 using Value = typename PropertyTraits::StorageType;
75 };
76
77 template<typename PropertyTraits>
78 struct TCustomPropertyAccessorStorageTypeImpl<PropertyTraits, true>
79 {
80 using Value = typename PropertyTraits::CustomAccessorStorageType;
81 };
82
83 template<typename PropertyTraits>
84 struct TCustomPropertyAccessorStorageType : TCustomPropertyAccessorStorageTypeImpl<PropertyTraits, PropertyTraitsHaveCustomAccessorStorageType<PropertyTraits>>
85 {};
86
87 namespace Tests
88 {
90 {
92 };
93 static_assert(PropertyTraitsHaveCustomAccessorStorageType<TestNormal> == false, "Normal has no custom storage type");
94 static_assert(std::is_same_v<TCustomPropertyAccessorStorageType<TestNormal>::Value, bool>, "Normal has bool storage type");
95
97 {
100 };
101 static_assert(PropertyTraitsHaveCustomAccessorStorageType<TestCustom> == true, "Custom does have custom storage type");
102 static_assert(std::is_same_v<TCustomPropertyAccessorStorageType<TestCustom>::Value, int>, "Custom has int storage type");
103 }
104}
105
109template<typename PropertyTraits, typename MetaDataType>
111
112template<typename PropertyTraits, typename ...MetaDataTypes>
113struct TCustomPropertyAccessorFunctionsImpl<PropertyTraits, TPropertyMetaData<MetaDataTypes...>>
114{
115 using StorageType = typename Private::TCustomPropertyAccessorStorageType<PropertyTraits>::Value;
117
118 using GetterFunc = StorageType (*)(const UObject* Object, MetaDataTypes...);
119 using SetterFunc = void (*)(UObject* Object, MetaDataTypes..., ParamType Value);
120
123
126};
127
128
129template<typename PropertyTraits>
131 : TCustomPropertyAccessorFunctionsImpl<PropertyTraits, TGetPublicPropertyMetaDataT<PropertyTraits>>
132{
133};
134
146
150template<typename PropertyTraits>
161
162
164{
166 : Base(nullptr)
167 , ViewNum(0)
168 , Stride(0)
169 {}
170
171 template<typename T, typename Allocator>
173 : Base(reinterpret_cast<const uint8*>(InArray.GetData()))
174 , ViewNum(InArray.Num())
175 , Stride(sizeof(T))
176 {}
177
179 {
180 return *reinterpret_cast<const FCustomPropertyAccessor*>(Base + InIndex*Stride);
181 }
182
183 int32 Num() const
184 {
185 return ViewNum;
186 }
187
189 {
190 UClass* StopIterationAt = UObject::StaticClass();
191
192 while (ClassType != StopIterationAt)
193 {
194 for (int32 Index = 0; Index < ViewNum; ++Index)
195 {
196 const FCustomPropertyAccessor& Accessor = (*this)[Index];
197 if (Accessor.Class == ClassType && Accessor.PropertyPath == PropertyPath)
198 {
199 return Index;
200 }
201 }
202 ClassType = ClassType->GetSuperClass();
203 }
204
205 return INDEX_NONE;
206 }
207
208private:
209 const uint8* Base;
210 int32 ViewNum;
211 int32 Stride;
212};
213
214
221
222#if WITH_EDITOR
227#endif // WITH_EDITOR
228
230template<typename PropertyTraits, int InlineSize = 8>
232{
235
236 virtual FCustomAccessorView GetAccessors() const override
237 {
239 }
240
241 void Add(UClass* ClassType, FName PropertyName, GetterFunc Getter, SetterFunc Setter)
242 {
243 CustomAccessors.Add(TCustomPropertyAccessor<PropertyTraits>{ ClassType, PropertyName, { Getter, Setter } });
244#if WITH_EDITOR
246#endif
247 }
248
249 void Remove(UClass* ClassType, FName PropertyName)
250 {
251 for (int32 Index = CustomAccessors.Num()-1; Index >= 0; --Index)
252 {
254 if (Accessor.Class == ClassType && Accessor.PropertyPath == PropertyName)
255 {
256#if WITH_EDITOR
258#endif
259 // Null out the entry rather than remove it because we don't want to invalidate any cached array indices
260 Accessor.Class = nullptr;
261 Accessor.PropertyPath = NAME_None;
262 }
263 }
264 }
265
266 void RemoveAll(UClass* ClassType)
267 {
268 for (int32 Index = CustomAccessors.Num()-1; Index >= 0; --Index)
269 {
271 if (Accessor.Class == ClassType)
272 {
273#if WITH_EDITOR
275#endif
276 // Null out the entry rather than remove it because we don't want to invalidate any cached array indices
277 Accessor.Class = nullptr;
278 Accessor.PropertyPath = NAME_None;
279 }
280 }
281 }
282
283protected:
284
287};
288
297template<typename InPropertyTraits>
311
312template<typename PropertyTraits, typename MetaDataType>
314
315
316
317template<typename PropertyTraits, typename ...MetaDataTypes>
318struct TSetPropertyValuesImpl<PropertyTraits, TPropertyMetaData<MetaDataTypes...>>
319{
320 using StorageType = typename PropertyTraits::StorageType;
322
324 : Traits(InTraits)
325 , CustomProperties(InCustomProperties)
326 {
327 if (CustomProperties)
328 {
329 CustomAccessors = CustomProperties->GetAccessors();
330 }
331 }
332
343 void ForEachEntity(UObject* InObject, FCustomPropertyIndex CustomIndex, typename TCallTraits<MetaDataTypes>::ParamType... MetaData, InParamType ValueToSet) const;
344
355 void ForEachEntity(UObject* InObject, uint16 PropertyOffset, typename TCallTraits<MetaDataTypes>::ParamType... MetaData, InParamType ValueToSet) const;
356
357
368 void ForEachEntity(UObject* InObject, const TSharedPtr<FTrackInstancePropertyBindings>& PropertyBindings, typename TCallTraits<MetaDataTypes>::ParamType... MetaData, InParamType ValueToSet) const;
369
370public:
371
374
386
387
399
400private:
401
402 const PropertyTraits* Traits;
403 const ICustomPropertyRegistration* CustomProperties;
404 FCustomAccessorView CustomAccessors;
405};
406
407
434template<typename PropertyTraits>
435struct TSetPropertyValues : TSetPropertyValuesImpl<PropertyTraits, typename PropertyTraits::MetaDataType>
436{
438
440 : TSetPropertyValuesImpl<PropertyTraits, typename PropertyTraits::MetaDataType>(InTraits, InCustomProperties)
441 {}
442};
443
444
445
446
447template<typename PropertyTraits, typename MetaDataType>
449
450
451
452template<typename PropertyTraits, typename ...MetaDataTypes>
453struct TGetPropertyValuesImpl<PropertyTraits, TPropertyMetaData<MetaDataTypes...>>
454{
455 using StorageType = typename PropertyTraits::StorageType;
456
458 : Traits(InTraits)
459 , CustomProperties(InCustomProperties)
460 {
461 if (CustomProperties)
462 {
463 CustomAccessors = CustomProperties->GetAccessors();
464 }
465 }
466
477 void ForEachEntity(UObject* InObject, FCustomPropertyIndex CustomPropertyIndex, typename TCallTraits<MetaDataTypes>::ParamType... MetaData, StorageType& OutValue) const;
478
490 void ForEachEntity(UObject* InObject, uint16 PropertyOffset, typename TCallTraits<MetaDataTypes>::ParamType... MetaData, StorageType& OutValue) const;
491
503 void ForEachEntity(UObject* InObject, const TSharedPtr<FTrackInstancePropertyBindings>& PropertyBindings, typename TCallTraits<MetaDataTypes>::ParamType... MetaData, StorageType& OutValue) const;
504
505public:
506
509
510
523
524
537
538private:
539
540 const PropertyTraits* Traits;
541 const ICustomPropertyRegistration* CustomProperties;
542 FCustomAccessorView CustomAccessors;
543};
544
545
546template<typename PropertyTraits>
547struct TGetPropertyValues : TGetPropertyValuesImpl<PropertyTraits, typename PropertyTraits::MetaDataType>
548{
550 : TGetPropertyValuesImpl<PropertyTraits, typename PropertyTraits::MetaDataType>(InTraits, InCustomProperties)
551 {}
552};
553
554
555
586template<typename PropertyTraits, typename MetaDataType, typename... CompositeTypes>
588
589template<typename PropertyTraits, typename... MetaDataTypes, typename... CompositeTypes>
590struct TSetCompositePropertyValuesImpl<PropertyTraits, TPropertyMetaData<MetaDataTypes...>, CompositeTypes...>
591{
592 using StorageType = typename PropertyTraits::StorageType;
593
595 : Traits(InTraits)
596 , CustomProperties(InCustomProperties)
597 {
598 if (CustomProperties)
599 {
600 CustomAccessors = CustomProperties->GetAccessors();
601 }
602 }
603
616 void ForEachEntity(UObject* InObject, FCustomPropertyIndex CustomPropertyIndex, typename TCallTraits<MetaDataTypes>::ParamType... MetaData, typename TCallTraits<CompositeTypes>::ParamType... CompositeResults) const;
617
618
631 void ForEachEntity(UObject* InObject, uint16 PropertyOffset, typename TCallTraits<MetaDataTypes>::ParamType... MetaData, typename TCallTraits<CompositeTypes>::ParamType... CompositeResults) const;
632
633
647
648public:
649
652
653
667
668
682
683private:
684
685 const PropertyTraits* Traits;
686 const ICustomPropertyRegistration* CustomProperties;
687 FCustomAccessorView CustomAccessors;
688};
689
690template<typename PropertyTraits, typename ...CompositeTypes>
691using TSetCompositePropertyValues = TSetCompositePropertyValuesImpl<PropertyTraits, typename PropertyTraits::MetaDataType, CompositeTypes...>;
692
693
694} // namespace UE::MovieScene
OODEFFUNC typedef void(OODLE_CALLBACK t_fp_OodleCore_Plugin_Free)(void *ptr)
@ INDEX_NONE
Definition CoreMiscDefines.h:150
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
return true
Definition ExternalRpcRegistry.cpp:601
const bool
Definition NetworkReplayStreaming.h:178
auto GetData(const TStringConversion< Converter, DefaultConversionSize > &Conversion) -> decltype(Conversion.Get())
Definition StringConv.h:802
uint8_t uint8
Definition binka_ue_file_header.h:8
uint16_t uint16
Definition binka_ue_file_header.h:7
Definition NameTypes.h:617
Definition TrackInstancePropertyBindings.h:143
Definition PropertyPath.Build.cs:6
Definition Array.h:670
Definition SharedPointer.h:692
Definition ContainerAllocationPolicies.h:894
Definition StringView.h:107
Definition Class.h:3793
UClass * GetSuperClass() const
Definition Class.h:4352
Definition MovieScenePropertyRegistry.h:165
Definition Object.h:95
Definition OverriddenPropertySet.cpp:45
Definition ConstraintsManager.h:14
@ false
Definition radaudio_common.h:23
U16 Index
Definition radfft.cpp:71
TCallTraitsParamTypeHelper< T, PassByValue >::ParamType ParamType
Definition UnrealTypeTraits.h:275
Definition MovieSceneEntityIDs.h:174
Definition MovieScenePropertySystemTypes.h:28
int32 AsIndex() const
Definition MovieScenePropertySystemTypes.h:36
FCompositePropertyTypeID()
Definition MovieScenePropertySystemTypes.h:29
static FCompositePropertyTypeID FromIndex(int32 Index)
Definition MovieScenePropertySystemTypes.h:31
Definition MovieScenePropertySystemTypes.h:164
const FCustomPropertyAccessor & operator[](int32 InIndex) const
Definition MovieScenePropertySystemTypes.h:178
FCustomAccessorView()
Definition MovieScenePropertySystemTypes.h:165
FCustomAccessorView(const TArray< T, Allocator > &InArray)
Definition MovieScenePropertySystemTypes.h:172
int32 Num() const
Definition MovieScenePropertySystemTypes.h:183
int32 FindCustomAccessorIndex(UClass *ClassType, FName PropertyPath) const
Definition MovieScenePropertySystemTypes.h:188
Definition MovieScenePropertySystemTypes.h:136
FName PropertyPath
Definition MovieScenePropertySystemTypes.h:141
UClass * Class
Definition MovieScenePropertySystemTypes.h:138
FComponentTypeID AdditionalTag
Definition MovieScenePropertySystemTypes.h:144
Definition MovieScenePropertySystemTypes.h:23
uint16 Value
Definition MovieScenePropertySystemTypes.h:24
Definition MovieSceneEntitySystemTypes.h:624
Definition MovieScenePropertySystemTypes.h:216
virtual FCustomAccessorView GetAccessors() const =0
virtual ~ICustomPropertyRegistration()
Definition MovieScenePropertySystemTypes.h:217
Definition MovieScenePropertySystemTypes.h:97
bool StorageType
Definition MovieScenePropertySystemTypes.h:98
int CustomAccessorStorageType
Definition MovieScenePropertySystemTypes.h:99
Definition MovieScenePropertySystemTypes.h:90
bool StorageType
Definition MovieScenePropertySystemTypes.h:91
Definition MovieSceneEntityIDs.h:283
Definition MovieScenePropertySystemTypes.h:56
StorageType(*)(const UObject *Object, MetaDataTypes...) GetterFunc
Definition MovieScenePropertySystemTypes.h:118
typename Private::TCustomPropertyAccessorStorageType< PropertyTraits >::Value StorageType
Definition MovieScenePropertySystemTypes.h:115
void(*)(UObject *Object, MetaDataTypes..., ParamType Value) SetterFunc
Definition MovieScenePropertySystemTypes.h:119
typename TCallTraits< StorageType >::ParamType ParamType
Definition MovieScenePropertySystemTypes.h:116
Definition MovieScenePropertySystemTypes.h:110
Definition MovieScenePropertySystemTypes.h:132
Definition MovieScenePropertySystemTypes.h:152
TCustomPropertyAccessorFunctions< PropertyTraits > Functions
Definition MovieScenePropertySystemTypes.h:159
TCustomPropertyAccessor(UClass *InClass, FName InPropertyPath, const TCustomPropertyAccessorFunctions< PropertyTraits > &InFunctions)
Definition MovieScenePropertySystemTypes.h:153
Definition MovieScenePropertySystemTypes.h:232
void Add(UClass *ClassType, FName PropertyName, GetterFunc Getter, SetterFunc Setter)
Definition MovieScenePropertySystemTypes.h:241
void Remove(UClass *ClassType, FName PropertyName)
Definition MovieScenePropertySystemTypes.h:249
typename TCustomPropertyAccessorFunctions< PropertyTraits >::GetterFunc GetterFunc
Definition MovieScenePropertySystemTypes.h:233
TArray< TCustomPropertyAccessor< PropertyTraits >, TInlineAllocator< InlineSize > > CustomAccessors
Definition MovieScenePropertySystemTypes.h:286
void RemoveAll(UClass *ClassType)
Definition MovieScenePropertySystemTypes.h:266
virtual FCustomAccessorView GetAccessors() const override
Definition MovieScenePropertySystemTypes.h:236
typename TCustomPropertyAccessorFunctions< PropertyTraits >::SetterFunc SetterFunc
Definition MovieScenePropertySystemTypes.h:234
TGetPropertyValuesImpl(const PropertyTraits *InTraits, const ICustomPropertyRegistration *InCustomProperties)
Definition MovieScenePropertySystemTypes.h:457
typename PropertyTraits::StorageType StorageType
Definition MovieScenePropertySystemTypes.h:455
Definition MovieScenePropertySystemTypes.h:448
Definition MovieScenePropertySystemTypes.h:548
TGetPropertyValues(const PropertyTraits *InTraits, const ICustomPropertyRegistration *InCustomProperties)
Definition MovieScenePropertySystemTypes.h:549
Definition MovieSceneComponentPtr.h:439
Definition MovieScenePropertySystemTypes.h:299
TCompositePropertyTypeID< InPropertyTraits > CompositeID
Definition MovieScenePropertySystemTypes.h:307
typename InPropertyTraits::MetaDataType MetaDataType
Definition MovieScenePropertySystemTypes.h:300
TPropertyMetaDataComponents< typename InPropertyTraits::MetaDataType > MetaDataComponents
Definition MovieScenePropertySystemTypes.h:305
InPropertyTraits PropertyTraits
Definition MovieScenePropertySystemTypes.h:309
FComponentTypeID PropertyTag
Definition MovieScenePropertySystemTypes.h:302
TComponentTypeID< typename InPropertyTraits::StorageType > InitialValue
Definition MovieScenePropertySystemTypes.h:303
Definition MovieScenePropertyMetaData.h:15
Definition MovieScenePropertyMetaData.h:19
Definition MovieSceneComponentPtr.h:195
TSetCompositePropertyValuesImpl(const PropertyTraits *InTraits, const ICustomPropertyRegistration *InCustomProperties)
Definition MovieScenePropertySystemTypes.h:594
typename PropertyTraits::StorageType StorageType
Definition MovieScenePropertySystemTypes.h:592
Definition MovieScenePropertySystemTypes.h:587
typename PropertyTraits::StorageType StorageType
Definition MovieScenePropertySystemTypes.h:320
typename TCallTraits< typename PropertyTraits::StorageType >::ParamType InParamType
Definition MovieScenePropertySystemTypes.h:321
TSetPropertyValuesImpl(const PropertyTraits *InTraits, const ICustomPropertyRegistration *InCustomProperties)
Definition MovieScenePropertySystemTypes.h:323
Definition MovieScenePropertySystemTypes.h:313
Definition MovieScenePropertySystemTypes.h:436
TSetPropertyValues(const PropertyTraits *InTraits, const ICustomPropertyRegistration *InCustomProperties)
Definition MovieScenePropertySystemTypes.h:439
typename TCallTraits< typename PropertyTraits::StorageType >::ParamType ParamType
Definition MovieScenePropertySystemTypes.h:437
Definition MovieSceneComponentPtr.h:288