UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
KismetArrayLibrary.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "CoreMinimal.h"
6#include "UObject/Script.h"
8#include "UObject/Object.h"
10#include "UObject/UnrealType.h"
14#include "KismetArrayLibrary.generated.h"
15
16class AActor;
17
18UENUM(BlueprintType)
24
25UCLASS(meta=(BlueprintThreadSafe), MinimalAPI)
27{
36 UFUNCTION(BlueprintCallable, CustomThunk, meta=(DisplayName = "Add", CompactNodeTitle = "ADD", ArrayParm = "TargetArray", ArrayTypeDependentParams = "NewItem", AutoCreateRefTerm = "NewItem"), Category="Utilities|Array")
37 static ENGINE_API int32 Array_Add(UPARAM(ref) TArray<int32>& TargetArray, const int32& NewItem);
38
46 UFUNCTION(BlueprintCallable, CustomThunk, meta = (DisplayName = "Add Unique", CompactNodeTitle = "ADDUNIQUE", ArrayParm = "TargetArray", ArrayTypeDependentParams = "NewItem", AutoCreateRefTerm = "NewItem"), Category = "Utilities|Array")
47 static ENGINE_API int32 Array_AddUnique(UPARAM(ref) TArray<int32>& TargetArray, const int32& NewItem);
48
54 UFUNCTION(BlueprintCallable, CustomThunk, meta=(DisplayName = "Shuffle", CompactNodeTitle = "SHUFFLE", ArrayParm = "TargetArray"), Category="Utilities|Array")
55 static ENGINE_API void Array_Shuffle(UPARAM(ref) TArray<int32>& TargetArray);
56
63 UFUNCTION(BlueprintCallable, CustomThunk, meta=(DisplayName = "Shuffle from Stream", CompactNodeTitle = "SHUFFLE", ArrayParm = "TargetArray"), Category="Utilities|Array")
64 static ENGINE_API void Array_ShuffleFromStream(UPARAM(ref) TArray<int32>& TargetArray, UPARAM(Ref) FRandomStream& RandomStream);
65
73 UFUNCTION(BlueprintPure, CustomThunk, meta=(DisplayName = "Identical", CompactNodeTitle = "==", ArrayParm = "ArrayA,ArrayB", ArrayTypeDependentParams = "ArrayB"), Category="Utilities|Array")
74 static ENGINE_API bool Array_Identical(const TArray<int32>& ArrayA, const TArray<int32>& ArrayB);
75
82 UFUNCTION(BlueprintCallable, CustomThunk, meta=(DisplayName = "Append Array", CompactNodeTitle = "APPEND", ArrayParm = "TargetArray,SourceArray", ArrayTypeDependentParams = "SourceArray"), Category="Utilities|Array")
83 static ENGINE_API void Array_Append(UPARAM(ref) TArray<int32>& TargetArray, const TArray<int32>& SourceArray);
84
85 /*
86 *Insert item at the given index into the array.
87 *
88 *@param TargetArray The array to insert into
89 *@param NewItem The item to insert into the array
90 *@param Index The index at which to insert the item into the array
91 */
92 UFUNCTION(BlueprintCallable, CustomThunk, meta=(DisplayName = "Insert", CompactNodeTitle = "INSERT", ArrayParm = "TargetArray", ArrayTypeDependentParams = "NewItem", AutoCreateRefTerm = "NewItem"), Category="Utilities|Array")
93 static ENGINE_API void Array_Insert(UPARAM(ref) TArray<int32>& TargetArray, const int32& NewItem, int32 Index);
94
95
96 /*
97 *Remove item at the given index from the array.
98 *
99 *@param TargetArray The array to remove from
100 *@param IndexToRemove The index into the array to remove from
101 */
102 UFUNCTION(BlueprintCallable, CustomThunk, meta=(DisplayName = "Remove Index", CompactNodeTitle = "REMOVE INDEX", ArrayParm = "TargetArray"), Category="Utilities|Array")
103 static ENGINE_API void Array_Remove(UPARAM(ref) TArray<int32>& TargetArray, int32 IndexToRemove);
104
105 /*
106 *Remove all instances of item from array.
107 *
108 *@param TargetArray The array to remove from
109 *@param Item The item to remove from the array
110 *@return True if one or more items were removed
111 */
112 UFUNCTION(BlueprintCallable, CustomThunk, meta=(DisplayName = "Remove Item", CompactNodeTitle = "REMOVE", ArrayParm = "TargetArray", ArrayTypeDependentParams = "Item", AutoCreateRefTerm = "Item"), Category="Utilities|Array")
113 static ENGINE_API bool Array_RemoveItem(UPARAM(ref) TArray<int32>& TargetArray, const int32 &Item);
114
115 /*
116 *Clear an array, removes all content
117 *
118 *@param TargetArray The array to clear
119 */
120 UFUNCTION(BlueprintCallable, CustomThunk, meta=(DisplayName = "Clear", CompactNodeTitle = "CLEAR", Keywords = "empty", ArrayParm = "TargetArray"), Category="Utilities|Array")
121 static ENGINE_API void Array_Clear(UPARAM(ref) TArray<int32>& TargetArray);
122
123 /*
124 *Resize Array to specified size.
125 *
126 *@param TargetArray The array to resize
127 *@param Size The new size of the array
128 */
129 UFUNCTION(BlueprintCallable, CustomThunk, meta=(DisplayName = "Resize", CompactNodeTitle = "RESIZE", ArrayParm = "TargetArray"), Category="Utilities|Array")
130 static ENGINE_API void Array_Resize(UPARAM(ref) TArray<int32>& TargetArray, int32 Size);
131
137 UFUNCTION(BlueprintCallable, CustomThunk, meta = (DisplayName = "Reverse", CompactNodeTitle = "REVERSE", ArrayParm = "TargetArray"), Category = "Utilities|Array")
138 static ENGINE_API void Array_Reverse(UPARAM(ref) TArray<int32>& TargetArray);
139
140 /*
141 *Get the number of items in an array
142 *
143 *@param TargetArray The array to get the length of
144 *@return The length of the array
145 */
146 UFUNCTION(BlueprintPure, CustomThunk, meta=(DisplayName = "Length", CompactNodeTitle = "LENGTH", ArrayParm = "TargetArray", Keywords = "num size count", BlueprintThreadSafe), Category="Utilities|Array")
147 static ENGINE_API int32 Array_Length(const TArray<int32>& TargetArray);
148
149 /*
150 *Check if the array is empty
151 *
152 *@param TargetArray The array to check
153 *@return A boolean indicating if the array is empty
154 */
155 UFUNCTION(BlueprintPure, CustomThunk, meta = (DisplayName = "Is Empty", CompactNodeTitle = "IS EMPTY", ArrayParm = "TargetArray", BlueprintThreadSafe), Category = "Utilities|Array")
156 static ENGINE_API bool Array_IsEmpty(const TArray<int32>& TargetArray);
157
158 /*
159 *Check if the array has any elements
160 *
161 *@param TargetArray The array to check
162 *@return A boolean indicating if the array has any elements
163 */
164 UFUNCTION(BlueprintPure, CustomThunk, meta = (DisplayName = "Is Not Empty", CompactNodeTitle = "IS NOT EMPTY", ArrayParm = "TargetArray", BlueprintThreadSafe), Category = "Utilities|Array")
165 static ENGINE_API bool Array_IsNotEmpty(const TArray<int32>& TargetArray);
166
167
168 /*
169 *Get the last valid index into an array
170 *
171 *@param TargetArray The array to perform the operation on
172 *@return The last valid index of the array
173 */
174 UFUNCTION(BlueprintPure, CustomThunk, meta=(DisplayName = "Last Index", CompactNodeTitle = "LAST INDEX", ArrayParm = "TargetArray", BlueprintThreadSafe), Category="Utilities|Array")
175 static ENGINE_API int32 Array_LastIndex(const TArray<int32>& TargetArray);
176
177 /*
178 *Given an array and an index, returns a copy of the item found at that index
179 *
180 *@param TargetArray The array to get an item from
181 *@param Index The index in the array to get an item from
182 *@return A copy of the item stored at the index
183 */
184 UFUNCTION(BlueprintPure, CustomThunk, meta=(BlueprintInternalUseOnly = "true", DisplayName = "Get", CompactNodeTitle = "GET", ArrayParm = "TargetArray", ArrayTypeDependentParams = "Item", BlueprintThreadSafe), Category="Utilities|Array")
185 static ENGINE_API void Array_Get(const TArray<int32>& TargetArray, int32 Index, int32& Item);
186
187 /*
188 *Given an array and an index, assigns the item to that array element
189 *
190 *@param TargetArray The array to perform the operation on
191 *@param Index The index to assign the item to
192 *@param Item The item to assign to the index of the array
193 *@param bSizeToFit If true, the array will expand if Index is greater than the current size of the array
194 */
195 UFUNCTION(BlueprintCallable, CustomThunk, meta=(DisplayName = "Set Array Elem", ArrayParm = "TargetArray", ArrayTypeDependentParams = "Item", AutoCreateRefTerm = "Item"), Category="Utilities|Array")
196 static ENGINE_API void Array_Set(UPARAM(ref) TArray<int32>& TargetArray, int32 Index, const int32& Item, bool bSizeToFit);
197
198 /*
199 *Swaps the elements at the specified positions in the specified array
200 *If the specified positions are equal, invoking this method leaves the array unchanged
201 *
202 *@param TargetArray The array to perform the operation on
203 *@param FirstIndex The index of one element to be swapped
204 *@param SecondIndex The index of the other element to be swapped
205 */
206 UFUNCTION(BlueprintCallable, CustomThunk, meta=(DisplayName = "Swap Array Elements", CompactNodeTitle = "SWAP", ArrayParm = "TargetArray"), Category="Utilities|Array")
207 static ENGINE_API void Array_Swap(UPARAM(ref) TArray<int32>& TargetArray, int32 FirstIndex, int32 SecondIndex);
208
209 /*
210 *Finds the index of the first instance of the item within the array
211 *
212 *@param TargetArray The array to search for the item
213 *@param ItemToFind The item to look for
214 *@return The index the item was found at, or -1 if not found
215 */
216 UFUNCTION(BlueprintPure, CustomThunk, meta=(DisplayName = "Find Item", CompactNodeTitle = "FIND", ArrayParm = "TargetArray", ArrayTypeDependentParams = "ItemToFind", AutoCreateRefTerm = "ItemToFind", BlueprintThreadSafe), Category="Utilities|Array")
217 static ENGINE_API int32 Array_Find(const TArray<int32>& TargetArray, const int32& ItemToFind);
218
219 /*
220 *Returns true if the array contains the given item
221 *
222 *@param TargetArray The array to search for the item
223 *@param ItemToFind The item to look for
224 *@return True if the item was found within the array
225 */
226 UFUNCTION(BlueprintPure, CustomThunk, meta=(DisplayName = "Contains Item", CompactNodeTitle = "CONTAINS", ArrayParm = "TargetArray", ArrayTypeDependentParams = "ItemToFind", AutoCreateRefTerm = "ItemToFind", BlueprintThreadSafe), Category="Utilities|Array")
227 static ENGINE_API bool Array_Contains(const TArray<int32>& TargetArray, const int32& ItemToFind);
228
229 /*
230 *Filter an array based on a Class derived from Actor.
231 *
232 *@param TargetArray The array to filter from
233 *@param FilterClass The Actor sub-class type that acts as the filter, only objects derived from it will be returned.
234 *@return An array containing only those objects which are derived from the class specified.
235 */
236 UFUNCTION(BlueprintCallable, meta=(DisplayName = "Filter Array", DeterminesOutputType = "FilterClass", DynamicOutputParam = "FilteredArray"), Category = "Utilities|Array")
238
242 UFUNCTION(BlueprintCallable, CustomThunk, meta=(BlueprintInternalUseOnly = "true", ArrayParm = "Value", ArrayTypeDependentParams="Value"))
243 static ENGINE_API void SetArrayPropertyByName(UObject* Object, FName PropertyName, const TArray<int32>& Value);
244
245 /*
246 *Tests if IndexToTest is valid, i.e. greater than or equal to zero, and less than the number of elements in TargetArray.
247 *
248 *@param TargetArray Array to use for the IsValidIndex test
249 *@param IndexToTest The Index, that we want to test for being valid
250 *@return True if the Index is Valid, i.e. greater than or equal to zero, and less than the number of elements in TargetArray.
251 */
252 UFUNCTION(BlueprintPure, CustomThunk, meta = (DisplayName = "Is Valid Index", CompactNodeTitle = "IS VALID INDEX", ArrayParm = "TargetArray", BlueprintThreadSafe), Category = "Utilities|Array")
253 static ENGINE_API bool Array_IsValidIndex(const TArray<int32>& TargetArray, int32 IndexToTest);
254
262 UFUNCTION(BlueprintPure, CustomThunk, meta=(DisplayName = "Random Array Item", CompactNodeTitle = "RANDOM", ArrayParm = "TargetArray", ArrayTypeDependentParams = "OutItem"), Category="Utilities|Array")
263 static ENGINE_API void Array_Random(const TArray<int32>& TargetArray, int32& OutItem, int32& OutIndex);
264
273 UFUNCTION(BlueprintPure, CustomThunk, meta=(DisplayName = "Random Array Item from Stream", ArrayParm = "TargetArray", ArrayTypeDependentParams = "OutItem"), Category="Utilities|Array")
274 static ENGINE_API void Array_RandomFromStream(const TArray<int32>& TargetArray, UPARAM(Ref) FRandomStream& RandomStream, int32& OutItem, int32& OutIndex);
275
283 UFUNCTION(BlueprintCallable, Category = "Utilities|Array|Sort", meta = (AdvancedDisplay = "bStableSort,SortOrder"))
284 static ENGINE_API void SortStringArray(UPARAM(Ref) TArray<FString>& TargetArray, bool bStableSort = false, EArraySortOrder SortOrder = EArraySortOrder::Ascending);
285
294 UFUNCTION(BlueprintCallable, Category = "Utilities|Array|Sort", meta = (AdvancedDisplay = "bStableSort,bLexicalSort,SortOrder"))
295 static ENGINE_API void SortNameArray(UPARAM(Ref) TArray<FName>& TargetArray, bool bStableSort = false, bool bLexicalSort = true, EArraySortOrder SortOrder = EArraySortOrder::Ascending);
296
304 UFUNCTION(BlueprintCallable, Category = "Utilities|Array|Sort", meta = (AdvancedDisplay = "bStableSort,SortOrder"))
305 static ENGINE_API void SortByteArray(UPARAM(Ref) TArray<uint8>& TargetArray, bool bStableSort = false, EArraySortOrder SortOrder = EArraySortOrder::Ascending);
306
314 UFUNCTION(BlueprintCallable, Category = "Utilities|Array|Sort", meta = (DisplayName = "Sort Integer Array", AdvancedDisplay = "bStableSort,SortOrder"))
315 static ENGINE_API void SortIntArray(UPARAM(Ref) TArray<int32>& TargetArray, bool bStableSort = false, EArraySortOrder SortOrder = EArraySortOrder::Ascending);
316
324 UFUNCTION(BlueprintCallable, Category = "Utilities|Array|Sort", meta = (DisplayName = "Sort Integer64 Array", AdvancedDisplay = "bStableSort,SortOrder"))
325 static ENGINE_API void SortInt64Array(UPARAM(Ref) TArray<int64>& TargetArray, bool bStableSort = false, EArraySortOrder SortOrder = EArraySortOrder::Ascending);
326
334 UFUNCTION(BlueprintCallable, Category = "Utilities|Array|Sort", meta = (AdvancedDisplay = "bStableSort,SortOrder"))
335 static ENGINE_API void SortFloatArray(UPARAM(Ref) TArray<double>& TargetArray, bool bStableSort = false, EArraySortOrder SortOrder = EArraySortOrder::Ascending);
336
337 // Native functions that will be called by the below custom thunk layers, which read off the property address, and call the appropriate native handler
338 static ENGINE_API int32 GenericArray_Add(void* TargetArray, const FArrayProperty* ArrayProp, const void* NewItem);
339 static ENGINE_API int32 GenericArray_AddUnique(void* TargetArray, const FArrayProperty* ArrayProp, const void* NewItem);
340 static ENGINE_API void GenericArray_Shuffle(void* TargetArray, const FArrayProperty* ArrayProp);
341 static ENGINE_API void GenericArray_ShuffleFromStream(void* TargetArray, const FArrayProperty* ArrayProp, FRandomStream* RandomStream);
342 static ENGINE_API bool GenericArray_Identical(void* ArrayA, const FArrayProperty* ArrayAProp, void* ArrayB, const FArrayProperty* ArrayBProperty);
343 static ENGINE_API void GenericArray_Append(void* TargetArray, const FArrayProperty* TargetArrayProp, void* SourceArray, const FArrayProperty* SourceArrayProperty);
344 static ENGINE_API void GenericArray_Insert(void* TargetArray, const FArrayProperty* ArrayProp, const void* NewItem, int32 Index);
345 static ENGINE_API void GenericArray_Remove(void* TargetArray, const FArrayProperty* ArrayProp, int32 IndexToRemove);
346 static ENGINE_API bool GenericArray_RemoveItem(void* TargetArray, const FArrayProperty* ArrayProp, const void* Item);
347 static ENGINE_API void GenericArray_Clear(void* TargetArray, const FArrayProperty* ArrayProp);
348 static ENGINE_API void GenericArray_Resize(void* TargetArray, const FArrayProperty* ArrayProp, int32 Size);
349 static ENGINE_API void GenericArray_Reverse(void* TargetArray, const FArrayProperty* ArrayProp);
350 static ENGINE_API int32 GenericArray_Length(const void* TargetArray, const FArrayProperty* ArrayProp);
351 static ENGINE_API bool GenericArray_IsEmpty(const void* TargetArray, const FArrayProperty* ArrayProp);
352 static ENGINE_API bool GenericArray_IsNotEmpty(const void* TargetArray, const FArrayProperty* ArrayProp);
353 static ENGINE_API int32 GenericArray_LastIndex(const void* TargetArray, const FArrayProperty* ArrayProp);
354 static ENGINE_API void GenericArray_Get(void* TargetArray, const FArrayProperty* ArrayProp, int32 Index, void* Item);
355 static ENGINE_API void GenericArray_Set(void* TargetArray, const FArrayProperty* ArrayProp, int32 Index, const void* NewItem, bool bSizeToFit);
356 static ENGINE_API void GenericArray_Swap(const void* TargetArray, const FArrayProperty* ArrayProp, int32 First, int32 Second);
357 static ENGINE_API int32 GenericArray_Find(const void* TargetArray, const FArrayProperty* ArrayProperty, const void* ItemToFind);
358 static ENGINE_API void GenericArray_SetArrayPropertyByName(UObject* OwnerObject, FName ArrayPropertyName, const void* SrcArrayAddr);
359 static ENGINE_API void GenericArray_Random(void* TargetArray, const FArrayProperty* ArrayProp, void* OutItem, int32* OutIndex);
360 static ENGINE_API void GenericArray_RandomFromStream(void* TargetArray, const FArrayProperty* ArrayProp, FRandomStream* RandomStream, void* OutItem, int32* OutIndex);
361 static ENGINE_API bool GenericArray_IsValidIndex(const void* TargetArray, const FArrayProperty* ArrayProp, int32 IndexToTest);
362
363private:
364 static constexpr int32 MaxSupportedArraySize = TNumericLimits<int32>::Max();
365
366 static ENGINE_API void GenericArray_HandleBool(const FProperty* Property, void* ItemPtr);
367
368public:
369 // Shared warning IDs for use by other container libraries.
371
372 // Helper function to get the last valid index of the array for error reporting, or 0 if the array is empty
374 {
375 const int32 ArraySize = ArrayHelper.Num();
376 return (ArraySize > 0) ? ArraySize-1 : 0;
377 }
378
380 {
381 Stack.MostRecentProperty = nullptr;
382 Stack.StepCompiledIn<FArrayProperty>(NULL);
383 void* ArrayAddr = Stack.MostRecentPropertyAddress;
384 FArrayProperty* ArrayProperty = CastField<FArrayProperty>(Stack.MostRecentProperty);
385 if (!ArrayProperty)
386 {
387 Stack.bArrayContextFailed = true;
388 return;
389 }
390
391 // Since NewItem isn't really an int, step the stack manually
392 const FProperty* InnerProp = ArrayProperty->Inner;
393 const int32 PropertySize = InnerProp->GetElementSize() * InnerProp->ArrayDim;
394 void* StorageSpace = FMemory_Alloca(PropertySize);
395 InnerProp->InitializeValue(StorageSpace);
396
397 Stack.MostRecentPropertyAddress = nullptr;
398 Stack.MostRecentPropertyContainer = nullptr;
399 Stack.StepCompiledIn<FProperty>(StorageSpace);
400
401 P_FINISH;
403 *(int32*)RESULT_PARAM = GenericArray_Add(ArrayAddr, ArrayProperty, StorageSpace);
406 }
407
409 {
410 Stack.MostRecentProperty = nullptr;
411 Stack.StepCompiledIn<FArrayProperty>(NULL);
412 void* ArrayAddr = Stack.MostRecentPropertyAddress;
413 FArrayProperty* ArrayProperty = CastField<FArrayProperty>(Stack.MostRecentProperty);
414 if (!ArrayProperty)
415 {
416 Stack.bArrayContextFailed = true;
417 return;
418 }
419
420 // Since NewItem isn't really an int, step the stack manually
421 const FProperty* InnerProp = ArrayProperty->Inner;
422 const int32 PropertySize = InnerProp->GetElementSize() * InnerProp->ArrayDim;
423 void* StorageSpace = FMemory_Alloca(PropertySize);
424 InnerProp->InitializeValue(StorageSpace);
425
426 Stack.MostRecentPropertyAddress = nullptr;
427 Stack.MostRecentPropertyContainer = nullptr;
428 Stack.StepCompiledIn<FProperty>(StorageSpace);
429
430 P_FINISH;
432 *(int32*)RESULT_PARAM = GenericArray_AddUnique(ArrayAddr, ArrayProperty, StorageSpace);
435 }
436
438 {
439 Stack.MostRecentProperty = nullptr;
440 Stack.StepCompiledIn<FArrayProperty>(NULL);
441 void* ArrayAddr = Stack.MostRecentPropertyAddress;
442 FArrayProperty* ArrayProperty = CastField<FArrayProperty>(Stack.MostRecentProperty);
443 if (!ArrayProperty)
444 {
445 Stack.bArrayContextFailed = true;
446 return;
447 }
448
449 P_FINISH;
451 GenericArray_Shuffle(ArrayAddr, ArrayProperty);
453 }
454
456 {
457 Stack.MostRecentProperty = nullptr;
458 Stack.StepCompiledIn<FArrayProperty>(NULL);
459 void* ArrayAddr = Stack.MostRecentPropertyAddress;
460 FArrayProperty* ArrayProperty = CastField<FArrayProperty>(Stack.MostRecentProperty);
461 if (!ArrayProperty)
462 {
463 Stack.bArrayContextFailed = true;
464 return;
465 }
466
467 Stack.MostRecentProperty = nullptr;
468 Stack.StepCompiledIn<FProperty>(nullptr);
469 FRandomStream* RandomStream = (FRandomStream*)Stack.MostRecentPropertyAddress;
470
471 P_FINISH;
473 GenericArray_ShuffleFromStream(ArrayAddr, ArrayProperty, RandomStream);
475 }
476
478 {
479 // Retrieve the first array
480 Stack.MostRecentProperty = nullptr;
481 Stack.StepCompiledIn<FArrayProperty>(NULL);
482 void* ArrayAAddr = Stack.MostRecentPropertyAddress;
483 FArrayProperty* ArrayAProperty = CastField<FArrayProperty>(Stack.MostRecentProperty);
484 if (!ArrayAProperty)
485 {
486 Stack.bArrayContextFailed = true;
487 return;
488 }
489 // Retrieve the second array
490 Stack.MostRecentProperty = nullptr;
491 Stack.StepCompiledIn<FArrayProperty>(NULL);
492 void* ArrayBAddr = Stack.MostRecentPropertyAddress;
493 FArrayProperty* ArrayBProperty = CastField<FArrayProperty>(Stack.MostRecentProperty);
494 if (!ArrayBProperty)
495 {
496 Stack.bArrayContextFailed = true;
497 return;
498 }
499
500 P_FINISH;
502 *(bool*)RESULT_PARAM = GenericArray_Identical(ArrayAAddr, ArrayAProperty, ArrayBAddr, ArrayBProperty);
504 }
505
507 {
508 // Retrieve the target array
509 Stack.MostRecentProperty = nullptr;
510 Stack.StepCompiledIn<FArrayProperty>(NULL);
511 void* TargetArrayAddr = Stack.MostRecentPropertyAddress;
514 {
515 Stack.bArrayContextFailed = true;
516 return;
517 }
518 // Retrieve the source array
519 Stack.MostRecentProperty = nullptr;
520 Stack.StepCompiledIn<FArrayProperty>(NULL);
521 void* SourceArrayAddr = Stack.MostRecentPropertyAddress;
524 {
525 Stack.bArrayContextFailed = true;
526 return;
527 }
528
529 P_FINISH;
533 }
534
536 {
537 Stack.MostRecentProperty = nullptr;
538 Stack.StepCompiledIn<FArrayProperty>(NULL);
539 void* ArrayAddr = Stack.MostRecentPropertyAddress;
540 FArrayProperty* ArrayProperty = CastField<FArrayProperty>(Stack.MostRecentProperty);
541 if (!ArrayProperty)
542 {
543 Stack.bArrayContextFailed = true;
544 return;
545 }
546
547 // Since NewItem isn't really an int, step the stack manually
548 const FProperty* InnerProp = ArrayProperty->Inner;
549 const int32 PropertySize = InnerProp->GetElementSize() * InnerProp->ArrayDim;
550 void* StorageSpace = FMemory_Alloca(PropertySize);
551 InnerProp->InitializeValue(StorageSpace);
552
553 Stack.MostRecentPropertyAddress = nullptr;
554 Stack.MostRecentPropertyContainer = nullptr;
555 Stack.StepCompiledIn<FProperty>(StorageSpace);
556
558 P_FINISH;
560 GenericArray_Insert(ArrayAddr, ArrayProperty, StorageSpace, Index);
562 InnerProp->DestroyValue(StorageSpace);
563 }
564
566 {
567 Stack.MostRecentProperty = nullptr;
568 Stack.StepCompiledIn<FArrayProperty>(NULL);
569 void* ArrayAddr = Stack.MostRecentPropertyAddress;
570 FArrayProperty* ArrayProperty = CastField<FArrayProperty>(Stack.MostRecentProperty);
571 if (!ArrayProperty)
572 {
573 Stack.bArrayContextFailed = true;
574 return;
575 }
576
578 P_FINISH;
580 GenericArray_Remove(ArrayAddr, ArrayProperty, Index);
582 }
583
585 {
586 Stack.MostRecentProperty = nullptr;
587 Stack.StepCompiledIn<FArrayProperty>(NULL);
588 void* ArrayAddr = Stack.MostRecentPropertyAddress;
589 FArrayProperty* ArrayProperty = CastField<FArrayProperty>(Stack.MostRecentProperty);
590 if (!ArrayProperty)
591 {
592 Stack.bArrayContextFailed = true;
593 return;
594 }
595 // Since Item isn't really an int, step the stack manually
596 const FProperty* InnerProp = ArrayProperty->Inner;
597 const int32 PropertySize = InnerProp->GetElementSize() * InnerProp->ArrayDim;
598 void* StorageSpace = FMemory_Alloca(PropertySize);
599 InnerProp->InitializeValue(StorageSpace);
600
601 Stack.MostRecentPropertyAddress = nullptr;
602 Stack.MostRecentPropertyContainer = nullptr;
603 Stack.StepCompiledIn<FProperty>(StorageSpace);
604 void* ItemPtr = StorageSpace;
605
606 P_FINISH;
607
608 // Bools need to be processed internally by the property so that C++ bool value is properly set.
609 GenericArray_HandleBool(InnerProp, ItemPtr);
611 *(bool*)RESULT_PARAM = GenericArray_RemoveItem(ArrayAddr, ArrayProperty, ItemPtr);
613
614 InnerProp->DestroyValue(StorageSpace);
615 }
616
618 {
619 Stack.MostRecentProperty = nullptr;
620 Stack.StepCompiledIn<FArrayProperty>(NULL);
621 void* ArrayAddr = Stack.MostRecentPropertyAddress;
622 FArrayProperty* ArrayProperty = CastField<FArrayProperty>(Stack.MostRecentProperty);
623 if (!ArrayProperty)
624 {
625 Stack.bArrayContextFailed = true;
626 return;
627 }
628 P_FINISH;
630 GenericArray_Clear(ArrayAddr, ArrayProperty);
632 }
633
635 {
636 Stack.MostRecentProperty = nullptr;
637 Stack.StepCompiledIn<FArrayProperty>(NULL);
638 void* ArrayAddr = Stack.MostRecentPropertyAddress;
639 FArrayProperty* ArrayProperty = CastField<FArrayProperty>(Stack.MostRecentProperty);
640 if (!ArrayProperty)
641 {
642 Stack.bArrayContextFailed = true;
643 return;
644 }
646 P_FINISH;
648 GenericArray_Resize(ArrayAddr, ArrayProperty, Size);
650 }
651
653 {
654 Stack.MostRecentProperty = nullptr;
655 Stack.StepCompiledIn<FArrayProperty>(NULL);
656 void* ArrayAddr = Stack.MostRecentPropertyAddress;
657 FArrayProperty* ArrayProperty = CastField<FArrayProperty>(Stack.MostRecentProperty);
658 if (!ArrayProperty)
659 {
660 Stack.bArrayContextFailed = true;
661 return;
662 }
663 P_FINISH;
665 GenericArray_Reverse(ArrayAddr, ArrayProperty);
667 }
668
670 {
671 Stack.MostRecentProperty = nullptr;
672 Stack.StepCompiledIn<FArrayProperty>(NULL);
673 void* ArrayAddr = Stack.MostRecentPropertyAddress;
674 FArrayProperty* ArrayProperty = CastField<FArrayProperty>(Stack.MostRecentProperty);
675 if (!ArrayProperty)
676 {
677 Stack.bArrayContextFailed = true;
678 return;
679 }
680 P_FINISH;
682 *(int32*)RESULT_PARAM = GenericArray_Length(ArrayAddr, ArrayProperty);
684 }
685
687 {
688 Stack.MostRecentProperty = nullptr;
689 Stack.StepCompiledIn<FArrayProperty>(nullptr);
690 void* ArrayAddr = Stack.MostRecentPropertyAddress;
691 FArrayProperty* ArrayProperty = CastField<FArrayProperty>(Stack.MostRecentProperty);
692 if (!ArrayProperty)
693 {
694 Stack.bArrayContextFailed = true;
695 return;
696 }
697 P_FINISH;
699 *(bool*)RESULT_PARAM = GenericArray_IsEmpty(ArrayAddr, ArrayProperty);
701 }
702
704 {
705 Stack.MostRecentProperty = nullptr;
706 Stack.StepCompiledIn<FArrayProperty>(nullptr);
707 void* ArrayAddr = Stack.MostRecentPropertyAddress;
708 FArrayProperty* ArrayProperty = CastField<FArrayProperty>(Stack.MostRecentProperty);
709 if (!ArrayProperty)
710 {
711 Stack.bArrayContextFailed = true;
712 return;
713 }
714 P_FINISH;
716 *(bool*)RESULT_PARAM = GenericArray_IsNotEmpty(ArrayAddr, ArrayProperty);
718 }
719
721 {
722 Stack.MostRecentProperty = nullptr;
723 Stack.StepCompiledIn<FArrayProperty>(NULL);
724 void* ArrayAddr = Stack.MostRecentPropertyAddress;
725 FArrayProperty* ArrayProperty = CastField<FArrayProperty>(Stack.MostRecentProperty);
726 if (!ArrayProperty)
727 {
728 Stack.bArrayContextFailed = true;
729 return;
730 }
731 P_FINISH;
733 *(int32*)RESULT_PARAM = GenericArray_LastIndex(ArrayAddr, ArrayProperty);
735 }
736
738 {
739 Stack.MostRecentProperty = nullptr;
740 Stack.StepCompiledIn<FArrayProperty>(NULL);
741 void* ArrayAddr = Stack.MostRecentPropertyAddress;
742 FArrayProperty* ArrayProperty = CastField<FArrayProperty>(Stack.MostRecentProperty);
743 if (!ArrayProperty)
744 {
745 Stack.bArrayContextFailed = true;
746 return;
747 }
749
750 // Since Item isn't really an int, step the stack manually
751 const FProperty* InnerProp = ArrayProperty->Inner;
752 const int32 PropertySize = InnerProp->GetElementSize() * InnerProp->ArrayDim;
753 void* StorageSpace = FMemory_Alloca(PropertySize);
754 InnerProp->InitializeValue(StorageSpace);
755
756 Stack.MostRecentPropertyAddress = nullptr;
757 Stack.MostRecentPropertyContainer = nullptr;
758 Stack.StepCompiledIn<FProperty>(StorageSpace);
759 const FFieldClass* InnerPropClass = InnerProp->GetClass();
760 const FFieldClass* MostRecentPropClass = Stack.MostRecentProperty->GetClass();
761 void* ItemPtr;
762 // If the destination and the inner type are identical in size and their field classes derive from one another, then permit the writing out of the array element to the destination memory
763 if (Stack.MostRecentPropertyAddress != NULL && (PropertySize == Stack.MostRecentProperty->GetElementSize()*Stack.MostRecentProperty->ArrayDim) &&
765 {
766 ItemPtr = Stack.MostRecentPropertyAddress;
767 }
768 else
769 {
770 ItemPtr = StorageSpace;
771 }
772
773 P_FINISH;
775 GenericArray_Get(ArrayAddr, ArrayProperty, Index, ItemPtr);
777 InnerProp->DestroyValue(StorageSpace);
778 }
779
781 {
782 Stack.MostRecentProperty = nullptr;
783 Stack.StepCompiledIn<FArrayProperty>(NULL);
784 void* ArrayAddr = Stack.MostRecentPropertyAddress;
785 FArrayProperty* ArrayProperty = CastField<FArrayProperty>(Stack.MostRecentProperty);
786 if (!ArrayProperty)
787 {
788 Stack.bArrayContextFailed = true;
789 return;
790 }
792
793 // Since NewItem isn't really an int, step the stack manually
794 const FProperty* InnerProp = ArrayProperty->Inner;
795 const int32 PropertySize = InnerProp->GetElementSize() * InnerProp->ArrayDim;
796 void* StorageSpace = FMemory_Alloca(PropertySize);
797 InnerProp->InitializeValue(StorageSpace);
798
799 Stack.MostRecentPropertyAddress = nullptr;
800 Stack.MostRecentPropertyContainer = nullptr;
801 Stack.StepCompiledIn<FProperty>(StorageSpace);
802
804
805 P_FINISH;
806
808 GenericArray_Set(ArrayAddr, ArrayProperty, Index, StorageSpace, bSizeToFit);
810 InnerProp->DestroyValue(StorageSpace);
811 }
812
813
815 {
816 Stack.MostRecentProperty = nullptr;
817 Stack.StepCompiledIn<FArrayProperty>(nullptr);
818 void* ArrayAddr = Stack.MostRecentPropertyAddress;
819 FArrayProperty* ArrayProperty = CastField<FArrayProperty>(Stack.MostRecentProperty);
820 if (!ArrayProperty)
821 {
822 Stack.bArrayContextFailed = true;
823 return;
824 }
825
828
829 P_FINISH;
831 GenericArray_Swap(ArrayAddr, ArrayProperty, First, Second);
833 }
834
836 {
837 Stack.MostRecentProperty = nullptr;
838 Stack.StepCompiledIn<FArrayProperty>(NULL);
839 void* ArrayAddr = Stack.MostRecentPropertyAddress;
840 FArrayProperty* ArrayProperty = CastField<FArrayProperty>(Stack.MostRecentProperty);
841 if (!ArrayProperty)
842 {
843 Stack.bArrayContextFailed = true;
844 return;
845 }
846 // Since ItemToFind isn't really an int, step the stack manually
847 const FProperty* InnerProp = ArrayProperty->Inner;
848 const int32 PropertySize = InnerProp->GetElementSize() * InnerProp->ArrayDim;
849 void* StorageSpace = FMemory_Alloca(PropertySize);
850 InnerProp->InitializeValue(StorageSpace);
851
852 Stack.MostRecentPropertyAddress = nullptr;
853 Stack.MostRecentPropertyContainer = nullptr;
854 Stack.StepCompiledIn<FProperty>(StorageSpace);
856
857 P_FINISH;
858
859 // Bools need to be processed internally by the property so that C++ bool value is properly set.
860 GenericArray_HandleBool(InnerProp, ItemToFindPtr);
861
863 // Perform the search
864 *(int32*)RESULT_PARAM = GenericArray_Find(ArrayAddr, ArrayProperty, ItemToFindPtr);
866
867 InnerProp->DestroyValue(StorageSpace);
868 }
869
871 {
872 Stack.MostRecentProperty = nullptr;
873 Stack.StepCompiledIn<FArrayProperty>(NULL);
874 void* ArrayAddr = Stack.MostRecentPropertyAddress;
875 FArrayProperty* ArrayProperty = CastField<FArrayProperty>(Stack.MostRecentProperty);
876 if (!ArrayProperty)
877 {
878 Stack.bArrayContextFailed = true;
879 return;
880 }
881 // Since ItemToFind isn't really an int, step the stack manually
882 const FProperty* InnerProp = ArrayProperty->Inner;
883 const int32 PropertySize = InnerProp->GetElementSize() * InnerProp->ArrayDim;
884 void* StorageSpace = FMemory_Alloca(PropertySize);
885 InnerProp->InitializeValue(StorageSpace);
886
887 Stack.MostRecentPropertyAddress = nullptr;
888 Stack.MostRecentPropertyContainer = nullptr;
889 Stack.StepCompiledIn<FProperty>(StorageSpace);
891
892 P_FINISH;
893
894 // Bools need to be processed internally by the property so that C++ bool value is properly set.
895 GenericArray_HandleBool(InnerProp, ItemToFindPtr);
896
897 // Perform the search
899 *(bool*)RESULT_PARAM = GenericArray_Find(ArrayAddr, ArrayProperty, ItemToFindPtr) >= 0;
901
902 InnerProp->DestroyValue(StorageSpace);
903 }
904
906 {
909
910 Stack.StepCompiledIn<FArrayProperty>(NULL);
911 void* SrcArrayAddr = Stack.MostRecentPropertyAddress;
912 FArrayProperty* ArrayProperty = CastField<FArrayProperty>(Stack.MostRecentProperty);
913 if (!ArrayProperty)
914 {
915 Stack.bArrayContextFailed = true;
916 return;
917 }
918
919 P_FINISH;
920
922 MARK_PROPERTY_DIRTY(Stack.Object, Stack.MostRecentProperty);
923 GenericArray_SetArrayPropertyByName(OwnerObject, ArrayPropertyName, SrcArrayAddr);
925 }
926
928 {
929 Stack.MostRecentProperty = nullptr;
930 Stack.StepCompiledIn<FArrayProperty>(NULL);
931 void* ArrayAddr = Stack.MostRecentPropertyAddress;
932 FArrayProperty* ArrayProperty = CastField<FArrayProperty>(Stack.MostRecentProperty);
933 if (!ArrayProperty)
934 {
935 Stack.bArrayContextFailed = true;
936 return;
937 }
938
940
941 P_FINISH;
942
944 *(bool*)RESULT_PARAM = GenericArray_IsValidIndex(ArrayAddr, ArrayProperty, IndexToTest);
946 }
947
949 {
950 Stack.MostRecentProperty = nullptr;
951 Stack.StepCompiledIn<FArrayProperty>(nullptr);
952 void* ArrayAddr = Stack.MostRecentPropertyAddress;
953 FArrayProperty* ArrayProperty = CastField<FArrayProperty>(Stack.MostRecentProperty);
954 if (!ArrayProperty)
955 {
956 Stack.bArrayContextFailed = true;
957 return;
958 }
959
960 Stack.MostRecentProperty = nullptr;
961 Stack.StepCompiledIn<FProperty>(nullptr);
962 void* Result = Stack.MostRecentPropertyAddress;
963
964 Stack.MostRecentProperty = nullptr;
965 Stack.StepCompiledIn<FProperty>(nullptr);
966 int32* OutIndex = (int32*)Stack.MostRecentPropertyAddress;
967
968 P_FINISH;
970 GenericArray_Random(ArrayAddr, ArrayProperty, Result, OutIndex);
972 }
973
975 {
976 Stack.MostRecentProperty = nullptr;
977 Stack.StepCompiledIn<FArrayProperty>(nullptr);
978 void* ArrayAddr = Stack.MostRecentPropertyAddress;
979 FArrayProperty* ArrayProperty = CastField<FArrayProperty>(Stack.MostRecentProperty);
980 if (!ArrayProperty)
981 {
982 Stack.bArrayContextFailed = true;
983 return;
984 }
985
986 Stack.MostRecentProperty = nullptr;
987 Stack.StepCompiledIn<FProperty>(nullptr);
988 FRandomStream* RandomStream = (FRandomStream*)Stack.MostRecentPropertyAddress;
989
990 Stack.MostRecentProperty = nullptr;
991 Stack.StepCompiledIn<FProperty>(nullptr);
992 void* Result = Stack.MostRecentPropertyAddress;
993
994 Stack.MostRecentProperty = nullptr;
995 Stack.StepCompiledIn<FProperty>(nullptr);
996 int32* OutIndex = (int32*)Stack.MostRecentPropertyAddress;
997
998 P_FINISH;
1000 GenericArray_RandomFromStream(ArrayAddr, ArrayProperty, RandomStream, Result, OutIndex);
1002 }
1003};
#define NULL
Definition oodle2base.h:134
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
#define FMemory_Alloca(Size)
Definition GenericPlatformMemory.h:218
EArraySortOrder
Definition KismetArrayLibrary.h:20
#define UPARAM(...)
Definition ObjectMacros.h:748
#define UFUNCTION(...)
Definition ObjectMacros.h:745
#define GENERATED_UCLASS_BODY(...)
Definition ObjectMacros.h:768
#define UCLASS(...)
Definition ObjectMacros.h:776
#define UENUM(...)
Definition ObjectMacros.h:749
#define MARK_PROPERTY_DIRTY(Object, Property)
Definition PushModel.h:475
#define P_FINISH
Definition ScriptMacros.h:141
#define P_GET_PROPERTY(PropertyType, ParamName)
Definition ScriptMacros.h:51
#define P_GET_OBJECT(ObjectType, ParamName)
Definition ScriptMacros.h:71
#define P_NATIVE_END
Definition ScriptMacros.h:148
#define P_GET_UBOOL(ParamName)
Definition ScriptMacros.h:61
#define P_NATIVE_BEGIN
Definition ScriptMacros.h:147
#define RESULT_PARAM
Definition Script.h:91
uint32 Size
Definition VulkanMemory.cpp:4034
uint8_t uint8
Definition binka_ue_file_header.h:8
Definition Actor.h:257
Definition UnrealType.h:3702
Definition Field.h:66
Definition UnrealType.h:2304
Definition UnrealType.h:3649
Definition NameTypes.h:617
Definition UnrealType.h:174
void DestroyValue(void *Dest) const
Definition UnrealType.h:1025
int32 GetElementSize() const
Definition UnrealType.h:291
Definition UnrealType.h:4175
Definition Array.h:670
Definition SubclassOf.h:30
Definition BlueprintFunctionLibrary.h:16
Definition KismetArrayLibrary.h:27
DECLARE_FUNCTION(execArray_Clear)
Definition KismetArrayLibrary.h:617
DECLARE_FUNCTION(execArray_Remove)
Definition KismetArrayLibrary.h:565
DECLARE_FUNCTION(execArray_RandomFromStream)
Definition KismetArrayLibrary.h:974
DECLARE_FUNCTION(execArray_IsValidIndex)
Definition KismetArrayLibrary.h:927
DECLARE_FUNCTION(execArray_Shuffle)
Definition KismetArrayLibrary.h:437
DECLARE_FUNCTION(execArray_Add)
Definition KismetArrayLibrary.h:379
DECLARE_FUNCTION(execArray_Reverse)
Definition KismetArrayLibrary.h:652
DECLARE_FUNCTION(execArray_LastIndex)
Definition KismetArrayLibrary.h:720
static int32 GetLastIndex(const FScriptArrayHelper &ArrayHelper)
Definition KismetArrayLibrary.h:373
DECLARE_FUNCTION(execArray_Contains)
Definition KismetArrayLibrary.h:870
DECLARE_FUNCTION(execArray_RemoveItem)
Definition KismetArrayLibrary.h:584
DECLARE_FUNCTION(execArray_Length)
Definition KismetArrayLibrary.h:669
DECLARE_FUNCTION(execArray_Get)
Definition KismetArrayLibrary.h:737
DECLARE_FUNCTION(execArray_Append)
Definition KismetArrayLibrary.h:506
DECLARE_FUNCTION(execArray_IsNotEmpty)
Definition KismetArrayLibrary.h:703
DECLARE_FUNCTION(execArray_Swap)
Definition KismetArrayLibrary.h:814
DECLARE_FUNCTION(execArray_Random)
Definition KismetArrayLibrary.h:948
DECLARE_FUNCTION(execArray_AddUnique)
Definition KismetArrayLibrary.h:408
DECLARE_FUNCTION(execArray_ShuffleFromStream)
Definition KismetArrayLibrary.h:455
DECLARE_FUNCTION(execArray_Resize)
Definition KismetArrayLibrary.h:634
DECLARE_FUNCTION(execSetArrayPropertyByName)
Definition KismetArrayLibrary.h:905
DECLARE_FUNCTION(execArray_Identical)
Definition KismetArrayLibrary.h:477
DECLARE_FUNCTION(execArray_Set)
Definition KismetArrayLibrary.h:780
DECLARE_FUNCTION(execArray_Insert)
Definition KismetArrayLibrary.h:535
DECLARE_FUNCTION(execArray_Find)
Definition KismetArrayLibrary.h:835
static ENGINE_API const FName ReachedMaximumContainerSizeWarning
Definition KismetArrayLibrary.h:370
DECLARE_FUNCTION(execArray_IsEmpty)
Definition KismetArrayLibrary.h:686
Definition Object.h:95
U16 Index
Definition radfft.cpp:71
Definition RandomStream.h:20
Definition NumericLimits.h:41