KLingo Project Documentation 1.0.0
Unreal Engine 5.6 C++ Project Documentation
로딩중...
검색중...
일치하는것 없음
AListActorManager.cpp
이 파일의 문서화 페이지로 가기
1// Copyright (c) 2025 Doppleddiggong. All rights reserved. Unauthorized copying, modification, or distribution of this file, via any medium is strictly prohibited. Proprietary and confidential.
2
7#include "AListActorManager.h"
8
9#if WITH_EDITOR
10#include "Editor.h"
11#include "Engine/Selection.h"
12#include "ScopedTransaction.h"
13#include "Algo/Unique.h"
14#endif
15
16#if WITH_EDITOR
18int32 AListActorManager::GatherSelectedItem(TArray<AActor*>& Out) const
19{
20 Out.Reset();
21 if (!GEditor)
22 return 0;
23
24 TArray<AActor*> Selected;
25 GEditor->GetSelectedActors()->GetSelectedObjects<AActor>(Selected);
26
27 for (AActor* A : Selected)
28 {
29 if (!IsValid(A))
30 continue;
31
32 if (ClassFilter && !A->IsA(ClassFilter))
33 continue;
34 Out.Add(A);
35 }
36
37 // 일관성: 이름 정렬 + 중복 제거
38 Out.Sort([](const AActor& L, const AActor& R){
39 return L.GetFName().LexicalLess(R.GetFName());
40 });
41
42 Out.SetNum(Algo::Unique(Out));
43
44 return Out.Num();
45}
46
48void AListActorManager::AssignInternal(const bool bAppend)
49{
50 TArray<AActor*> Picked;
51 const int32 Count = GatherSelectedItem(Picked);
52 if (Count <= 0)
53 return;
54
55 const FScopedTransaction Tx(NSLOCTEXT("ListActorManager", "AssignFromSelection", "Assign Items From Selection"));
56 Modify();
57
58 if (!bAppend)
59 {
60 ArrayActors.Reset();
61 }
62
63 for (AActor* A : Picked)
64 {
65 if (!IsValid(A))
66 continue;
67
68 ArrayActors.AddUnique(A);
69 }
70
71 if (UPackage* Pkg = GetOutermost())
72 {
73 Pkg->SetDirtyFlag(true);
74 }
75}
76#endif // WITH_EDITOR
77
79void AListActorManager::AssignItemReplace()
80{
81#if WITH_EDITOR
82 AssignInternal(false);
83#endif
84}
85
87void AListActorManager::AssignItemAppend()
88{
89#if WITH_EDITOR
90 AssignInternal(true);
91#endif
92}
93
94
96void AListActorManager::SortByNameAsc()
97{
98#if WITH_EDITOR
99 const FScopedTransaction Tx(
100 NSLOCTEXT("ListActorManager", "SortByNameAsc", "Sort ArrayActors by Name Asc")
101 );
102 Modify();
103
104 ArrayActors.Sort([](const AActor& L, const AActor& R) {
105 return L.GetActorLabel() < R.GetActorLabel();
106 });
107
108 if (UPackage* Pkg = GetOutermost())
109 {
110 Pkg->SetDirtyFlag(true);
111 }
112#endif
113}
114
116void AListActorManager::SortByNameDesc()
117{
118#if WITH_EDITOR
119 const FScopedTransaction Tx(
120 NSLOCTEXT("ListActorManager", "SortByNameDesc", "Sort ArrayActors by Name Desc")
121 );
122 Modify();
123
124 ArrayActors.Sort([](const AActor& L, const AActor& R) {
125 return L.GetActorLabel() > R.GetActorLabel();
126 });
127
128 if (UPackage* Pkg = GetOutermost())
129 {
130 Pkg->SetDirtyFlag(true);
131 }
132#endif
133}
AListActorManager 클래스를 선언합니다.
TArray< AActor * > ArrayActors
수집된 액터 목록.
TSubclassOf< AActor > ClassFilter
허용할 액터 클래스 필터.