UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
CollectionPropertyFacade.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "UObject/NameTypes.h"
6#include "Containers/Map.h"
7#include "Math/Vector.h"
8
10
11namespace Chaos::Softs
12{
15 {
16 None = 0,
17 Enabled = 1 << 0,
18 Animatable = 1 << 1,
19 Legacy = 1 << 2,
20 Interpolable = 1 << 3,
21 Intrinsic = 1 << 4,
22 //~ Add new flags above this line
23 StringDirty = 1 << 6,
24 Dirty = 1 << 7
25 };
27
28
29 template<typename T> struct TIsWeightedType { static constexpr bool Value = false; };
30 template<> struct TIsWeightedType<bool> { static constexpr bool Value = true; };
31 template<> struct TIsWeightedType<int32> { static constexpr bool Value = true; };
32 template<> struct TIsWeightedType<float> { static constexpr bool Value = true; };
33 template<> struct TIsWeightedType<FVector3f> { static constexpr bool Value = true; };
34
36 template<typename T> struct TIsStringAndNameConvertibleType { static constexpr bool Value = false; };
37 template<> struct TIsStringAndNameConvertibleType<FString> { static constexpr bool Value = true; };
38 template<> struct TIsStringAndNameConvertibleType<const FString&> { static constexpr bool Value = true; };
39 template<> struct TIsStringAndNameConvertibleType<const WIDECHAR*> { static constexpr bool Value = true; };
40 template<> struct TIsStringAndNameConvertibleType<const ANSICHAR*> { static constexpr bool Value = true; };
41 template<> struct TIsStringAndNameConvertibleType<const UTF8CHAR*> { static constexpr bool Value = true; };
42
49 {
50 public:
53
57
60
62 CHAOS_API bool IsValid() const;
63
65 int32 Num() const { return KeyNameIndices.Num(); }
66
68 int32 GetKeyNameIndex(const FName& Key) const { const int32* const Index = KeyNameIndices.Find(Key); return Index ? *Index : INDEX_NONE; }
69 UE_DEPRECATED(5.7, "Use GetKeyNameIndex instead")
70 int32 GetKeyIndex(const FString& Key) const { const int32* const Index = KeyNameIndices.Find(FName(Key)); return Index ? *Index : INDEX_NONE; }
71
73 //~ Values access per index, fast, no check, index must be valid (0 <= KeyIndex < Num())
74 const FName& GetKeyName(int32 KeyIndex) const { return GetValue<const FName&>(KeyIndex, KeyNameArray); }
75 UE_DEPRECATED(5.7, "Use GetKeyName instead")
76 FString GetKey(int32 KeyIndex) const { return GetValue<const FName&>(KeyIndex, KeyNameArray).ToString(); }
77
78 template<typename T UE_REQUIRES(TIsWeightedType<T>::Value)>
79 T GetLowValue(int32 KeyIndex) const { return GetValue<T>(KeyIndex, LowValueArray); }
80
81 template<typename T UE_REQUIRES(TIsWeightedType<T>::Value)>
82 T GetHighValue(int32 KeyIndex) const { return GetValue<T>(KeyIndex, HighValueArray); }
83
84 template<typename T UE_REQUIRES(TIsWeightedType<T>::Value)>
85 TPair<T, T> GetWeightedValue(int32 KeyIndex) const { return MakeTuple(GetLowValue<T>(KeyIndex), GetHighValue<T>(KeyIndex)); }
86
87 FVector2f GetWeightedFloatValue(int32 KeyIndex) const { return FVector2f(GetLowValue<float>(KeyIndex), GetHighValue<float>(KeyIndex)); }
88
89 template<typename T UE_REQUIRES(TIsWeightedType<T>::Value)>
90 T GetValue(int32 KeyIndex) const { return GetLowValue<T>(KeyIndex); }
91
92 const FString& GetStringValue(int32 KeyIndex) const { return GetValue<const FString&>(KeyIndex, StringValueArray); }
93
95
96 bool IsEnabled(int32 KeyIndex) const { return HasAnyFlags(KeyIndex, ECollectionPropertyFlags::Enabled); }
97 bool IsAnimatable(int32 KeyIndex) const { return HasAnyFlags(KeyIndex, ECollectionPropertyFlags::Animatable); }
98 bool IsLegacy(int32 KeyIndex) const { return HasAnyFlags(KeyIndex, ECollectionPropertyFlags::Legacy); }
99 bool IsIntrinsic(int32 KeyIndex) const { return HasAnyFlags(KeyIndex, ECollectionPropertyFlags::Intrinsic); }
100 bool IsStringDirty(int32 KeyIndex) const { return HasAnyFlags(KeyIndex, ECollectionPropertyFlags::StringDirty); }
101 bool IsDirty(int32 KeyIndex) const { return HasAnyFlags(KeyIndex, ECollectionPropertyFlags::Dirty); }
102 bool IsInterpolable(int32 KeyIndex) const { return HasAnyFlags(KeyIndex, ECollectionPropertyFlags::Interpolable); }
103
104 //~ Values access per key
105 template<typename T UE_REQUIRES(TIsWeightedType<T>::Value)>
106 T GetLowValue(const FName& Key, const T& Default = T(0), int32* OutKeyIndex = nullptr) const
107 {
108 return SafeGet(Key, [this](int32 KeyIndex)->T { return GetLowValue<T>(KeyIndex); }, Default, OutKeyIndex);
109 }
110
111 template<typename T UE_REQUIRES(TIsWeightedType<T>::Value)>
112 T GetHighValue(const FName& Key, const T& Default = T(0), int32* OutKeyIndex = nullptr) const
113 {
114 return SafeGet(Key, [this](int32 KeyIndex)->T { return GetHighValue<T>(KeyIndex); }, Default, OutKeyIndex);
115 }
116
117 template<typename T UE_REQUIRES(TIsWeightedType<T>::Value)>
118 TPair<T, T> GetWeightedValue(const FName& Key, const T& Default = T(0), int32* OutKeyIndex = nullptr) const
119 {
120 return SafeGet(Key, [this](int32 KeyIndex)->TPair<T, T> { return GetWeightedValue<T>(KeyIndex); }, MakeTuple(Default, Default), OutKeyIndex);
121 }
122
123 FVector2f GetWeightedFloatValue(const FName& Key, const float& Default = 0.f, int32* OutKeyIndex = nullptr) const
124 {
125 return SafeGet(Key, [this](int32 KeyIndex)->FVector2f { return GetWeightedFloatValue(KeyIndex); }, FVector2f(Default), OutKeyIndex);
126 }
127
129 {
130 return SafeGet(Key, [this](int32 KeyIndex)->FVector2f { return GetWeightedFloatValue(KeyIndex); }, Default, OutKeyIndex);
131 }
132
133 template<typename T UE_REQUIRES(TIsWeightedType<T>::Value)>
134 T GetValue(const FName& Key, const T& Default = T(0), int32* OutKeyIndex = nullptr) const
135 {
136 return SafeGet(Key, [this](int32 KeyIndex)->T { return GetValue<T>(KeyIndex); }, Default, OutKeyIndex);
137 }
138
139 FString GetStringValue(const FName& Key, const FString& Default = "", int32* OutKeyIndex = nullptr) const
140 {
141 return SafeGet(Key, [this](int32 KeyIndex)->FString { return GetStringValue(KeyIndex); }, Default, OutKeyIndex);
142 }
143
145 {
146 return SafeGet(Key, [this](int32 KeyIndex)->ECollectionPropertyFlags { return GetFlags(KeyIndex); }, (ECollectionPropertyFlags)Default, OutKeyIndex);
147 }
148
149 bool IsEnabled(const FName& Key, bool bDefault = false, int32* OutKeyIndex = nullptr) const
150 {
151 return SafeGet(Key, [this](int32 KeyIndex)->bool { return IsEnabled(KeyIndex); }, bDefault, OutKeyIndex);
152 }
153
154 bool IsAnimatable(const FName& Key, bool bDefault = false, int32* OutKeyIndex = nullptr) const
155 {
156 return SafeGet(Key, [this](int32 KeyIndex)->bool { return IsAnimatable(KeyIndex); }, bDefault, OutKeyIndex);
157 }
158
159 bool IsLegacy(const FName& Key, bool bDefault = false, int32* OutKeyIndex = nullptr) const
160 {
161 return SafeGet(Key, [this](int32 KeyIndex)->bool { return IsLegacy(KeyIndex); }, bDefault, OutKeyIndex);
162 }
163
164 bool IsIntrinsic(const FName& Key, bool bDefault = false, int32* OutKeyIndex = nullptr) const
165 {
166 return SafeGet(Key, [this](int32 KeyIndex)->bool { return IsIntrinsic(KeyIndex); }, bDefault, OutKeyIndex);
167 }
168
169 bool IsStringDirty(const FName& Key, bool bDefault = false, int32* OutKeyIndex = nullptr) const
170 {
171 return SafeGet(Key, [this](int32 KeyIndex)->bool { return IsStringDirty(KeyIndex); }, bDefault, OutKeyIndex);
172 }
173
174 bool IsDirty(const FName& Key, bool bDefault = false, int32* OutKeyIndex = nullptr) const
175 {
176 return SafeGet(Key, [this](int32 KeyIndex)->bool { return IsDirty(KeyIndex); }, bDefault, OutKeyIndex);
177 }
178
179 bool IsInterpolable(const FName& Key, bool bDefault = false, int32* OutKeyIndex = nullptr) const
180 {
181 return SafeGet(Key, [this](int32 KeyIndex)->bool { return IsInterpolable(KeyIndex); }, bDefault, OutKeyIndex);
182 }
183
184 //~ Deprecated string key versions: Values access per key
185 template<typename T, typename StringType UE_REQUIRES(TIsWeightedType<T>::Value && TIsStringAndNameConvertibleType<StringType>::Value)>
186 UE_DEPRECATED(5.7, "Use FName Key version of this method")
187 T GetLowValue(const StringType Key, const T& Default = T(0), int32* OutKeyIndex = nullptr) const
188 {
189 return SafeGet(FName(Key), [this](int32 KeyIndex)->T { return GetLowValue<T>(KeyIndex); }, Default, OutKeyIndex);
190 }
191
192 template<typename T, typename StringType UE_REQUIRES(TIsWeightedType<T>::Value && TIsStringAndNameConvertibleType<StringType>::Value)>
193 UE_DEPRECATED(5.7, "Use FName Key version of this method")
194 T GetHighValue(const StringType Key, const T& Default = T(0), int32* OutKeyIndex = nullptr) const
195 {
196 return SafeGet(FName(Key), [this](int32 KeyIndex)->T { return GetHighValue<T>(KeyIndex); }, Default, OutKeyIndex);
197 }
198
199 template<typename T, typename StringType UE_REQUIRES(TIsWeightedType<T>::Value && TIsStringAndNameConvertibleType<StringType>::Value)>
200 UE_DEPRECATED(5.7, "Use FName Key version of this method")
201 TPair<T, T> GetWeightedValue(const StringType Key, const T& Default = T(0), int32* OutKeyIndex = nullptr) const
202 {
203 return SafeGet(FName(Key), [this](int32 KeyIndex)->TPair<T, T> { return GetWeightedValue<T>(KeyIndex); }, MakeTuple(Default, Default), OutKeyIndex);
204 }
205
206 template<typename StringType UE_REQUIRES(TIsStringAndNameConvertibleType<StringType>::Value)>
207 UE_DEPRECATED(5.7, "Use FName Key version of this method")
208 FVector2f GetWeightedFloatValue(const StringType Key, const float& Default = 0.f, int32* OutKeyIndex = nullptr) const
209 {
210 return SafeGet(FName(Key), [this](int32 KeyIndex)->FVector2f { return GetWeightedFloatValue(KeyIndex); }, FVector2f(Default), OutKeyIndex);
211 }
212
213 template<typename StringType UE_REQUIRES(TIsStringAndNameConvertibleType<StringType>::Value)>
214 UE_DEPRECATED(5.7, "Use FName Key version of this method")
215 FVector2f GetWeightedFloatValue(const StringType Key, const FVector2f& Default, int32* OutKeyIndex = nullptr) const
216 {
217 return SafeGet(FName(Key), [this](int32 KeyIndex)->FVector2f { return GetWeightedFloatValue(KeyIndex); }, Default, OutKeyIndex);
218 }
219
220 template<typename T, typename StringType UE_REQUIRES(TIsWeightedType<T>::Value && TIsStringAndNameConvertibleType<StringType>::Value)>
221 UE_DEPRECATED(5.7, "Use FName Key version of this method")
222 T GetValue(const StringType Key, const T& Default = T(0), int32* OutKeyIndex = nullptr) const
223 {
224 return SafeGet(FName(Key), [this](int32 KeyIndex)->T { return GetValue<T>(KeyIndex); }, Default, OutKeyIndex);
225 }
226
227 template<typename StringType UE_REQUIRES(TIsStringAndNameConvertibleType<StringType>::Value)>
228 UE_DEPRECATED(5.7, "Use FName Key version of this method")
229 FString GetStringValue(const StringType Key, const FString& Default = "", int32* OutKeyIndex = nullptr) const
230 {
231 return SafeGet(FName(Key), [this](int32 KeyIndex)->FString { return GetStringValue(KeyIndex); }, Default, OutKeyIndex);
232 }
233
234 template<typename StringType UE_REQUIRES(TIsStringAndNameConvertibleType<StringType>::Value)>
235 UE_DEPRECATED(5.7, "Use FName Key version of this method")
236 ECollectionPropertyFlags GetFlags(const StringType Key, uint8 Default = 0, int32* OutKeyIndex = nullptr) const
237 {
238 return SafeGet(FName(Key), [this](int32 KeyIndex)->ECollectionPropertyFlags { return GetFlags(KeyIndex); }, (ECollectionPropertyFlags)Default, OutKeyIndex);
239 }
240
241 template<typename StringType UE_REQUIRES(TIsStringAndNameConvertibleType<StringType>::Value)>
242 UE_DEPRECATED(5.7, "Use FName Key version of this method")
243 bool IsEnabled(const StringType Key, bool bDefault = false, int32* OutKeyIndex = nullptr) const
244 {
245 return SafeGet(FName(Key), [this](int32 KeyIndex)->bool { return IsEnabled(KeyIndex); }, bDefault, OutKeyIndex);
246 }
247
248 template<typename StringType UE_REQUIRES(TIsStringAndNameConvertibleType<StringType>::Value)>
249 UE_DEPRECATED(5.7, "Use FName Key version of this method")
250 bool IsAnimatable(const StringType Key, bool bDefault = false, int32* OutKeyIndex = nullptr) const
251 {
252 return SafeGet(FName(Key), [this](int32 KeyIndex)->bool { return IsAnimatable(KeyIndex); }, bDefault, OutKeyIndex);
253 }
254
255 template<typename StringType UE_REQUIRES(TIsStringAndNameConvertibleType<StringType>::Value)>
256 UE_DEPRECATED(5.7, "Use FName Key version of this method")
257 bool IsLegacy(const StringType Key, bool bDefault = false, int32* OutKeyIndex = nullptr) const
258 {
259 return SafeGet(FName(Key), [this](int32 KeyIndex)->bool { return IsLegacy(KeyIndex); }, bDefault, OutKeyIndex);
260 }
261
262 template<typename StringType UE_REQUIRES(TIsStringAndNameConvertibleType<StringType>::Value)>
263 UE_DEPRECATED(5.7, "Use FName Key version of this method")
264 bool IsIntrinsic(const StringType Key, bool bDefault = false, int32* OutKeyIndex = nullptr) const
265 {
266 return SafeGet(FName(Key), [this](int32 KeyIndex)->bool { return IsIntrinsic(KeyIndex); }, bDefault, OutKeyIndex);
267 }
268
269 template<typename StringType UE_REQUIRES(TIsStringAndNameConvertibleType<StringType>::Value)>
270 UE_DEPRECATED(5.7, "Use FName Key version of this method")
271 bool IsStringDirty(const StringType Key, bool bDefault = false, int32* OutKeyIndex = nullptr) const
272 {
273 return SafeGet(FName(Key), [this](int32 KeyIndex)->bool { return IsStringDirty(KeyIndex); }, bDefault, OutKeyIndex);
274 }
275
276 template<typename StringType UE_REQUIRES(TIsStringAndNameConvertibleType<StringType>::Value)>
277 UE_DEPRECATED(5.7, "Use FName Key version of this method")
278 bool IsDirty(const StringType Key, bool bDefault = false, int32* OutKeyIndex = nullptr) const
279 {
280 return SafeGet(FName(Key), [this](int32 KeyIndex)->bool { return IsDirty(KeyIndex); }, bDefault, OutKeyIndex);
281 }
282
283 template<typename StringType UE_REQUIRES(TIsStringAndNameConvertibleType<StringType>::Value)>
284 UE_DEPRECATED(5.7, "Use FName Key version of this method")
285 bool IsInterpolable(const StringType Key, bool bDefault = false, int32* OutKeyIndex = nullptr) const
286 {
287 return SafeGet(FName(Key), [this](int32 KeyIndex)->bool { return IsInterpolable(KeyIndex); }, bDefault, OutKeyIndex);
288 }
289
291 {
292 uint32 Hash = 0;
293 if (PropertyFacade.IsValid())
294 {
295 Hash = GetArrayHash(PropertyFacade.KeyNameArray.GetData(), PropertyFacade.KeyNameArray.Num(), Hash);
296 Hash = GetArrayHash(PropertyFacade.LowValueArray.GetData(), PropertyFacade.LowValueArray.Num(), Hash);
297 Hash = GetArrayHash(PropertyFacade.HighValueArray.GetData(), PropertyFacade.HighValueArray.Num(), Hash);
298 Hash = GetArrayHash(PropertyFacade.StringValueArray.GetData(), PropertyFacade.StringValueArray.Num(), Hash);
299 Hash = GetArrayHash(PropertyFacade.FlagsArray.GetData(), PropertyFacade.FlagsArray.Num(), Hash);
300 }
301 return Hash;
302 }
303
304
305 protected:
306 // No init constructor for FCollectionPropertyFacade
308
309 // Update the array views
310 CHAOS_API void UpdateArrays();
311
312 // Rebuild the search map
314
315 template<typename CallableType, typename ReturnType>
316 ReturnType SafeGet(const FName& Key, CallableType&& Callable, ReturnType Default, int32* OutKeyIndex) const
317 {
318 const int32 KeyIndex = GetKeyNameIndex(Key);
319 if (OutKeyIndex)
320 {
321 *OutKeyIndex = KeyIndex;
322 }
323 return KeyIndex != INDEX_NONE ? Callable(KeyIndex) : Default;
324 }
325
326 template<typename CallableType, typename ReturnType, typename StringKeyType UE_REQUIRES(TIsStringAndNameConvertibleType<StringKeyType>::Value)>
327 UE_DEPRECATED(5.7, "Use FName Key version of this method")
328 ReturnType SafeGet(const StringKeyType Key, CallableType&& Callable, ReturnType Default, int32* OutKeyIndex) const
329 {
330 return SafeGet(FName(Key), Callable, Default, OutKeyIndex);
331 }
332
333 template<typename T, typename ElementType>
334 CHAOS_API T GetValue(int32 KeyIndex, const TConstArrayView<ElementType>& ValueArray) const;
335
336 template <typename T>
338
340
341 // Attribute groups, predefined data member of the collection
343 static CHAOS_API const FName KeyNameName; // Property key, name to look for
344 static CHAOS_API const FName LowValueName; // Boolean, 24 bit integer (max 16777215), float, or vector value, or value of the lowest weight on the weight map if any
345 static CHAOS_API const FName HighValueName; // Boolean, 24 bit integer (max 16777215), float, or vector value of the highest weight on the weight map if any
346 static CHAOS_API const FName StringValueName; // String value, or weight map name, ...etc.
347 static CHAOS_API const FName FlagsName; // Whether this property is enabled, animatable, ...etc.
348
349 // Property Group array views
355
356 // Key to index search map
358
359 // Property collection
361
362 UE_DEPRECATED(5.7, "Use KeyNameName instead")
364 UE_DEPRECATED(5.7, "Use KeyNameArray instead")
366 UE_DEPRECATED(5.7, "Use KeyNameIndices instead")
368 };
369
378 {
379 public:
381 virtual ~FCollectionPropertyFacade() = default;
382
386
389
390 //~ Values set per index
391 template<typename T UE_REQUIRES(TIsWeightedType<T>::Value)>
392 void SetLowValue(int32 KeyIndex, const T& Value) { SetValue(KeyIndex, GetLowValueArray(), FVector3f(Value)); }
393
394 template<typename T UE_REQUIRES(TIsWeightedType<T>::Value)>
395 void SetHighValue(int32 KeyIndex, const T& Value) { SetValue(KeyIndex, GetHighValueArray(), FVector3f(Value)); }
396
397 template<typename T UE_REQUIRES(TIsWeightedType<T>::Value)>
398 void SetWeightedValue(int32 KeyIndex, const T& LowValue, const T& HighValue) { SetLowValue(KeyIndex, LowValue); SetHighValue(KeyIndex, HighValue); }
399
400 void SetWeightedFloatValue(int32 KeyIndex, const FVector2f& Value) { SetLowValue<float>(KeyIndex, Value.X); SetHighValue<float>(KeyIndex, Value.Y); }
401
402 template<typename T UE_REQUIRES(TIsWeightedType<T>::Value)>
403 void SetValue(int32 KeyIndex, const T& Value) { SetWeightedValue(KeyIndex, Value, Value); }
404
405 void SetStringValue(int32 KeyIndex, const FString& Value) { if (GetStringValueArray()[KeyIndex] != Value) { GetStringValueArray()[KeyIndex] = Value; SetStringDirty(KeyIndex); } }
406
408 CHAOS_API void SetFlags(int32 KeyIndex, ECollectionPropertyFlags Flags);
409
410 void SetEnabled(int32 KeyIndex, bool bEnabled) { EnableFlags(KeyIndex, ECollectionPropertyFlags::Enabled, bEnabled); }
411 void SetAnimatable(int32 KeyIndex, bool bAnimatable) { EnableFlags(KeyIndex, ECollectionPropertyFlags::Animatable, bAnimatable); }
412 void SetLegacy(int32 KeyIndex, bool bLegacy) { EnableFlags(KeyIndex, ECollectionPropertyFlags::Legacy, bLegacy); }
413
415 void SetIntrinsic(int32 KeyIndex) { EnableFlags(KeyIndex, ECollectionPropertyFlags::Intrinsic, true); }
416 void SetDirty(int32 KeyIndex) { EnableFlags(KeyIndex, ECollectionPropertyFlags::Dirty, true); }
417 void SetStringDirty(int32 KeyIndex) { EnableFlags(KeyIndex, ECollectionPropertyFlags::StringDirty, true); }
418 void SetInterpolable(int32 KeyIndex) { EnableFlags(KeyIndex, ECollectionPropertyFlags::Interpolable, true); }
419
420 //~ Values set per key
421 template<typename T UE_REQUIRES(TIsWeightedType<T>::Value)>
422 int32 SetLowValue(const FName& Key, const T& Value)
423 {
424 return SafeSet(Key, [this, &Value](int32 KeyIndex) { SetLowValue(KeyIndex, Value); });
425 }
426
427 template<typename T UE_REQUIRES(TIsWeightedType<T>::Value)>
428 int32 SetHighValue(const FName& Key, const T& Value)
429 {
430 return SafeSet(Key, [this, &Value](int32 KeyIndex) { SetHighValue(KeyIndex, Value); });
431 }
432
433 template<typename T UE_REQUIRES(TIsWeightedType<T>::Value)>
434 int32 SetWeightedValue(const FName& Key, const T& LowValue, const T& HighValue)
435 {
436 return SafeSet(Key, [this, &LowValue, &HighValue](int32 KeyIndex) { SetWeightedValue(KeyIndex, LowValue, HighValue); });
437 }
438
440 {
441 return SafeSet(Key, [this, &Value](int32 KeyIndex) { SetWeightedFloatValue(KeyIndex, Value); });
442 }
443
444 template<typename T UE_REQUIRES(TIsWeightedType<T>::Value)>
445 int32 SetValue(const FName& Key, const T& Value)
446 {
447 return SafeSet(Key, [this, &Value](int32 KeyIndex) { SetValue(KeyIndex, Value); });
448 }
449
450 int32 SetStringValue(const FName& Key, const FString& Value)
451 {
452 return SafeSet(Key, [this, &Value](int32 KeyIndex) { SetStringValue(KeyIndex, Value); });
453 }
454
456 {
457 return SafeSet(Key, [this, Flags](int32 KeyIndex) { SetFlags(KeyIndex, Flags); });
458 }
459
460 int32 SetEnabled(const FName& Key, bool bEnabled)
461 {
462 return SafeSet(Key, [this, bEnabled](int32 KeyIndex) { SetEnabled(KeyIndex, bEnabled); });
463 }
464
466 {
467 return SafeSet(Key, [this, bAnimatable](int32 KeyIndex) { SetAnimatable(KeyIndex, bAnimatable); });
468 }
469
470 int32 SetLegacy(const FName& Key, bool bLegacy)
471 {
472 return SafeSet(Key, [this, bLegacy](int32 KeyIndex) { SetLegacy(KeyIndex, bLegacy); });
473 }
474
477 {
478 return SafeSet(Key, [this](int32 KeyIndex) { SetIntrinsic(KeyIndex); });
479 }
480
481 int32 SetDirty(const FName& Key)
482 {
483 return SafeSet(Key, [this](int32 KeyIndex) { SetDirty(KeyIndex); });
484 }
485
487 {
488 return SafeSet(Key, [this](int32 KeyIndex) { SetStringDirty(KeyIndex); });
489 }
490
492 {
493 return SafeSet(Key, [this](int32 KeyIndex) { SetInterpolable(KeyIndex); });
494 }
495
496 //~ Deprecated string key versions: Values set per key
497 template<typename T, typename StringType UE_REQUIRES(TIsWeightedType<T>::Value && TIsStringAndNameConvertibleType<StringType>::Value)>
498 UE_DEPRECATED(5.7, "Use FName Key version of this method")
499 int32 SetLowValue(const StringType Key, const T& Value)
500 {
501 return SafeSet(FName(Key), [this, &Value](int32 KeyIndex) { SetLowValue(KeyIndex, Value); });
502 }
503
504 template<typename T, typename StringType UE_REQUIRES(TIsWeightedType<T>::Value && TIsStringAndNameConvertibleType<StringType>::Value)>
505 UE_DEPRECATED(5.7, "Use FName Key version of this method")
506 int32 SetHighValue(const StringType Key, const T& Value)
507 {
508 return SafeSet(FName(Key), [this, &Value](int32 KeyIndex) { SetHighValue(KeyIndex, Value); });
509 }
510
511 template<typename T, typename StringType UE_REQUIRES(TIsWeightedType<T>::Value && TIsStringAndNameConvertibleType<StringType>::Value)>
512 UE_DEPRECATED(5.7, "Use FName Key version of this method")
513 int32 SetWeightedValue(const StringType Key, const T& LowValue, const T& HighValue)
514 {
515 return SafeSet(FName(Key), [this, &LowValue, &HighValue](int32 KeyIndex) { SetWeightedValue(KeyIndex, LowValue, HighValue); });
516 }
517
518 template<typename StringType UE_REQUIRES(TIsStringAndNameConvertibleType<StringType>::Value)>
519 UE_DEPRECATED(5.7, "Use FName Key version of this method")
520 int32 SetWeightedFloatValue(const StringType Key, const FVector2f& Value)
521 {
522 return SafeSet(FName(Key), [this, &Value](int32 KeyIndex) { SetWeightedFloatValue(KeyIndex, Value); });
523 }
524
525 template<typename T, typename StringType UE_REQUIRES(TIsWeightedType<T>::Value && TIsStringAndNameConvertibleType<StringType>::Value)>
526 UE_DEPRECATED(5.7, "Use FName Key version of this method")
527 int32 SetValue(const StringType Key, const T& Value)
528 {
529 return SafeSet(FName(Key), [this, &Value](int32 KeyIndex) { SetValue(KeyIndex, Value); });
530 }
531
532 template<typename StringType UE_REQUIRES(TIsStringAndNameConvertibleType<StringType>::Value)>
533 UE_DEPRECATED(5.7, "Use FName Key version of this method")
534 int32 SetStringValue(const StringType Key, const FString& Value)
535 {
536 return SafeSet(FName(Key), [this, &Value](int32 KeyIndex) { SetStringValue(KeyIndex, Value); });
537 }
538
539 template<typename StringType UE_REQUIRES(TIsStringAndNameConvertibleType<StringType>::Value)>
540 UE_DEPRECATED(5.7, "Use FName Key version of this method")
541 int32 SetFlags(const StringType Key, ECollectionPropertyFlags Flags)
542 {
543 return SafeSet(FName(Key), [this, Flags](int32 KeyIndex) { SetFlags(KeyIndex, Flags); });
544 }
545
546 template<typename StringType UE_REQUIRES(TIsStringAndNameConvertibleType<StringType>::Value)>
547 UE_DEPRECATED(5.7, "Use FName Key version of this method")
548 int32 SetEnabled(const StringType Key, bool bEnabled)
549 {
550 return SafeSet(FName(Key), [this, bEnabled](int32 KeyIndex) { SetEnabled(KeyIndex, bEnabled); });
551 }
552
553 template<typename StringType UE_REQUIRES(TIsStringAndNameConvertibleType<StringType>::Value)>
554 UE_DEPRECATED(5.7, "Use FName Key version of this method")
555 int32 SetAnimatable(const StringType Key, bool bAnimatable)
556 {
557 return SafeSet(FName(Key), [this, bAnimatable](int32 KeyIndex) { SetAnimatable(KeyIndex, bAnimatable); });
558 }
559
560 template<typename StringType UE_REQUIRES(TIsStringAndNameConvertibleType<StringType>::Value)>
561 UE_DEPRECATED(5.7, "Use FName Key version of this method")
562 int32 SetLegacy(const StringType Key, bool bLegacy)
563 {
564 return SafeSet(FName(Key), [this, bLegacy](int32 KeyIndex) { SetLegacy(KeyIndex, bLegacy); });
565 }
566
568 template<typename StringType UE_REQUIRES(TIsStringAndNameConvertibleType<StringType>::Value)>
569 UE_DEPRECATED(5.7, "Use FName Key version of this method")
570 int32 SetIntrinsic(const StringType Key)
571 {
572 return SafeSet(FName(Key), [this](int32 KeyIndex) { SetIntrinsic(KeyIndex); });
573 }
574
575 template<typename StringType UE_REQUIRES(TIsStringAndNameConvertibleType<StringType>::Value)>
576 UE_DEPRECATED(5.7, "Use FName Key version of this method")
577 int32 SetDirty(const StringType Key)
578 {
579 return SafeSet(FName(Key), [this](int32 KeyIndex) { SetDirty(KeyIndex); });
580 }
581
582 template<typename StringType UE_REQUIRES(TIsStringAndNameConvertibleType<StringType>::Value)>
583 UE_DEPRECATED(5.7, "Use FName Key version of this method")
584 int32 SetStringDirty(const StringType Key)
585 {
586 return SafeSet(FName(Key), [this](int32 KeyIndex) { SetStringDirty(KeyIndex); });
587 }
588
589 template<typename StringType UE_REQUIRES(TIsStringAndNameConvertibleType<StringType>::Value)>
590 UE_DEPRECATED(5.7, "Use FName Key version of this method")
591 int32 SetInterpolable(const StringType Key)
592 {
593 return SafeSet(FName(Key), [this](int32 KeyIndex) { SetInterpolable(KeyIndex); });
594 }
595
596 CHAOS_API void ClearDirtyFlags();
598
599 protected:
600 // No init constructor for FCollectionPropertyMutableFacade
602
603 // Access to a writeable ManagedArrayCollection is protected, use an FPropertyCollectionMutableAdapter if needed to get a non const pointer
605 const TArrayView<FName>& GetKeyNameArray() { return reinterpret_cast<TArrayView<FName>&>(KeyNameArray); }
610
611 UE_DEPRECATED(5.7, "Use GetKeyNameArray instead")
612 const TArrayView<FString>& GetKeyArray()
613 {
615 return reinterpret_cast<TArrayView<FString>&>(KeyArray);
617 }
618
619 private:
620 template<typename CallableType, typename StringType UE_REQUIRES(TIsStringAndNameConvertibleType<StringType>::Value)>
621 UE_DEPRECATED(5.7, "Use FName Key version of this method")
622 int32 SafeSet(const StringType Key, CallableType&& Callable)
623 {
624 return SafeSet(FName(Key), Callable);
625 }
626
627 template<typename CallableType>
628 int32 SafeSet(const FName& Key, CallableType&& Callable)
629 {
630 const int32 KeyIndex = GetKeyNameIndex(Key);
631 if (KeyIndex != INDEX_NONE)
632 {
633 Callable(KeyIndex);
634 }
635 return KeyIndex;
636 }
637
638 template<typename T>
639 inline void SetValue(int32 KeyIndex, const TArrayView<T>& ValueArray, const T& Value);
640
641 CHAOS_API void EnableFlags(int32 KeyIndex, ECollectionPropertyFlags Flags, bool bEnable);
642
643 };
644
646 {
647 None = 0,
648 AppendNewProperties = 1 << 0,
649 UpdateExistingProperties = 1 << 1,
650 RemoveMissingProperties = 1 << 2,
652 };
654
655
661 {
662 public:
665
669
672
674 CHAOS_API void DefineSchema();
675
678 template<typename StringType UE_REQUIRES(TIsStringAndNameConvertibleType<StringType>::Value)>
679 UE_DEPRECATED(5.7, "Use FName Key version of this method")
681 {
682 return AddProperty(FName(Key), Flags);
683 }
684
686 CHAOS_API int32 AddProperty(const FName& Key, bool bEnabled, bool bAnimatable = false, bool bIntrinsic = false);
687 template<typename StringType UE_REQUIRES(TIsStringAndNameConvertibleType<StringType>::Value)>
688 UE_DEPRECATED(5.7, "Use FName Key version of this method")
689 int32 AddProperty(const StringType Key, bool bEnabled, bool bAnimatable = false, bool bIntrinsic = false)
690 {
691 return AddProperty(FName(Key), bEnabled, bAnimatable, bIntrinsic);
692 }
693
696 template<typename StringType UE_REQUIRES(TIsStringAndNameConvertibleType<StringType>::Value)>
697 UE_DEPRECATED(5.7, "Use FName Keys version of this method")
699 {
700 TArray<FName> Keys;
701 Keys.Reserve(Keys.Num());
702 for (const StringType& Key : InKeys)
703 {
704 Keys.Emplace(FName(Key));
705 }
706 return AddProperties(Keys, Flags);
707 }
708
710 CHAOS_API int32 AddProperties(const TArray<FName>& Keys, bool bEnabled, bool bAnimatable = false, bool bIntrinsic = false);
711 template<typename StringType UE_REQUIRES(TIsStringAndNameConvertibleType<StringType>::Value)>
712 UE_DEPRECATED(5.7, "Use FName Keys version of this method")
713 int32 AddProperties(const TArray<StringType>& InKeys, bool bEnabled, bool bAnimatable = false, bool bIntrinsic = false)
714 {
715 TArray<FName> Keys;
716 Keys.Reserve(Keys.Num());
717 for (const StringType& Key : InKeys)
718 {
719 Keys.Emplace(FName(Key));
720 }
721 return AddProperties(Keys, bEnabled, bAnimatable, bIntrinsic);
722 }
723
732
740
747
748 //~ Add values
749 template<typename T UE_REQUIRES(TIsWeightedType<T>::Value)>
750 inline int32 AddWeightedValue(const FName& Key, const T& LowValue, const T& HighValue, ECollectionPropertyFlags Flags = ECollectionPropertyFlags::Enabled);
751 template<typename T UE_REQUIRES(TIsWeightedType<T>::Value)>
752 inline int32 AddWeightedValue(const FName& Key, const T& LowValue, const T& HighValue, bool bEnabled, bool bAnimatable = false, bool bIntrinsic = false);
753
755 CHAOS_API int32 AddWeightedFloatValue(const FName& Key, const FVector2f& Value, bool bEnabled, bool bAnimatable, bool bIntrinsic = false);
756
757 template<typename T UE_REQUIRES(TIsWeightedType<T>::Value)>
758 int32 AddValue(const FName& Key, const T& Value, ECollectionPropertyFlags Flags = ECollectionPropertyFlags::Enabled) { return AddWeightedValue(Key, Value, Value, Flags); }
759 template<typename T UE_REQUIRES(TIsWeightedType<T>::Value)>
760 int32 AddValue(const FName& Key, const T& Value, bool bEnabled, bool bAnimatable = false) { return AddWeightedValue(Key, Value, Value, bEnabled, bAnimatable); }
761
762 CHAOS_API int32 AddStringValue(const FName& Key, const FString& Value, ECollectionPropertyFlags Flags = ECollectionPropertyFlags::Enabled);
763 CHAOS_API int32 AddStringValue(const FName& Key, const FString& Value, bool bEnabled, bool bAnimatable = false, bool bIntrinsic = false);
764
765 //~ Deprecated string key versions: Add values
766 template<typename T, typename StringType UE_REQUIRES(TIsWeightedType<T>::Value&& TIsStringAndNameConvertibleType<StringType>::Value)>
767 UE_DEPRECATED(5.7, "Use FName Key version of this method")
768 int32 AddWeightedValue(const StringType Key, const T& LowValue, const T& HighValue, ECollectionPropertyFlags Flags = ECollectionPropertyFlags::Enabled)
769 {
770 return AddWeightedValue(FName(Key), LowValue, HighValue, Flags);
771 }
772
773 template<typename T, typename StringType UE_REQUIRES(TIsWeightedType<T>::Value&& TIsStringAndNameConvertibleType<StringType>::Value)>
774 UE_DEPRECATED(5.7, "Use FName Key version of this method")
775 int32 AddWeightedValue(const StringType Key, const T& LowValue, const T& HighValue, bool bEnabled, bool bAnimatable = false, bool bIntrinsic = false)
776 {
777 return AddWeightedValue(FName(Key), LowValue, HighValue, bEnabled, bAnimatable, bIntrinsic);
778 }
779
780 template<typename StringType UE_REQUIRES(TIsStringAndNameConvertibleType<StringType>::Value)>
781 UE_DEPRECATED(5.7, "Use FName Key version of this method")
782 int32 AddWeightedFloatValue(const StringType Key, const FVector2f& Value, ECollectionPropertyFlags Flags = ECollectionPropertyFlags::Enabled)
783 {
784 return AddWeightedFloatValue(FName(Key), Value, Flags);
785 }
786
787 template<typename StringType UE_REQUIRES(TIsStringAndNameConvertibleType<StringType>::Value)>
788 UE_DEPRECATED(5.7, "Use FName Key version of this method")
789 int32 AddWeightedFloatValue(const StringType Key, const FVector2f& Value, bool bEnabled, bool bAnimatable, bool bIntrinsic = false)
790 {
791 return AddWeightedFloatValue(FName(Key), Value, bEnabled, bAnimatable, bIntrinsic);
792 }
793
794 template<typename T, typename StringType UE_REQUIRES(TIsWeightedType<T>::Value&& TIsStringAndNameConvertibleType<StringType>::Value)>
795 UE_DEPRECATED(5.7, "Use FName Key version of this method")
796 int32 AddValue(const StringType Key, const T& Value, ECollectionPropertyFlags Flags = ECollectionPropertyFlags::Enabled)
797 {
798 return AddWeightedValue(FName(Key), Value, Value, Flags);
799 }
800
801 template<typename T, typename StringType UE_REQUIRES(TIsWeightedType<T>::Value&& TIsStringAndNameConvertibleType<StringType>::Value)>
802 UE_DEPRECATED(5.7, "Use FName Key version of this method")
803 int32 AddValue(const StringType Key, const T& Value, bool bEnabled, bool bAnimatable = false)
804 {
805 return AddWeightedValue(FName(Key), Value, Value, bEnabled, bAnimatable);
806 }
807
808 template<typename StringType UE_REQUIRES(TIsStringAndNameConvertibleType<StringType>::Value)>
809 UE_DEPRECATED(5.7, "Use FName Key version of this method")
810 int32 AddStringValue(const StringType Key, const FString& Value, ECollectionPropertyFlags Flags = ECollectionPropertyFlags::Enabled)
811 {
812 return AddStringValue(FName(Key), Value, Flags);
813 }
814
815 template<typename StringType UE_REQUIRES(TIsStringAndNameConvertibleType<StringType>::Value)>
816 UE_DEPRECATED(5.7, "Use FName Key version of this method")
817 int32 AddStringValue(const StringType Key, const FString& Value, bool bEnabled, bool bAnimatable = false, bool bIntrinsic = false)
818 {
819 return AddStringValue(FName(Key), Value, bEnabled, bAnimatable, bIntrinsic);
820 }
821
822 CHAOS_API void PostSerialize(const FArchive& Ar);
823 };
824
825 template<typename T>
826 inline void FCollectionPropertyFacade::SetValue(int32 KeyIndex, const TArrayView<T>& ValueArray, const T& Value)
827 {
828 if (ValueArray[KeyIndex] != Value)
829 {
830 ValueArray[KeyIndex] = Value;
831 SetDirty(KeyIndex);
832 }
833 }
834
835 template<typename T UE_REQUIRES_DEFINITION(TIsWeightedType<T>::Value)>
837 {
838 const int32 KeyIndex = AddProperty(Key, Flags);
839 SetWeightedValue(KeyIndex, LowValue, HighValue);
840 return KeyIndex;
841 }
842
843 template<typename T UE_REQUIRES_DEFINITION(TIsWeightedType<T>::Value)>
844 inline int32 FCollectionPropertyMutableFacade::AddWeightedValue(const FName& Key, const T& LowValue, const T& HighValue, bool bEnabled, bool bAnimatable, bool bIntrinsic)
845 {
846 const int32 KeyIndex = AddProperty(Key, bEnabled, bAnimatable, bIntrinsic);
847 SetWeightedValue(KeyIndex, LowValue, HighValue);
848 return KeyIndex;
849 }
850} // End namespace Chaos
851
852// Use this macro to add shorthands for property getters without a key index
853#define UE_CHAOS_DECLARE_INDEXLESS_PROPERTYCOLLECTION_NAME(PropertyName, Type) \
854 inline static const FName PropertyName##Name = TEXT(#PropertyName); \
855 static bool Is##PropertyName##Enabled(const ::Chaos::Softs::FCollectionPropertyConstFacade& InPropertyCollection, bool bDefault) \
856 { \
857 return InPropertyCollection.IsEnabled(PropertyName##Name, bDefault); \
858 } \
859 static bool Is##PropertyName##Animatable(const ::Chaos::Softs::FCollectionPropertyConstFacade& InPropertyCollection, bool bDefault) \
860 { \
861 return InPropertyCollection.IsAnimatable(PropertyName##Name, bDefault); \
862 } \
863 static Type GetLow##PropertyName(const ::Chaos::Softs::FCollectionPropertyConstFacade& InPropertyCollection, const Type& Default) \
864 { \
865 return InPropertyCollection.GetLowValue<Type>(PropertyName##Name, Default); \
866 } \
867 static Type GetHigh##PropertyName(const ::Chaos::Softs::FCollectionPropertyConstFacade& InPropertyCollection, const Type& Default) \
868 { \
869 return InPropertyCollection.GetHighValue<Type>(PropertyName##Name, Default); \
870 } \
871 static TPair<Type, Type> GetWeighted##PropertyName(const ::Chaos::Softs::FCollectionPropertyConstFacade& InPropertyCollection, const Type& Default) \
872 { \
873 return InPropertyCollection.GetWeightedValue<Type>(PropertyName##Name, Default); \
874 } \
875 static FVector2f GetWeightedFloat##PropertyName(const ::Chaos::Softs::FCollectionPropertyConstFacade& InPropertyCollection, const float& Default) \
876 { \
877 return InPropertyCollection.GetWeightedFloatValue(PropertyName##Name, Default); \
878 } \
879 static FVector2f GetWeightedFloat##PropertyName(const ::Chaos::Softs::FCollectionPropertyConstFacade& InPropertyCollection, const FVector2f& Default) \
880 { \
881 return InPropertyCollection.GetWeightedFloatValue(PropertyName##Name, Default); \
882 } \
883 static Type Get##PropertyName(const ::Chaos::Softs::FCollectionPropertyConstFacade& InPropertyCollection, const Type& Default) \
884 { \
885 return InPropertyCollection.GetValue<Type>(PropertyName##Name, Default); \
886 } \
887 static FString Get##PropertyName##String(const ::Chaos::Softs::FCollectionPropertyConstFacade& InPropertyCollection, const FString& Default) \
888 { \
889 return InPropertyCollection.GetStringValue(PropertyName##Name, Default); \
890 } \
891
892// Use this macro to add shorthands for property getters and direct access through the declared key index.
893#define UE_CHAOS_DECLARE_INDEXED_PROPERTYCOLLECTION_NAME(PropertyName, Type) \
894 Type GetLow##PropertyName(const ::Chaos::Softs::FCollectionPropertyConstFacade& InPropertyCollection) const \
895 { \
896 checkSlow(PropertyName##Index == InPropertyCollection.GetKeyNameIndex(PropertyName##Name)); \
897 checkf(PropertyName##Index != INDEX_NONE, TEXT("The default value getter that sets the property index must be called once prior to calling this function.")); \
898 return InPropertyCollection.GetLowValue<Type>(PropertyName##Index); \
899 } \
900 Type GetHigh##PropertyName(const ::Chaos::Softs::FCollectionPropertyConstFacade& InPropertyCollection) const \
901 { \
902 checkSlow(PropertyName##Index == InPropertyCollection.GetKeyNameIndex(PropertyName##Name)); \
903 checkf(PropertyName##Index != INDEX_NONE, TEXT("The default value getter that sets the property index must be called once prior to calling this function.")); \
904 return InPropertyCollection.GetHighValue<Type>(PropertyName##Index); \
905 } \
906 TPair<Type, Type> GetWeighted##PropertyName(const ::Chaos::Softs::FCollectionPropertyConstFacade& InPropertyCollection) const \
907 { \
908 checkSlow(PropertyName##Index == InPropertyCollection.GetKeyNameIndex(PropertyName##Name)); \
909 checkf(PropertyName##Index != INDEX_NONE, TEXT("The default value getter that sets the property index must be called once prior to calling this function.")); \
910 return InPropertyCollection.GetWeightedValue<Type>(PropertyName##Index); \
911 } \
912 FVector2f GetWeightedFloat##PropertyName(const ::Chaos::Softs::FCollectionPropertyConstFacade& InPropertyCollection) const \
913 { \
914 checkSlow(PropertyName##Index == InPropertyCollection.GetKeyNameIndex(PropertyName##Name)); \
915 checkf(PropertyName##Index != INDEX_NONE, TEXT("The default value getter that sets the property index must be called once prior to calling this function.")); \
916 return InPropertyCollection.GetWeightedFloatValue(PropertyName##Index); \
917 } \
918 Type Get##PropertyName(const ::Chaos::Softs::FCollectionPropertyConstFacade& InPropertyCollection) const \
919 { \
920 checkSlow(PropertyName##Index == InPropertyCollection.GetKeyNameIndex(PropertyName##Name)); \
921 checkf(PropertyName##Index != INDEX_NONE, TEXT("The default value getter that sets the property index must be called once prior to calling this function.")); \
922 return InPropertyCollection.GetValue<Type>(PropertyName##Index); \
923 } \
924 const FString& Get##PropertyName##String(const ::Chaos::Softs::FCollectionPropertyConstFacade& InPropertyCollection) \
925 { \
926 checkSlow(PropertyName##Index == InPropertyCollection.GetKeyNameIndex(PropertyName##Name)); \
927 checkf(PropertyName##Index != INDEX_NONE, TEXT("The default value getter that sets the property index must be called once prior to calling this function.")); \
928 return InPropertyCollection.GetStringValue(PropertyName##Index); \
929 } \
930 bool Is##PropertyName##Enabled(const ::Chaos::Softs::FCollectionPropertyConstFacade& InPropertyCollection) const \
931 { \
932 checkSlow(PropertyName##Index == InPropertyCollection.GetKeyNameIndex(PropertyName##Name)); \
933 checkf(PropertyName##Index != INDEX_NONE, TEXT("The default value getter that sets the property index must be called once prior to calling this function.")); \
934 return InPropertyCollection.IsEnabled(PropertyName##Index); \
935 } \
936 bool Is##PropertyName##Animatable(const ::Chaos::Softs::FCollectionPropertyConstFacade& InPropertyCollection) const\
937 { \
938 checkSlow(PropertyName##Index == InPropertyCollection.GetKeyNameIndex(PropertyName##Name)); \
939 checkf(PropertyName##Index != INDEX_NONE, TEXT("The default value getter that sets the property index must be called once prior to calling this function.")); \
940 return InPropertyCollection.IsAnimatable(PropertyName##Index); \
941 } \
942 bool Is##PropertyName##Dirty(const ::Chaos::Softs::FCollectionPropertyConstFacade& InPropertyCollection) const \
943 { \
944 checkSlow(PropertyName##Index == InPropertyCollection.GetKeyNameIndex(PropertyName##Name)); \
945 checkf(PropertyName##Index != INDEX_NONE, TEXT("The default value getter that sets the property index must be called once prior to calling this function.")); \
946 return InPropertyCollection.IsDirty(PropertyName##Index); \
947 } \
948 bool Is##PropertyName##StringDirty(const ::Chaos::Softs::FCollectionPropertyConstFacade& InPropertyCollection) const \
949 { \
950 checkSlow(PropertyName##Index == InPropertyCollection.GetKeyNameIndex(PropertyName##Name)); \
951 checkf(PropertyName##Index != INDEX_NONE, TEXT("The default value getter that sets the property index must be called once prior to calling this function.")); \
952 return InPropertyCollection.IsStringDirty(PropertyName##Index); \
953 } \
954 bool Is##PropertyName##Mutable(const ::Chaos::Softs::FCollectionPropertyConstFacade& InPropertyCollection) const \
955 { \
956 return PropertyName##Index != INDEX_NONE && \
957 InPropertyCollection.IsAnimatable(PropertyName##Index) && (InPropertyCollection.IsDirty(PropertyName##Index)); \
958 } \
959 struct F##PropertyName##Index \
960 { \
961 int32 Index = INDEX_NONE; \
962 explicit F##PropertyName##Index(EForceInit) : Index(INDEX_NONE) {} \
963 explicit F##PropertyName##Index(const ::Chaos::Softs::FCollectionPropertyConstFacade& InPropertyCollection) : Index(InPropertyCollection.GetKeyNameIndex(PropertyName##Name)) {} \
964 operator int32() const { return Index; } \
965 } PropertyName##Index;
966
967
968// Use this macro to add both indexless and indexed property getters.
969#define UE_CHAOS_DECLARE_PROPERTYCOLLECTION_NAME(PropertyName, Type) \
970 UE_CHAOS_DECLARE_INDEXLESS_PROPERTYCOLLECTION_NAME(PropertyName, Type) \
971 UE_CHAOS_DECLARE_INDEXED_PROPERTYCOLLECTION_NAME(PropertyName, Type) \
972
ENoInit
Definition CoreMiscDefines.h:158
@ INDEX_NONE
Definition CoreMiscDefines.h:150
#define UE_DEPRECATED(Version, Message)
Definition CoreMiscDefines.h:302
FPlatformTypes::WIDECHAR WIDECHAR
A wide character. Normally a signed type.
Definition Platform.h:1133
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
FPlatformTypes::UTF8CHAR UTF8CHAR
An 8-bit character containing a UTF8 (Unicode, 8-bit, variable-width) code unit.
Definition Platform.h:1137
FPlatformTypes::ANSICHAR ANSICHAR
An ANSI character. Normally a signed type.
Definition Platform.h:1131
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
constexpr bool EnumHasAnyFlags(Enum Flags, Enum Contains)
Definition EnumClassFlags.h:35
#define ENUM_CLASS_FLAGS(Enum)
Definition EnumClassFlags.h:6
#define PRAGMA_ENABLE_DEPRECATION_WARNINGS
Definition GenericPlatformCompilerPreSetup.h:12
#define PRAGMA_DISABLE_DEPRECATION_WARNINGS
Definition GenericPlatformCompilerPreSetup.h:8
UE::Math::TVector2< float > FVector2f
Definition MathFwd.h:74
UE::Math::TVector< float > FVector3f
Definition MathFwd.h:73
const bool
Definition NetworkReplayStreaming.h:178
USkinnedMeshComponent float
Definition SkinnedMeshComponent.h:60
constexpr TTuple< std::decay_t< Types >... > MakeTuple(Types &&... Args)
Definition Tuple.h:794
uint32 GetArrayHash(const T *Ptr, uint64 Size, uint32 PreviousHash=0)
Definition TypeHash.h:200
uint8_t uint8
Definition binka_ue_file_header.h:8
uint32_t uint32
Definition binka_ue_file_header.h:6
Definition CollectionPropertyFacade.h:49
TPair< T, T > GetWeightedValue(const FName &Key, const T &Default=T(0), int32 *OutKeyIndex=nullptr) const
Definition CollectionPropertyFacade.h:118
bool IsLegacy(int32 KeyIndex) const
Definition CollectionPropertyFacade.h:98
CHAOS_API TConstArrayView< T > GetArray(const FName &Name) const
friend::uint32 GetTypeHash(const Chaos::Softs::FCollectionPropertyConstFacade &PropertyFacade)
Definition CollectionPropertyFacade.h:290
T GetHighValue(const FName &Key, const T &Default=T(0), int32 *OutKeyIndex=nullptr) const
Definition CollectionPropertyFacade.h:112
T GetLowValue(int32 KeyIndex) const
Definition CollectionPropertyFacade.h:79
bool IsInterpolable(int32 KeyIndex) const
Definition CollectionPropertyFacade.h:102
static CHAOS_API const FName KeyNameName
Definition CollectionPropertyFacade.h:343
T GetValue(int32 KeyIndex) const
Definition CollectionPropertyFacade.h:90
bool IsEnabled(const FName &Key, bool bDefault=false, int32 *OutKeyIndex=nullptr) const
Definition CollectionPropertyFacade.h:149
FCollectionPropertyConstFacade & operator=(const FCollectionPropertyConstFacade &)=delete
CHAOS_API void RebuildKeyIndices()
Definition CollectionPropertyFacade.cpp:57
bool IsIntrinsic(int32 KeyIndex) const
Definition CollectionPropertyFacade.h:99
static CHAOS_API const FName HighValueName
Definition CollectionPropertyFacade.h:345
TConstArrayView< uint8 > FlagsArray
Definition CollectionPropertyFacade.h:354
TConstArrayView< FString > KeyArray
Definition CollectionPropertyFacade.h:365
bool IsDirty(int32 KeyIndex) const
Definition CollectionPropertyFacade.h:101
TConstArrayView< FVector3f > LowValueArray
Definition CollectionPropertyFacade.h:351
TPair< T, T > GetWeightedValue(int32 KeyIndex) const
Definition CollectionPropertyFacade.h:85
FVector2f GetWeightedFloatValue(int32 KeyIndex) const
Definition CollectionPropertyFacade.h:87
bool IsEnabled(int32 KeyIndex) const
Definition CollectionPropertyFacade.h:96
TMap< FString, int32 > KeyIndices
Definition CollectionPropertyFacade.h:367
TConstArrayView< FVector3f > HighValueArray
Definition CollectionPropertyFacade.h:352
bool IsIntrinsic(const FName &Key, bool bDefault=false, int32 *OutKeyIndex=nullptr) const
Definition CollectionPropertyFacade.h:164
bool IsStringDirty(int32 KeyIndex) const
Definition CollectionPropertyFacade.h:100
int32 GetKeyNameIndex(const FName &Key) const
Definition CollectionPropertyFacade.h:68
bool IsAnimatable(int32 KeyIndex) const
Definition CollectionPropertyFacade.h:97
const FString & GetStringValue(int32 KeyIndex) const
Definition CollectionPropertyFacade.h:92
bool IsStringDirty(const FName &Key, bool bDefault=false, int32 *OutKeyIndex=nullptr) const
Definition CollectionPropertyFacade.h:169
bool IsDirty(const FName &Key, bool bDefault=false, int32 *OutKeyIndex=nullptr) const
Definition CollectionPropertyFacade.h:174
FCollectionPropertyConstFacade(const FCollectionPropertyConstFacade &)=delete
static CHAOS_API const FName FlagsName
Definition CollectionPropertyFacade.h:347
static CHAOS_API const FName LowValueName
Definition CollectionPropertyFacade.h:344
ECollectionPropertyFlags GetFlags(const FName &Key, uint8 Default=0, int32 *OutKeyIndex=nullptr) const
Definition CollectionPropertyFacade.h:144
TSharedPtr< const FManagedArrayCollection > ManagedArrayCollection
Definition CollectionPropertyFacade.h:360
T GetValue(const FName &Key, const T &Default=T(0), int32 *OutKeyIndex=nullptr) const
Definition CollectionPropertyFacade.h:134
int32 Num() const
Definition CollectionPropertyFacade.h:65
FString GetKey(int32 KeyIndex) const
Definition CollectionPropertyFacade.h:76
TConstArrayView< FName > KeyNameArray
Definition CollectionPropertyFacade.h:350
CHAOS_API T GetValue(int32 KeyIndex, const TConstArrayView< ElementType > &ValueArray) const
TMap< FName, int32 > KeyNameIndices
Definition CollectionPropertyFacade.h:357
static CHAOS_API const FName StringValueName
Definition CollectionPropertyFacade.h:346
bool IsInterpolable(const FName &Key, bool bDefault=false, int32 *OutKeyIndex=nullptr) const
Definition CollectionPropertyFacade.h:179
FCollectionPropertyConstFacade & operator=(FCollectionPropertyConstFacade &&)=default
static CHAOS_API const FName KeyName
Definition CollectionPropertyFacade.h:363
FString GetStringValue(const FName &Key, const FString &Default="", int32 *OutKeyIndex=nullptr) const
Definition CollectionPropertyFacade.h:139
FVector2f GetWeightedFloatValue(const FName &Key, const float &Default=0.f, int32 *OutKeyIndex=nullptr) const
Definition CollectionPropertyFacade.h:123
T GetHighValue(int32 KeyIndex) const
Definition CollectionPropertyFacade.h:82
FCollectionPropertyConstFacade(FCollectionPropertyConstFacade &&)=default
bool HasAnyFlags(int32 KeyIndex, ECollectionPropertyFlags Flags) const
Definition CollectionPropertyFacade.h:339
T GetLowValue(const FName &Key, const T &Default=T(0), int32 *OutKeyIndex=nullptr) const
Definition CollectionPropertyFacade.h:106
CHAOS_API bool IsValid() const
Definition CollectionPropertyFacade.cpp:38
static CHAOS_API const FName PropertyGroup
Definition CollectionPropertyFacade.h:342
int32 GetKeyIndex(const FString &Key) const
Definition CollectionPropertyFacade.h:70
bool IsLegacy(const FName &Key, bool bDefault=false, int32 *OutKeyIndex=nullptr) const
Definition CollectionPropertyFacade.h:159
FVector2f GetWeightedFloatValue(const FName &Key, const FVector2f &Default, int32 *OutKeyIndex=nullptr) const
Definition CollectionPropertyFacade.h:128
TConstArrayView< FString > StringValueArray
Definition CollectionPropertyFacade.h:353
CHAOS_API void UpdateArrays()
Definition CollectionPropertyFacade.cpp:48
ReturnType SafeGet(const FName &Key, CallableType &&Callable, ReturnType Default, int32 *OutKeyIndex) const
Definition CollectionPropertyFacade.h:316
bool IsAnimatable(const FName &Key, bool bDefault=false, int32 *OutKeyIndex=nullptr) const
Definition CollectionPropertyFacade.h:154
const FName & GetKeyName(int32 KeyIndex) const
Definition CollectionPropertyFacade.h:74
ECollectionPropertyFlags GetFlags(int32 KeyIndex) const
Definition CollectionPropertyFacade.h:94
Definition CollectionPropertyFacade.h:378
int32 SetDirty(const FName &Key)
Definition CollectionPropertyFacade.h:481
const TArrayView< ECollectionPropertyFlags > & GetFlagsArray()
Definition CollectionPropertyFacade.h:609
void SetWeightedValue(int32 KeyIndex, const T &LowValue, const T &HighValue)
Definition CollectionPropertyFacade.h:398
int32 SetFlags(const FName &Key, ECollectionPropertyFlags Flags)
Definition CollectionPropertyFacade.h:455
int32 SetIntrinsic(const FName &Key)
Definition CollectionPropertyFacade.h:476
FCollectionPropertyFacade(FCollectionPropertyFacade &&)=default
int32 SetWeightedValue(const FName &Key, const T &LowValue, const T &HighValue)
Definition CollectionPropertyFacade.h:434
void SetWeightedFloatValue(int32 KeyIndex, const FVector2f &Value)
Definition CollectionPropertyFacade.h:400
void SetLowValue(int32 KeyIndex, const T &Value)
Definition CollectionPropertyFacade.h:392
int32 SetHighValue(const FName &Key, const T &Value)
Definition CollectionPropertyFacade.h:428
int32 SetValue(const FName &Key, const T &Value)
Definition CollectionPropertyFacade.h:445
void SetAnimatable(int32 KeyIndex, bool bAnimatable)
Definition CollectionPropertyFacade.h:411
void SetDirty(int32 KeyIndex)
Definition CollectionPropertyFacade.h:416
const TArrayView< FString > & GetStringValueArray()
Definition CollectionPropertyFacade.h:608
void SetEnabled(int32 KeyIndex, bool bEnabled)
Definition CollectionPropertyFacade.h:410
void SetStringDirty(int32 KeyIndex)
Definition CollectionPropertyFacade.h:417
const TArrayView< FVector3f > & GetHighValueArray()
Definition CollectionPropertyFacade.h:607
int32 SetAnimatable(const FName &Key, bool bAnimatable)
Definition CollectionPropertyFacade.h:465
void SetLegacy(int32 KeyIndex, bool bLegacy)
Definition CollectionPropertyFacade.h:412
FCollectionPropertyFacade(const FCollectionPropertyFacade &)=delete
int32 SetStringValue(const FName &Key, const FString &Value)
Definition CollectionPropertyFacade.h:450
const TArrayView< FName > & GetKeyNameArray()
Definition CollectionPropertyFacade.h:605
FCollectionPropertyFacade & operator=(FCollectionPropertyFacade &&)=default
int32 SetLowValue(const FName &Key, const T &Value)
Definition CollectionPropertyFacade.h:422
FCollectionPropertyFacade & operator=(const FCollectionPropertyFacade &)=delete
void SetIntrinsic(int32 KeyIndex)
Definition CollectionPropertyFacade.h:415
const TArrayView< FVector3f > & GetLowValueArray()
Definition CollectionPropertyFacade.h:606
void SetInterpolable(int32 KeyIndex)
Definition CollectionPropertyFacade.h:418
TSharedPtr< FManagedArrayCollection > GetManagedArrayCollection()
Definition CollectionPropertyFacade.h:604
void SetValue(int32 KeyIndex, const T &Value)
Definition CollectionPropertyFacade.h:403
int32 SetEnabled(const FName &Key, bool bEnabled)
Definition CollectionPropertyFacade.h:460
void SetHighValue(int32 KeyIndex, const T &Value)
Definition CollectionPropertyFacade.h:395
int32 SetWeightedFloatValue(const FName &Key, const FVector2f &Value)
Definition CollectionPropertyFacade.h:439
int32 SetStringDirty(const FName &Key)
Definition CollectionPropertyFacade.h:486
void SetStringValue(int32 KeyIndex, const FString &Value)
Definition CollectionPropertyFacade.h:405
int32 SetInterpolable(const FName &Key)
Definition CollectionPropertyFacade.h:491
int32 SetLegacy(const FName &Key, bool bLegacy)
Definition CollectionPropertyFacade.h:470
Definition CollectionPropertyFacade.h:661
FCollectionPropertyMutableFacade & operator=(FCollectionPropertyMutableFacade &&)=default
int32 AddWeightedValue(const FName &Key, const T &LowValue, const T &HighValue, ECollectionPropertyFlags Flags=ECollectionPropertyFlags::Enabled)
Definition CollectionPropertyFacade.h:836
int32 AddValue(const FName &Key, const T &Value, ECollectionPropertyFlags Flags=ECollectionPropertyFlags::Enabled)
Definition CollectionPropertyFacade.h:758
int32 AddValue(const FName &Key, const T &Value, bool bEnabled, bool bAnimatable=false)
Definition CollectionPropertyFacade.h:760
FCollectionPropertyMutableFacade(const FCollectionPropertyMutableFacade &)=delete
FCollectionPropertyMutableFacade(FCollectionPropertyMutableFacade &&)=default
FCollectionPropertyMutableFacade & operator=(const FCollectionPropertyMutableFacade &)=delete
Definition SoftsSolverCollisionParticles.h:10
Definition Archive.h:1208
Definition NameTypes.h:617
Definition ArrayView.h:139
Definition Array.h:670
UE_REWRITE SizeType Num() const
Definition Array.h:1144
UE_FORCEINLINE_HINT SizeType Emplace(ArgsType &&... Args)
Definition Array.h:2561
UE_FORCEINLINE_HINT void Reserve(SizeType Number)
Definition Array.h:3016
Definition UnrealString.h.inl:34
Definition SharedPointer.h:692
UpdateFlags
Definition DetourCrowd.h:208
IAnalyticsPropertyStore::EStatusCode SetValue(TGetter &&GetterFn, TSetter &&SetterFn, const T &ProposedValue, TCompare &&ConditionFn)
Definition AnalyticsPropertyStore.cpp:34
Definition CollectionEmbeddedSpringConstraintFacade.cpp:6
ECollectionPropertyUpdateFlags
Definition CollectionPropertyFacade.h:646
ECollectionPropertyFlags
Definition CollectionPropertyFacade.h:15
@ Update
Definition PendingSpatialData.h:19
@ Default
Definition SpatialAccelerationCollection.h:21
@ false
Definition radaudio_common.h:23
U16 Index
Definition radfft.cpp:71
Definition CollectionPropertyFacade.h:36
static constexpr bool Value
Definition CollectionPropertyFacade.h:36
Definition CollectionPropertyFacade.h:29
static constexpr bool Value
Definition CollectionPropertyFacade.h:29
Definition ManagedArrayCollection.h:56
Definition Tuple.h:652