UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
TypedElementSelectionSet.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "Containers/Array.h"
14#include "HAL/Platform.h"
15#include "Templates/Function.h"
18#include "Templates/Tuple.h"
19#include "Templates/UniquePtr.h"
21#include "UObject/Object.h"
26
27#include "TypedElementSelectionSet.generated.h"
28
29class FArchive;
30class UClass;
31class UInterface;
33struct FFrame;
34
35USTRUCT(BlueprintType)
37{
39
40public:
42 bool ExpandGroups() const { return bExpandGroups; }
43
45 bool FollowAttachment() const { return bFollowAttachment; }
46
47 // Set the selection set name that will be passed into the selection column in TEDS (if it is enabled)
49 FName GetNameForTEDSIntegration() const { return TEDSIntegrationSelectionSetName; }
50
51private:
52 UPROPERTY(BlueprintReadWrite, Category="TypedElementInterfaces|Selection|NormalizationOptions", meta=(AllowPrivateAccess=true))
53 bool bExpandGroups = false;
54
55 UPROPERTY(BlueprintReadWrite, Category="TypedElementInterfaces|Selection|NormalizationOptions", meta=(AllowPrivateAccess=true))
56 bool bFollowAttachment = false;
57
58 FName TEDSIntegrationSelectionSetName = FName();
59};
60
66{
67public:
69
70 //~ See ITypedElementSelectionInterface for API docs
79};
80
85{
86public:
88
95
98
101
102 inline explicit operator bool() const
103 {
104 return IsSet();
105 }
106
107 inline bool IsSet() const
108 {
109 return ElementSelectionHandle.IsSet()
110 && ElementList
111 && SelectionCustomization;
112 }
113
114 //~ See ITypedElementSelectionInterface for API docs
115 bool IsElementSelected(const FTypedElementIsSelectedOptions& InSelectionOptions) const { return SelectionCustomization->IsElementSelected(ElementSelectionHandle, ElementList.ToSharedRef(), InSelectionOptions); }
116 bool CanSelectElement(const FTypedElementSelectionOptions& InSelectionOptions) const { return SelectionCustomization->CanSelectElement(ElementSelectionHandle, InSelectionOptions); }
117 bool CanDeselectElement(const FTypedElementSelectionOptions& InSelectionOptions) const { return SelectionCustomization->CanDeselectElement(ElementSelectionHandle, InSelectionOptions); }
118 bool SelectElement(const FTypedElementSelectionOptions& InSelectionOptions) const { return SelectionCustomization->SelectElement(ElementSelectionHandle, ElementList.ToSharedRef(), InSelectionOptions); }
119 bool DeselectElement(const FTypedElementSelectionOptions& InSelectionOptions) const { return SelectionCustomization->DeselectElement(ElementSelectionHandle, ElementList.ToSharedRef(), InSelectionOptions); }
120 bool AllowSelectionModifiers() const { return SelectionCustomization->AllowSelectionModifiers(ElementSelectionHandle, ElementList.ToSharedRef()); }
121 FTypedElementHandle GetSelectionElement(const ETypedElementSelectionMethod InSelectionMethod) const { return SelectionCustomization->GetSelectionElement(ElementSelectionHandle, ElementList.ToSharedRef(), InSelectionMethod); }
123
124private:
126 FTypedElementListPtr ElementList;
127 FTypedElementSelectionCustomization* SelectionCustomization = nullptr;
128};
129
130USTRUCT(BlueprintType)
132{
134
136
138
141
143 : CreatedFromSelectionSet(InOther.CreatedFromSelectionSet)
144 {
145 TransactedElements.Reserve(InOther.TransactedElements.Num());
147 {
148 TransactedElements.Emplace(OtherTransactedElement->Clone());
149 }
150 }
151
153 {
154 if (&InOther != this)
155 {
156 CreatedFromSelectionSet = InOther.CreatedFromSelectionSet;
157
158 TransactedElements.Reset(InOther.TransactedElements.Num());
160 {
161 TransactedElements.Emplace(OtherTransactedElement->Clone());
162 }
163 }
164 return *this;
165 }
166
167private:
168 UPROPERTY()
169 TWeakObjectPtr<const UTypedElementSelectionSet> CreatedFromSelectionSet;
170
172};
173
178UCLASS(Transient, BlueprintType, meta=(DontUseGenericSpawnObject="True"), MinimalAPI)
180{
182
183public:
185
186 //~ UObject interface
187#if WITH_EDITOR
188 TYPEDELEMENTRUNTIME_API virtual void PreEditUndo() override;
189 TYPEDELEMENTRUNTIME_API virtual void PostEditUndo() override;
190 TYPEDELEMENTRUNTIME_API virtual bool Modify(bool bAlwaysMarkDirty = true) override;
191#endif // WITH_EDITOR
192 TYPEDELEMENTRUNTIME_API virtual void BeginDestroy() override;
193 TYPEDELEMENTRUNTIME_API virtual void Serialize(FArchive& Ar) override;
194
199
204
209
215
223
229
237
242 UFUNCTION(BlueprintCallable, Category="TypedElementFramework|Selection")
244
253
257 TYPEDELEMENTRUNTIME_API bool AllowSelectionModifiers(const FTypedElementHandle& InElementHandle) const;
258
262 TYPEDELEMENTRUNTIME_API void SetNameForTedsIntegration(const FName InNameForIntegration);
263
268
275
282
286 UFUNCTION(BlueprintPure, Category="TypedElementFramework|Selection")
287 int32 GetNumSelectedElements() const
288 {
289 return ElementList->Num();
290 }
291
295 UFUNCTION(BlueprintCallable, BlueprintPure=false, Category="TypedElementFramework|Selection")
296 bool HasSelectedElements(const TSubclassOf<UInterface> InBaseInterfaceType = {}) const
297 {
298 return ElementList->HasElements(InBaseInterfaceType);
299 }
300
304 UFUNCTION(BlueprintCallable, BlueprintPure=false, Category="TypedElementFramework|Selection")
305 int32 CountSelectedElements(const TSubclassOf<UInterface> InBaseInterfaceType = {}) const
306 {
307 return ElementList->CountElements(InBaseInterfaceType);
308 }
309
314 {
315 return ElementList->GetElementHandles(InBaseInterfaceType);
316 }
317
321 template <typename ArrayAllocator>
326
332 {
333 ElementList->ForEachElementHandle(InCallback, InBaseInterfaceType);
334 }
335
340 template <typename BaseInterfaceType>
342 {
343 ElementList->ForEachElement<BaseInterfaceType>(InCallback);
344 }
345
349 template <typename BaseInterfaceType>
351 {
352 return ElementList->GetTopElement<BaseInterfaceType>();
353 }
354
359 template <typename BaseInterfaceType>
361 {
362 return ElementList->GetTopElement<BaseInterfaceType>(Predicate);
363 }
364
368 template <typename BaseInterfaceType>
370 {
371 return ElementList->GetBottomElement<BaseInterfaceType>();
372 }
373
378 template <typename BaseInterfaceType>
380 {
381 return ElementList->GetBottomElement<BaseInterfaceType>(Predicate);
382 }
383
387 UFUNCTION(BlueprintCallable, BlueprintPure=false, Category="TypedElementFramework|Selection")
388 bool HasSelectedObjects(const UClass* InRequiredClass = nullptr) const
389 {
390 return TypedElementListObjectUtil::HasObjects(ElementList.ToSharedRef(), InRequiredClass);
391 }
392
396 template <typename RequiredClassType>
398 {
399 return TypedElementListObjectUtil::HasObjects<RequiredClassType>(ElementList.ToSharedRef());
400 }
401
405 UFUNCTION(BlueprintCallable, BlueprintPure=false, Category="TypedElementFramework|Selection")
406 int32 CountSelectedObjects(const UClass* InRequiredClass = nullptr) const
407 {
408 return TypedElementListObjectUtil::CountObjects(ElementList.ToSharedRef(), InRequiredClass);
409 }
410
414 template <typename RequiredClassType>
416 {
417 return TypedElementListObjectUtil::CountObjects<RequiredClassType>(ElementList.ToSharedRef());
418 }
419
423 UFUNCTION(BlueprintCallable, BlueprintPure=false, Category="TypedElementFramework|Selection")
424 TArray<UObject*> GetSelectedObjects(const UClass* InRequiredClass = nullptr) const
425 {
426 return TypedElementListObjectUtil::GetObjects(ElementList.ToSharedRef(), InRequiredClass);
427 }
428
432 template <typename RequiredClassType>
434 {
435 return TypedElementListObjectUtil::GetObjects<RequiredClassType>(ElementList.ToSharedRef());
436 }
437
443 {
445 }
446
451 template <typename RequiredClassType>
453 {
454 TypedElementListObjectUtil::ForEachObject<RequiredClassType>(ElementList.ToSharedRef(), InCallback);
455 }
456
460 UFUNCTION(BlueprintPure, Category="TypedElementFramework|Selection")
461 UObject* GetTopSelectedObject(const UClass* InRequiredClass = nullptr) const
462 {
463 return TypedElementListObjectUtil::GetTopObject(ElementList.ToSharedRef(), InRequiredClass);
464 }
465
469 template <typename RequiredClassType>
471 {
472 return TypedElementListObjectUtil::GetTopObject<RequiredClassType>(ElementList.ToSharedRef());
473 }
474
478 UFUNCTION(BlueprintPure, Category="TypedElementFramework|Selection")
479 UObject* GetBottomSelectedObject(const UClass* InRequiredClass = nullptr) const
480 {
481 return TypedElementListObjectUtil::GetBottomObject(ElementList.ToSharedRef(), InRequiredClass);
482 }
483
487 template <typename RequiredClassType>
489 {
490 return TypedElementListObjectUtil::GetBottomObject<RequiredClassType>(ElementList.ToSharedRef());
491 }
492
499 {
500 return OnPreChangeDelegate;
501 }
502
509 {
510 return OnChangedDelegate;
511 }
512
517 {
518 ElementList->NotifyPendingChanges();
519 }
520
525 {
526 return ElementList->GetScopedClearNewPendingChange();
527 }
528
534 {
535 return ElementList->Legacy_GetSync();
536 }
537
543 {
544 return ElementList->Legacy_GetSyncPtr();
545 }
546
551 {
552 return ElementList.ToSharedRef();
553 }
554
561 UFUNCTION(BlueprintPure, Category = "TypedElementFramework|Selection")
562 TYPEDELEMENTRUNTIME_API FTypedElementSelectionSetState GetCurrentSelectionState() const;
563
568 UFUNCTION(BlueprintCallable, Category = "TypedElementFramework|Selection")
570
571
572 /*
573 * Script Api
574 */
575
579 UFUNCTION(BlueprintPure, Category="TypedElementFramework|Selection")
581
585 UFUNCTION(BlueprintPure, Category="TypedElementFramework|Selection")
587
591 UFUNCTION(BlueprintPure, Category="TypedElementFramework|Selection")
593
598 UFUNCTION(BlueprintCallable, Category="TypedElementFramework|Selection")
600
605 UFUNCTION(BlueprintCallable, Category="TypedElementFramework|Selection")
607
612 UFUNCTION(BlueprintCallable, Category="TypedElementFramework|Selection")
614
619 UFUNCTION(BlueprintCallable, Category="TypedElementFramework|Selection")
621
627 UFUNCTION(BlueprintCallable, Category="TypedElementFramework|Selection")
629
633 UFUNCTION(BlueprintPure, Category="TypedElementFramework|Selection")
634 TYPEDELEMENTRUNTIME_API bool AllowSelectionModifiers(const FScriptTypedElementHandle& InElementHandle) const;
635
639 UFUNCTION(BlueprintPure, Category = "TypedElementFramework|Selection")
641
642
646 UFUNCTION(BlueprintCallable, BlueprintPure=false, DisplayName="Get Selected Element Handles", Category="TypedElementFramework|Selection", meta=(ScriptName="GetSelectedElementHandles"))
648
650
652 UPROPERTY(BlueprintAssignable, Category = "TypedElementFramework|Selection")
653 FOnPreChangeDynamic OnPreSelectionChange;
654
656
658 UPROPERTY(BlueprintAssignable, Category = "TypedElementFramework|Selection")
659 FOnChangeDynamic OnSelectionChange;
660
661private:
666
671
676
680 TYPEDELEMENTRUNTIME_API void OnElementListPreChange(const FTypedElementList& InElementList);
681
685 TYPEDELEMENTRUNTIME_API void OnElementListChanged(const FTypedElementList& InElementList);
686
688 FTypedElementListPtr ElementList;
689
691 FOnPreChange OnPreChangeDelegate;
692
694 FOnChanged OnChangedDelegate;
695
697 bool bIsRestoringState = false;
698
704 TUniquePtr<FTypedElementSelectionSetState> PendingUndoRedoState;
705
706 FName ListNameForTedsIntegration;
707};
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 DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(DelegateName, Param1Type, Param1Name)
Definition DelegateCombinations.h:53
return true
Definition ExternalRpcRegistry.cpp:601
const bool
Definition NetworkReplayStreaming.h:178
#define UPROPERTY(...)
UObject definition macros.
Definition ObjectMacros.h:744
#define GENERATED_BODY(...)
Definition ObjectMacros.h:765
#define UFUNCTION(...)
Definition ObjectMacros.h:745
#define UCLASS(...)
Definition ObjectMacros.h:776
#define USTRUCT(...)
Definition ObjectMacros.h:746
ETypedElementSelectionMethod
Definition TypedElementSelectionInterface.h:25
UE_INTRINSIC_CAST UE_REWRITE constexpr std::remove_reference_t< T > && MoveTemp(T &&Obj) noexcept
Definition UnrealTemplate.h:520
Definition Archive.h:1208
Definition NameTypes.h:617
Definition TypedElementSelectionSet.h:66
virtual bool IsElementSelected(const TTypedElement< ITypedElementSelectionInterface > &InElementSelectionHandle, FTypedElementListConstRef InSelectionSet, const FTypedElementIsSelectedOptions &InSelectionOptions)
Definition TypedElementSelectionSet.h:71
virtual bool AllowSelectionModifiers(const TTypedElement< ITypedElementSelectionInterface > &InElementSelectionHandle, FTypedElementListConstRef InSelectionSet)
Definition TypedElementSelectionSet.h:76
virtual FTypedElementHandle GetSelectionElement(const TTypedElement< ITypedElementSelectionInterface > &InElementSelectionHandle, FTypedElementListConstRef InCurrentSelection, const ETypedElementSelectionMethod InSelectionMethod)
Definition TypedElementSelectionSet.h:77
virtual ~FTypedElementSelectionCustomization()=default
virtual TYPEDELEMENTRUNTIME_API void GetNormalizedElements(const TTypedElement< ITypedElementSelectionInterface > &InElementSelectionHandle, FTypedElementListConstRef InSelectionSet, const FTypedElementSelectionNormalizationOptions &InNormalizationOptions, FTypedElementListRef OutNormalizedElements)
Definition TypedElementSelectionSet.cpp:20
virtual bool CanDeselectElement(const TTypedElement< ITypedElementSelectionInterface > &InElementSelectionHandle, const FTypedElementSelectionOptions &InSelectionOptions)
Definition TypedElementSelectionSet.h:73
virtual bool DeselectElement(const TTypedElement< ITypedElementSelectionInterface > &InElementSelectionHandle, FTypedElementListRef InSelectionSet, const FTypedElementSelectionOptions &InSelectionOptions)
Definition TypedElementSelectionSet.h:75
virtual bool CanSelectElement(const TTypedElement< ITypedElementSelectionInterface > &InElementSelectionHandle, const FTypedElementSelectionOptions &InSelectionOptions)
Definition TypedElementSelectionSet.h:72
virtual bool SelectElement(const TTypedElement< ITypedElementSelectionInterface > &InElementSelectionHandle, FTypedElementListRef InSelectionSet, const FTypedElementSelectionOptions &InSelectionOptions)
Definition TypedElementSelectionSet.h:74
Definition TypedElementSelectionInterface.h:115
Definition ArrayView.h:139
Definition Array.h:670
Definition AssetRegistryState.h:50
TSharedRef< ObjectType, Mode > ToSharedRef() const &
Definition SharedPointer.h:1028
Definition SharedPointer.h:153
Definition SubclassOf.h:30
Definition TypedElementInterfaceCustomization.h:40
Definition TypedElementList.h:589
Definition TypedElementList.h:62
Definition UniquePtr.h:107
Definition TypedElementFramework.Build.cs:8
Definition Class.h:3793
Definition Interface.h:19
Definition Object.h:95
Definition TypedElementSelectionSet.h:180
RequiredClassType * GetBottomSelectedObject() const
Definition TypedElementSelectionSet.h:488
FTypedElementList::FScopedClearNewPendingChange GetScopedClearNewPendingChange()
Definition TypedElementSelectionSet.h:524
void ForEachSelectedObject(TFunctionRef< bool(UObject *)> InCallback, const UClass *InRequiredClass=nullptr) const
Definition TypedElementSelectionSet.h:442
FOnPreChange & OnPreChange()
Definition TypedElementSelectionSet.h:498
DECLARE_EVENT_OneParam(UTypedElementSelectionSet, FOnPreChange, const UTypedElementSelectionSet *)
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnPreChangeDynamic, const UTypedElementSelectionSet *, SelectionSet)
TTypedElement< BaseInterfaceType > GetTopSelectedElement() const
Definition TypedElementSelectionSet.h:350
TArray< RequiredClassType * > GetSelectedObjects() const
Definition TypedElementSelectionSet.h:433
FTypedElementList::FLegacySync * Legacy_GetElementListSyncPtr()
Definition TypedElementSelectionSet.h:542
DECLARE_EVENT_OneParam(UTypedElementSelectionSet, FOnChanged, const UTypedElementSelectionSet *)
TArray< FTypedElementHandle > GetSelectedElementHandles(const TSubclassOf< UInterface > InBaseInterfaceType={}) const
Definition TypedElementSelectionSet.h:313
bool HasSelectedObjects() const
Definition TypedElementSelectionSet.h:397
void NotifyPendingChanges()
Definition TypedElementSelectionSet.h:516
TTypedElement< BaseInterfaceType > GetBottomSelectedElement() const
Definition TypedElementSelectionSet.h:369
FTypedElementList::FLegacySync & Legacy_GetElementListSync()
Definition TypedElementSelectionSet.h:533
int32 CountSelectedObjects() const
Definition TypedElementSelectionSet.h:415
FOnChanged & OnChanged()
Definition TypedElementSelectionSet.h:508
TTypedElement< BaseInterfaceType > GetTopSelectedElement(TFunctionRef< bool(const TTypedElement< BaseInterfaceType > &)> Predicate) const
Definition TypedElementSelectionSet.h:360
RequiredClassType * GetTopSelectedObject() const
Definition TypedElementSelectionSet.h:470
void GetSelectedElementHandles(TArray< FTypedElementHandle, ArrayAllocator > &OutArray, const TSubclassOf< UInterface > &InBaseInterfaceType={}) const
Definition TypedElementSelectionSet.h:322
FTypedElementListConstRef GetElementList() const
Definition TypedElementSelectionSet.h:550
void ForEachSelectedObject(TFunctionRef< bool(RequiredClassType *)> InCallback) const
Definition TypedElementSelectionSet.h:452
void ForEachSelectedElementHandle(TFunctionRef< bool(const FTypedElementHandle &)> InCallback, const TSubclassOf< UInterface > &InBaseInterfaceType={}) const
Definition TypedElementSelectionSet.h:331
void ForEachSelectedElement(TFunctionRef< bool(const TTypedElement< BaseInterfaceType > &)> InCallback) const
Definition TypedElementSelectionSet.h:341
TTypedElement< BaseInterfaceType > GetBottomSelectedElement(TFunctionRef< bool(const TTypedElement< BaseInterfaceType > &)> Predicate) const
Definition TypedElementSelectionSet.h:379
UObject * GetBottomObject(FTypedElementListConstRef InElementList, const UClass *InRequiredClass)
Definition TypedElementListObjectUtil.cpp:85
int32 CountObjects(FTypedElementListConstRef InElementList, const UClass *InRequiredClass)
Definition TypedElementListObjectUtil.cpp:30
void ForEachObject(FTypedElementListConstRef InElementList, TFunctionRef< bool(UObject *)> InCallback, const UClass *InRequiredClass)
Definition TypedElementListObjectUtil.cpp:43
TArray< UObject * > GetObjects(FTypedElementListConstRef InElementList, const UClass *InRequiredClass)
Definition TypedElementListObjectUtil.cpp:55
bool HasObjects(FTypedElementListConstRef InElementList, const UClass *InRequiredClass)
Definition TypedElementListObjectUtil.cpp:17
UObject * GetTopObject(FTypedElementListConstRef InElementList, const UClass *InRequiredClass)
Definition TypedElementListObjectUtil.cpp:69
@ false
Definition radaudio_common.h:23
Definition Stack.h:114
Definition TypedElementHandle.h:625
Definition TypedElementHandle.h:18
Definition TypedElementSelectionInterface.h:47
Definition TypedElementSelectionSet.h:37
FName GetNameForTEDSIntegration() const
Definition TypedElementSelectionSet.h:49
FTypedElementSelectionNormalizationOptions & SetFollowAttachment(const bool InFollowAttachment)
Definition TypedElementSelectionSet.h:44
FTypedElementSelectionNormalizationOptions & SetNameForTEDSIntegration(const FName &InTEDSIntegrationSelectionSetName)
Definition TypedElementSelectionSet.h:48
bool ExpandGroups() const
Definition TypedElementSelectionSet.h:42
bool FollowAttachment() const
Definition TypedElementSelectionSet.h:45
FTypedElementSelectionNormalizationOptions & SetExpandGroups(const bool InExpandGroups)
Definition TypedElementSelectionSet.h:41
Definition TypedElementSelectionInterface.h:67
Definition TypedElementSelectionSet.h:85
FTypedElementHandle GetSelectionElement(const ETypedElementSelectionMethod InSelectionMethod) const
Definition TypedElementSelectionSet.h:121
FTypedElementSelectionSetElement(FTypedElementSelectionSetElement &&)=default
bool CanSelectElement(const FTypedElementSelectionOptions &InSelectionOptions) const
Definition TypedElementSelectionSet.h:116
bool AllowSelectionModifiers() const
Definition TypedElementSelectionSet.h:120
bool DeselectElement(const FTypedElementSelectionOptions &InSelectionOptions) const
Definition TypedElementSelectionSet.h:119
bool CanDeselectElement(const FTypedElementSelectionOptions &InSelectionOptions) const
Definition TypedElementSelectionSet.h:117
bool IsSet() const
Definition TypedElementSelectionSet.h:107
FTypedElementSelectionSetElement & operator=(const FTypedElementSelectionSetElement &)=default
FTypedElementSelectionSetElement(const FTypedElementSelectionSetElement &)=default
bool IsElementSelected(const FTypedElementIsSelectedOptions &InSelectionOptions) const
Definition TypedElementSelectionSet.h:115
FTypedElementSelectionSetElement & operator=(FTypedElementSelectionSetElement &&)=default
void GetNormalizedElements(const FTypedElementSelectionNormalizationOptions &InNormalizationOptions, FTypedElementListRef OutNormalizedElements) const
Definition TypedElementSelectionSet.h:122
bool SelectElement(const FTypedElementSelectionOptions &InSelectionOptions) const
Definition TypedElementSelectionSet.h:118
FTypedElementSelectionSetElement(TTypedElement< ITypedElementSelectionInterface > InElementSelectionHandle, FTypedElementListPtr InElementList, FTypedElementSelectionCustomization *InSelectionCustomization)
Definition TypedElementSelectionSet.h:89
Definition TypedElementSelectionSet.h:132
FTypedElementSelectionSetState & operator=(const FTypedElementSelectionSetState &InOther)
Definition TypedElementSelectionSet.h:152
Definition Tuple.h:652
bool IsSet() const
Definition TypedElementHandle.h:312
Definition TypedElementList.h:568
Definition TypedElementHandle.h:396
Definition WeakObjectPtrTemplates.h:25
FORCEINLINE void Reset()
Definition WeakObjectPtrTemplates.h:92