A Demo Project for the UnrealEngineSDK
Loading...
Searching...
No Matches
DialogueContentBrowserExtensions.cpp
Go to the documentation of this file.
1// Copyright Csaba Molnar, Daniel Butum. All Rights Reserved.
3
4#include "ContentBrowserModule.h"
5#include "DlgConstants.h"
6#include "DlgEventCustom.h"
7#include "Engine/Blueprint.h"
8
9#include "DlgManager.h"
11
12#define LOCTEXT_NAMESPACE "DialogueSystemContentBrowserExtensions"
13
14
15// //////////////////////////////////////////////////////////////////////////
16// // A filter that searches for Dialogues
17// // We use this because it allows us more flexibility FAssetTypeActions_DlgDialogue
18// // NOTE: Because this is a frontend filter we can't combine it with the other backend filters (blueprint, texture, particles, etc)
19// // Unreal does not allow you to have custom backend filters, which is kinda retarded
20// class FFrontendFilter_Dialogue : public FFrontendFilter
21// {
22// public:
23// FFrontendFilter_Dialogue(const TSharedPtr<FFrontendFilterCategory>& InCategory)
24// : FFrontendFilter(InCategory)
25// {
26// }
27//
28// //
29// // FFrontendFilter implementation
30// //
31//
32// FString GetName() const override
33// {
34// return TEXT("Dialogue");
35// }
36// FText GetDisplayName() const override
37// {
38// return LOCTEXT("FilterDialogue_Name", "Dialogue");
39// }
40// FText GetToolTipText() const override
41// {
42// return LOCTEXT("FilterDialogue_ToolTip", "Filter By Dialogue");
43// }
44//
45// FLinearColor GetColor() const override { return FLinearColor::Yellow; }
46// FName GetIconName() const override { return NAME_None; }
47//
48//
49// //
50// // IFilter implementation
51// //
52//
53// /** Returns whether the specified Item passes the Filter's restrictions */
54// bool PassesFilter(FAssetFilterType InItem) const override
55// {
56// return InItem.GetClass() == UDlgDialogue::StaticClass();
57// }
58// };
59
61// A filter that search for blueprints that have implemented the Dialogue Participant
63{
64public:
65 FFrontendFilter_DialogueParticipants(const TSharedPtr<FFrontendFilterCategory>& InCategory)
66 : FFrontendFilter(InCategory)
67 {
68 }
69
70 //
71 // FFrontendFilter implementation
72 //
73
74 FString GetName() const override
75 {
76 return TEXT("Dialogue Participant Filter");
77 }
78 FText GetDisplayName() const override
79 {
80 return LOCTEXT("FilterDialogueParticipants_Name", "Dialogue Participant");
81 }
82 FText GetToolTipText() const override
83 {
84 return LOCTEXT("FilterDialogueParticipants_ToolTip", "Search for any Blueprints that implement the Dialogue Participant Interface");
85 }
86
87 FLinearColor GetColor() const override { return FLinearColor(0.91f, 0.91f, 0.f); }
88 FName GetIconName() const override { return NAME_None; }
89
90
91 //
92 // IFilter implementation
93 //
94
96 bool PassesFilter(FAssetFilterType InItem) const override
97 {
98#if ENGINE_MINOR_VERSION >= 26
99 FAssetData ItemAssetData;
100 if (!InItem.Legacy_TryGetAssetData(ItemAssetData))
101 {
102 return false;
103 }
104
105 if (const UObject* Object = ItemAssetData.FastGetAsset(false))
106 {
108 }
109#else
110 if (!InItem.IsAssetLoaded())
111 {
112 return false;
113 }
114
115 if (const UObject* Object = InItem.GetAsset())
116 {
118 }
119#endif // ENGINE_MINOR_VERSION >= 26
120
121 return false;
122 }
123};
124
125// //////////////////////////////////////////////////////////////////////////
126// // A filter that search for Custom Events
127// class FFrontendFilter_DialogueCustomEvent : public FFrontendFilter
128// {
129// public:
130// FFrontendFilter_DialogueCustomEvent(const TSharedPtr<FFrontendFilterCategory>& InCategory)
131// : FFrontendFilter(InCategory)
132// {
133// }
134//
135// //
136// // FFrontendFilter implementation
137// //
138//
139// FString GetName() const override
140// {
141// return TEXT("Dialogue Custom Event");
142// }
143// FText GetDisplayName() const override
144// {
145// return LOCTEXT("FilterDialogueCustomEvent_Name", "Dialogue Custom Event");
146// }
147// FText GetToolTipText() const override
148// {
149// return LOCTEXT("FilterDialogueCustomEvent__ToolTip", "Search for any Blueprints that is a Dialogue Custom Event");
150// }
151//
152// // Orange
153// FLinearColor GetColor() const override { return FLinearColor(1.f, 0.46f, 0.f); }
154// FName GetIconName() const override { return NAME_None; }
155//
156//
157// //
158// // IFilter implementation
159// //
160//
161// /** Returns whether the specified Item passes the Filter's restrictions */
162// bool PassesFilter(FAssetFilterType InItem) const override
163// {
164// if (!InItem.IsAssetLoaded())
165// {
166// return false;
167// }
168//
169// if (const UObject* Object = InItem.GetAsset())
170// {
171// return UDlgManager::IsObjectACustomEvent(Object);
172// }
173//
174// return false;
175// }
176// };
177//
178// //////////////////////////////////////////////////////////////////////////
179// // A filter that search for Custom Events
180// class FFrontendFilter_DialogueCustomCondition : public FFrontendFilter
181// {
182// public:
183// FFrontendFilter_DialogueCustomCondition(const TSharedPtr<FFrontendFilterCategory>& InCategory)
184// : FFrontendFilter(InCategory)
185// {
186// }
187//
188// //
189// // FFrontendFilter implementation
190// //
191//
192// FString GetName() const override
193// {
194// return TEXT("Dialogue Custom Condtition");
195// }
196// FText GetDisplayName() const override
197// {
198// return LOCTEXT("FilterDialogueCustomCondition_Name", "Dialogue Custom Condition");
199// }
200// FText GetToolTipText() const override
201// {
202// return LOCTEXT("FilterDialogueCustomCondition_ToolTip", "Search for any Blueprints that is a Dialogue Custom Condition");
203// }
204//
205// // Orange
206// FLinearColor GetColor() const override { return FLinearColor(1.f, 0.46f, 0.f); }
207// FName GetIconName() const override { return NAME_None; }
208//
209//
210// //
211// // IFilter implementation
212// //
213//
214// /** Returns whether the specified Item passes the Filter's restrictions */
215// bool PassesFilter(FAssetFilterType InItem) const override
216// {
217// if (!InItem.IsAssetLoaded())
218// {
219// return false;
220// }
221//
222// if (const UObject* Object = InItem.GetAsset())
223// {
224// return UDlgManager::IsObjectACustomCondition(Object);
225// }
226//
227// return false;
228// }
229// };
230//
231// //////////////////////////////////////////////////////////////////////////
232// // A filter that search for Custom Text Argument
233// class FFrontendFilter_DialogueCustomTextArgument : public FFrontendFilter
234// {
235// public:
236// FFrontendFilter_DialogueCustomTextArgument(const TSharedPtr<FFrontendFilterCategory>& InCategory)
237// : FFrontendFilter(InCategory)
238// {
239// }
240//
241// //
242// // FFrontendFilter implementation
243// //
244//
245// FString GetName() const override
246// {
247// return TEXT("Dialogue Custom Text Argument");
248// }
249// FText GetDisplayName() const override
250// {
251// return LOCTEXT("FilterDialogueCustomTextArgument_Name", "Dialogue Custom Text Argument");
252// }
253// FText GetToolTipText() const override
254// {
255// return LOCTEXT("FilterDialogueCustomTextArgument_ToolTip", "Search for any Blueprints that is a Dialogue Custom Text Argument");
256// }
257//
258// // Orange
259// FLinearColor GetColor() const override { return FLinearColor(1.f, 0.46f, 0.f); }
260// FName GetIconName() const override { return NAME_None; }
261//
262//
263// //
264// // IFilter implementation
265// //
266//
267// /** Returns whether the specified Item passes the Filter's restrictions */
268// bool PassesFilter(FAssetFilterType InItem) const override
269// {
270// if (!InItem.IsAssetLoaded())
271// {
272// return false;
273// }
274//
275// if (const UObject* Object = InItem.GetAsset())
276// {
277// return UDlgManager::IsObjectACustomTextArgument(Object);
278// }
279//
280// return false;
281// }
282// };
283
285// UDialogueSearchFilter
287 TSharedPtr<FFrontendFilterCategory> DefaultCategory,
288 TArray<TSharedRef<FFrontendFilter>>& InOutFilterList
289) const
290{
291 // TSharedPtr<FFrontendFilterCategory> DialogueCategory = MakeShared<FFrontendFilterCategory>(
292 // LOCTEXT("DlgSystemCategoryName", "Dialogue System Filters"),
293 // LOCTEXT("DlgSystemCategoryTooltip", "Filter Dialogue System assets")
294 // );
295 TSharedPtr<FFrontendFilterCategory> DialogueCategory = MakeShared<FFrontendFilterCategory>(
298 );
299
300 // NOTE: we can't combine these with multiple filters
301 // InOutFilterList.Add(MakeShared<FFrontendFilter_Dialogue>(DialogueCategory));
302 InOutFilterList.Add(MakeShared<FFrontendFilter_DialogueParticipants>(DialogueCategory));
303 //InOutFilterList.Add(MakeShared<FFrontendFilter_DialogueCustomEvent>(DialogueCategory));
304 //InOutFilterList.Add(MakeShared<FFrontendFilter_DialogueCustomCondition>(DialogueCategory));
305 //InOutFilterList.Add(MakeShared<FFrontendFilter_DialogueCustomTextArgument>(DialogueCategory));
306}
307
308
310// FDialogueContentBrowserExtensions
315
320
321#undef LOCTEXT_NAMESPACE
static const FText OTHER_DIALOGUE_SYSTEM_MENU_CATEGORY_KEY_TEXT(NSLOCTEXT("OtherDlgSystemEditor", "OtherDlgSystemAssetCategory", "OtherDialogue System"))
static const FName OTHER_DIALOGUE_SYSTEM_MENU_CATEGORY_KEY(TEXT("Other Dialogue System"))
bool PassesFilter(FAssetFilterType InItem) const override
FFrontendFilter_DialogueParticipants(const TSharedPtr< FFrontendFilterCategory > &InCategory)
void AddFrontEndFilterExtensions(TSharedPtr< FFrontendFilterCategory > DefaultCategory, TArray< TSharedRef< FFrontendFilter > > &InOutFilterList) const override
static bool DoesObjectImplementDialogueParticipantInterface(const UObject *Object)
UFUNCTION(BlueprintPure, Category = "Dialogue|Helper")