@@ -24,6 +24,41 @@ bool FTextAssetActions::CanFilter()
24
24
}
25
25
26
26
27
+ void FTextAssetActions::GetActions (const TArray<UObject*>& InObjects, FMenuBuilder& MenuBuilder)
28
+ {
29
+ FAssetTypeActions_Base::GetActions (InObjects, MenuBuilder);
30
+
31
+ auto TextAssets = GetTypedWeakObjectPtrs<UTextAsset>(InObjects);
32
+
33
+ MenuBuilder.AddMenuEntry (
34
+ LOCTEXT (" TextAsset_ReverseText" , " Reverse Text" ),
35
+ LOCTEXT (" TextAsset_ReverseTextToolTip" , " Reverse the text stored in the selected text asset(s)." ),
36
+ FSlateIcon (),
37
+ FUIAction (
38
+ FExecuteAction::CreateLambda ([=]{
39
+ for (auto & TextAsset : TextAssets)
40
+ {
41
+ if (TextAsset.IsValid () && !TextAsset->Text .IsEmpty ())
42
+ {
43
+ TextAsset->Text = FText::FromString (TextAsset->Text .ToString ().Reverse ());
44
+ }
45
+ }
46
+ }),
47
+ FCanExecuteAction::CreateLambda ([=] {
48
+ for (auto & TextAsset : TextAssets)
49
+ {
50
+ if (TextAsset.IsValid () && !TextAsset->Text .IsEmpty ())
51
+ {
52
+ return true ;
53
+ }
54
+ }
55
+ return false ;
56
+ })
57
+ )
58
+ );
59
+ }
60
+
61
+
27
62
uint32 FTextAssetActions::GetCategories ()
28
63
{
29
64
return EAssetTypeCategories::Misc;
@@ -50,7 +85,7 @@ FColor FTextAssetActions::GetTypeColor() const
50
85
51
86
bool FTextAssetActions::HasActions (const TArray<UObject*>& InObjects) const
52
87
{
53
- return false ;
88
+ return true ;
54
89
}
55
90
56
91
@@ -73,5 +108,4 @@ void FTextAssetActions::OpenAssetEditor(const TArray<UObject*>& InObjects, TShar
73
108
}
74
109
75
110
76
-
77
111
#undef LOCTEXT_NAMESPACE
0 commit comments