12#include "Engine/Selection.h"
13#include "ScopedTransaction.h"
14#include "Algo/Unique.h"
19int32 UListActorComponent::GatherSelectedItem(TArray<AActor*>& Out)
const
25 TArray<AActor*> Selected;
26 GEditor->GetSelectedActors()->GetSelectedObjects<AActor>(Selected);
28 for (AActor* A : Selected)
33 if (ClassFilter && !A->IsA(ClassFilter))
39 Out.Sort([](
const AActor& L,
const AActor& R){
40 return L.GetFName().LexicalLess(R.GetFName());
43 Out.SetNum(Algo::Unique(Out));
49void UListActorComponent::AssignInternal(
const bool bAppend)
51 TArray<AActor*> Picked;
52 const int32 Count = GatherSelectedItem(Picked);
56 const FScopedTransaction Tx(NSLOCTEXT(
"ListActorManager",
"AssignFromSelection",
"Assign Items From Selection"));
64 for (AActor* A : Picked)
69 ArrayActors.AddUnique(A);
72 if (UPackage* Pkg = GetOutermost())
74 Pkg->SetDirtyFlag(
true);
80void UListActorComponent::AssignItemReplace()
83 AssignInternal(
false);
88void UListActorComponent::AssignItemAppend()
97void UListActorComponent::SortByNameAsc()
100 const FScopedTransaction Tx(
101 NSLOCTEXT(
"ListActorManager",
"SortByNameAsc",
"Sort ArrayActors by Name Asc")
105 ArrayActors.Sort([](
const AActor& L,
const AActor& R) {
106 return L.GetActorLabel() < R.GetActorLabel();
109 if (UPackage* Pkg = GetOutermost())
111 Pkg->SetDirtyFlag(
true);
117void UListActorComponent::SortByNameDesc()
120 const FScopedTransaction Tx(
121 NSLOCTEXT(
"ListActorManager",
"SortByNameDesc",
"Sort ArrayActors by Name Desc")
125 ArrayActors.Sort([](
const AActor& L,
const AActor& R) {
126 return L.GetActorLabel() > R.GetActorLabel();
129 if (UPackage* Pkg = GetOutermost())
131 Pkg->SetDirtyFlag(
true);
UListActorComponent 클래스를 선언합니다.