5#include "Toolkits/AssetEditorManager.h"
6#include "Widgets/Input/SComboBox.h"
7#include "Widgets/Input/SSearchBox.h"
8#include "Widgets/Images/SImage.h"
9#include "Widgets/Layout/SMissingWidget.h"
10#include "Widgets/Layout/SWrapBox.h"
11#include "Widgets/Input/SButton.h"
20#include "SourceCodeNavigation.h"
21#include "Engine/BlueprintGeneratedClass.h"
23#include "Framework/MultiBox/MultiBoxBuilder.h"
24#include "Kismet2/KismetEditorUtilities.h"
26#define LOCTEXT_NAMESPACE "SDialogueBrowser"
27#define DEFAULT_FONT(...) FCoreStyle::GetDefaultFontStyle(__VA_ARGS__)
30template<
typename ItemType>
39 SLATE_DEFAULT_SLOT(
typename SCategoryHeaderTableRow::FArguments, Content)
42 void
Construct(const FArguments& InArgs, const TSharedRef<STableViewBase>& InOwnerTableView)
45 .Padding(8.0f, 2.0f, 0.0f, 0.0f)
49 .Padding(FMargin(1.0f, 3.0f))
50 .BorderBackgroundColor(FLinearColor(.6, .6, .6, 1.0f))
54 +SHorizontalBox::Slot()
55 .VAlign(VAlign_Center)
56 .Padding(2.0f, 2.0f, 2.0f, 2.0f)
62 +SHorizontalBox::Slot()
63 .VAlign(VAlign_Center)
65 InArgs._Content.Widget
72 .Style(FEditorStyle::Get(),
"DetailsView.TreeView.TableRow")
73 .ShowSelection(
false),
113 RootTreeItem = MakeShared<FDialogueBrowserTreeRootNode>();
120 .SelectionMode(ESelectionMode::Single)
125 .Visibility(EVisibility::Visible)
126 +SHeaderRow::Column(NAME_Name)
127 .DefaultLabel(LOCTEXT(
"Name",
"Participant Name"))
133 .Padding(FMargin(3.f))
134 .BorderImage(FEditorStyle::GetBrush(
"ToolPanel.GroupBorder"))
139 +SVerticalBox::Slot()
146 +SHorizontalBox::Slot()
148 .Padding(0.f, 0.f, 4.f, 0.f)
154 +SHorizontalBox::Slot()
159 .ComboButtonStyle(FEditorStyle::Get(),
"GenericFilters.ComboButtonStyle")
160 .ForegroundColor(FLinearColor::White)
162 .ToolTipText(LOCTEXT(
"View_Tooltip",
"View Options for the Dialogue Browser"))
165 .ContentPadding(FMargin(1, 0))
169 +SHorizontalBox::Slot()
173 .TextStyle(FEditorStyle::Get(),
"GenericFilters.TextStyle")
174 .Font(FEditorStyle::Get().GetFontStyle(
"FontAwesome.9"))
175 .Text(FText::FromString(FString(TEXT(
"\xf0b0"))) )
177 +SHorizontalBox::Slot()
182 .TextStyle(FEditorStyle::Get(),
"GenericFilters.TextStyle")
183 .Text(LOCTEXT(
"View_Key",
"View Options"))
189 +SHorizontalBox::Slot()
192 SNew(SComboBox<SortOptionType>)
195 .ContentPadding(FMargin(4.0, 2.0))
198 return SNew(STextBlock)
199 .Text(NameItem->GetFText());
202 .ToolTipText(LOCTEXT(
"AddFilterToolTip",
"Sort by a specific criteria."))
205 .Text(LOCTEXT(
"Sort",
"Sort By"))
210 +SHorizontalBox::Slot()
214 .ToolTipText(LOCTEXT(
"RefreshToolTip",
"Refreshes/Reloads the Dialogue Browser view."))
218 LOCTEXT(
"RefreshDialogues",
"Refresh"),
226 +SVerticalBox::Slot()
231 .BorderImage(FEditorStyle::GetBrush(
"ToolPanel.GroupBorder"))
232 .Padding(FMargin(0.0f, 4.0f))
246 TSet<TSharedPtr<FDialogueBrowserTreeNode>> OldExpansionState;
247 if (bPreserveExpansion)
256 auto PopulateVariablePropertiesFromSearchResult = [](
257 const TSharedPtr<FDialogueBrowserTreeVariableProperties> VariableProperties,
258 const TSharedPtr<FDialogueSearchFoundResult> SearchResult,
259 const FGuid& DialogueGUID
262 if (VariableProperties->HasGraphNodeSet(DialogueGUID))
265 ->GetMutableGraphNodeSet(DialogueGUID)
266 ->Append(SearchResult->GraphNodes);
268 if (VariableProperties->HasEdgeNodeSet(DialogueGUID))
271 ->GetMutableEdgeNodeSet(DialogueGUID)
272 ->Append(SearchResult->EdgeNodes);
280 const FGuid DialogueGUID =
Dialogue->GetGUID();
283 TSet<FName> ParticipantsNames;
284 Dialogue->GetAllParticipantNames(ParticipantsNames);
285 for (
const FName& ParticipantName : ParticipantsNames)
287 TSharedPtr<FDialogueBrowserTreeParticipantProperties>* ParticipantPropsPtr =
ParticipantsProperties.Find(ParticipantName);
288 TSharedPtr<FDialogueBrowserTreeParticipantProperties> ParticipantProps;
289 if (ParticipantPropsPtr ==
nullptr)
292 const TSet<TWeakObjectPtr<const UDlgDialogue>> SetArgument{
Dialogue};
293 ParticipantProps = MakeShared<FDialogueBrowserTreeParticipantProperties>(SetArgument);
299 ParticipantProps = *ParticipantPropsPtr;
300 ParticipantProps->AddDialogue(
Dialogue);
304 TSet<FName> EventsNames;
305 Dialogue->GetEvents(ParticipantName, EventsNames);
306 for (
const FName& EventName : EventsNames)
308 PopulateVariablePropertiesFromSearchResult(
309 ParticipantProps->AddDialogueToEvent(EventName,
Dialogue),
316 TSet<UClass*> CustomEventsClasses;
317 Dialogue->GetCustomEvents(ParticipantName, CustomEventsClasses);
318 for (UClass* EventClass : CustomEventsClasses)
320 PopulateVariablePropertiesFromSearchResult(
321 ParticipantProps->AddDialogueToCustomEvent(EventClass,
Dialogue),
328 TSet<FName> ConditionNames;
329 Dialogue->GetConditions(ParticipantName, ConditionNames);
330 for (
const FName& ConditionName : ConditionNames)
332 PopulateVariablePropertiesFromSearchResult(
333 ParticipantProps->AddDialogueToCondition(ConditionName,
Dialogue),
340 TSet<FName> IntVariableNames;
341 Dialogue->GetIntNames(ParticipantName, IntVariableNames);
342 for (
const FName& IntVariableName : IntVariableNames)
344 PopulateVariablePropertiesFromSearchResult(
345 ParticipantProps->AddDialogueToIntVariable(IntVariableName,
Dialogue),
352 TSet<FName> FloatVariableNames;
353 Dialogue->GetFloatNames(ParticipantName, FloatVariableNames);
354 for (
const FName& FloatVariableName : FloatVariableNames)
356 PopulateVariablePropertiesFromSearchResult(
357 ParticipantProps->AddDialogueToFloatVariable(FloatVariableName,
Dialogue),
364 TSet<FName> BoolVariableNames;
365 Dialogue->GetBoolNames(ParticipantName, BoolVariableNames);
366 for (
const FName& BoolVariableName : BoolVariableNames)
368 PopulateVariablePropertiesFromSearchResult(
369 ParticipantProps->AddDialogueToBoolVariable(BoolVariableName,
Dialogue),
376 TSet<FName> FNameVariableNames;
377 Dialogue->GetNameNames(ParticipantName, FNameVariableNames);
378 for (
const FName& NameVariableName : FNameVariableNames)
380 PopulateVariablePropertiesFromSearchResult(
381 ParticipantProps->AddDialogueToFNameVariable(NameVariableName,
Dialogue),
388 TSet<FName> ClassIntVariableNames;
389 Dialogue->GetClassIntNames(ParticipantName, ClassIntVariableNames);
390 for (
const FName& IntVariableName : ClassIntVariableNames)
392 PopulateVariablePropertiesFromSearchResult(
393 ParticipantProps->AddDialogueToClassIntVariable(IntVariableName,
Dialogue),
400 TSet<FName> ClassFloatVariableNames;
401 Dialogue->GetClassFloatNames(ParticipantName, ClassFloatVariableNames);
402 for (
const FName& FloatVariableName : ClassFloatVariableNames)
404 PopulateVariablePropertiesFromSearchResult(
405 ParticipantProps->AddDialogueToClassFloatVariable(FloatVariableName,
Dialogue),
412 TSet<FName> ClassBoolVariableNames;
413 Dialogue->GetClassBoolNames(ParticipantName, ClassBoolVariableNames);
414 for (
const FName& BoolVariableName : ClassBoolVariableNames)
416 PopulateVariablePropertiesFromSearchResult(
417 ParticipantProps->AddDialogueToClassBoolVariable(BoolVariableName,
Dialogue),
424 TSet<FName> ClassFNameVariableNames;
425 Dialogue->GetClassNameNames(ParticipantName, ClassFNameVariableNames);
426 for (
const FName& NameVariableName : ClassFNameVariableNames)
428 PopulateVariablePropertiesFromSearchResult(
429 ParticipantProps->AddDialogueToClassFNameVariable(NameVariableName,
Dialogue),
436 TSet<FName> ClassFTextVariableNames;
437 Dialogue->GetClassTextNames(ParticipantName, ClassFTextVariableNames);
438 for (
const FName& TextVariableName : ClassFTextVariableNames)
440 PopulateVariablePropertiesFromSearchResult(
441 ParticipantProps->AddDialogueToClassFTextVariable(TextVariableName,
Dialogue),
450 TArray<FName> AllParticipants;
453 AllParticipants.Add(Elem.Key);
454 TSharedPtr<FDialogueBrowserTreeParticipantProperties> Property = Elem.Value;
469 AllParticipants.Sort([
this](
const FName& A,
const FName& B)
476 for (
const FName&
Name : AllParticipants)
478 const TSharedPtr<FDialogueBrowserTreeNode>
Participant =
479 MakeShared<FDialogueBrowserTreeCategoryParticipantNode>(FText::FromName(
Name),
RootTreeItem,
Name);
493 if (bPreserveExpansion && OldExpansionState.Num() > 0)
496 TArray<TSharedPtr<FDialogueBrowserTreeNode>> AllNodes;
500 FDlgTreeViewHelper::RestoreTreeExpansionState<TSharedPtr<FDialogueBrowserTreeNode>>(
519 TArray<TArray<TSharedPtr<FDialogueBrowserTreeNode>>> OutPaths;
528 for (
const TArray<TSharedPtr<FDialogueBrowserTreeNode>>& Path : OutPaths)
530 const int32 PathNum = Path.Num();
531 for (int32 PathIndex = 0; PathIndex < PathNum; PathIndex++)
533 Path[PathIndex]->SetIsVisible(
true);
551 .HintText(LOCTEXT(
"SearchBoxHintText",
"Search by Name"))
554 .SelectAllTextWhenFocused(
false)
555 .DelayChangeNotificationsWhileTyping(
false);
562 const TSharedPtr<FDialogueBrowserTreeNode>& InItem,
563 const TSharedPtr<FDialogueBrowserTreeVariableProperties>* PropertyPtr,
568 TSet<TWeakObjectPtr<const UDlgDialogue>> Dialogues;
569 if (PropertyPtr !=
nullptr)
571 Dialogues = (*PropertyPtr)->GetDialogues();
574 for (TWeakObjectPtr<const UDlgDialogue>
Dialogue : Dialogues)
581 const TSharedPtr<FDialogueBrowserTreeNode> DialogueItem = MakeShared<FDialogueBrowserTreeDialogueNode>(
582 FText::FromName(
Dialogue->GetDialogueFName()),
586 DialogueItem->SetTextType(TextType);
587 InItem->AddChild(DialogueItem);
592 const TSharedPtr<FDialogueBrowserTreeNode>& InItem,
593 const TSet<TWeakObjectPtr<const UDialogueGraphNode>>& GraphNodes,
597 for (TWeakObjectPtr<const UDialogueGraphNode> GraphNode : GraphNodes)
599 if (!GraphNode.IsValid())
604 const FName Text = *FString::Printf(TEXT(
"%d"), GraphNode->GetDialogueNodeIndex());
605 const TSharedPtr<FDialogueBrowserTreeNode> NodeItem =
606 MakeShared<FDialogueBrowserTreeGraphNode>(FText::FromName(Text), InItem, GraphNode);
607 NodeItem->SetTextType(TextType);
608 InItem->AddInlineChild(NodeItem);
613 const TSharedPtr<FDialogueBrowserTreeNode>& InItem,
614 const TSet<TWeakObjectPtr<const UDialogueGraphNode_Edge>>& EdgeNodes,
618 for (TWeakObjectPtr<const UDialogueGraphNode_Edge> EdgeNode : EdgeNodes)
620 if (!EdgeNode.IsValid())
625 int32 FromParent = -1;
627 if (EdgeNode->HasParentNode())
629 FromParent = EdgeNode->GetParentNode()->GetDialogueNodeIndex();
631 if (EdgeNode->HasChildNode())
633 ToChild = EdgeNode->GetChildNode()->GetDialogueNodeIndex();
635 const FName Text = *FString::Printf(TEXT(
"%d -> %d"), FromParent, ToChild);
636 const TSharedPtr<FDialogueBrowserTreeNode> NodeItem =
637 MakeShared<FDialogueBrowserTreeEdgeNode>(FText::FromName(Text), InItem, EdgeNode);
638 NodeItem->SetTextType(TextType);
639 InItem->AddInlineChild(NodeItem);
644 const TSharedPtr<FDialogueBrowserTreeNode>& InItem,
645 const TSharedPtr<FDialogueBrowserTreeVariableProperties>* PropertyPtr,
650 TSharedPtr<FDialogueBrowserTreeDialogueNode> DialogueItem =
651 StaticCastSharedPtr<FDialogueBrowserTreeDialogueNode>(InItem);
652 if (!DialogueItem.IsValid())
656 if (PropertyPtr ==
nullptr || !DialogueItem->GetDialogue().IsValid())
661 const TSharedPtr<FDialogueBrowserTreeVariableProperties> Property = *PropertyPtr;
666 if (Property->HasGraphNodeSet(DialogueGUID))
670 if (Property->HasEdgeNodeSet(DialogueGUID))
677 const TSharedPtr<FDialogueBrowserTreeNode>& Item,
678 const TMap<FName, TSharedPtr<FDialogueBrowserTreeVariableProperties>>&
Variables,
684 const FName VariableName = Pair.Key;
685 const TSharedPtr<FDialogueBrowserTreeNode> ChildItem =
686 MakeShared<FDialogueBrowserTreeVariableNode>(FText::FromName(VariableName), Item, VariableName);
687 ChildItem->SetTextType(VariableType);
688 Item->AddChild(ChildItem);
694 const FName ParticipantName = Item->GetParentParticipantName();
695 if (!ParticipantName.IsValid() || ParticipantName.IsNone())
701 TSharedPtr<FDialogueBrowserTreeParticipantProperties>* ParticipantPropertiesPtr =
ParticipantsProperties.Find(ParticipantName);
702 if (ParticipantPropertiesPtr ==
nullptr)
707 TSharedPtr<FDialogueBrowserTreeParticipantProperties> ParticipantProperties = *ParticipantPropertiesPtr;
708 if (Item->IsCategory())
710 switch (Item->GetCategoryType())
715 const bool bHideEmptyCategories = GetDefault<UDlgSystemSettings>()->bHideEmptyDialogueBrowserCategories;
722 for (TWeakObjectPtr<const UDlgDialogue>
Dialogue : ParticipantProperties->GetDialogues())
729 const TSharedPtr<FDialogueBrowserTreeNode> DialogueItem =
730 MakeShared<FDialogueBrowserTreeDialogueNode>(FText::FromName(
Dialogue->GetDialogueFName()), Item,
Dialogue);
732 Item->AddChild(DialogueItem);
740 for (
const auto& Pair : ParticipantProperties->GetEvents())
742 const TSharedPtr<FDialogueBrowserTreeNode> EventItem =
743 MakeShared<FDialogueBrowserTreeVariableNode>(FText::FromName(Pair.Key), Item, Pair.Key);
745 Item->AddChild(EventItem);
749 for (
const auto& Pair : ParticipantProperties->GetCustomEvents())
751 UClass* Class = Pair.Key;
752 const TSharedPtr<FDialogueBrowserTreeNode> CustomEventItem = MakeShared<FDialogueBrowserTreeCustomObjectNode>(
758 Item->AddChild(CustomEventItem);
764 for (
const auto& Pair : ParticipantProperties->GetConditions())
766 const TSharedPtr<FDialogueBrowserTreeNode> ConditionItem =
767 MakeShared<FDialogueBrowserTreeVariableNode>(FText::FromName(Pair.Key), Item, Pair.Key);
769 Item->AddChild(ConditionItem);
777 if (ParticipantProperties->HasDialogueValues())
779 const bool bHideEmptyCategories = GetDefault<UDlgSystemSettings>()->bHideEmptyDialogueBrowserCategories;
787 ParticipantProperties->GetIntegers(),
794 ParticipantProperties->GetFloats(),
801 ParticipantProperties->GetBools(),
808 ParticipantProperties->GetFNames(),
816 if (ParticipantProperties->HasClassVariables())
818 const bool bHideEmptyCategories = GetDefault<UDlgSystemSettings>()->bHideEmptyDialogueBrowserCategories;
826 ParticipantProperties->GetClassIntegers(),
833 ParticipantProperties->GetClassFloats(),
840 ParticipantProperties->GetClassBools(),
847 ParticipantProperties->GetClassFNames(),
854 ParticipantProperties->GetClassFTexts(),
863 else if (Item->IsText())
865 switch (Item->GetTextType())
871 ParticipantProperties->GetEvents().Find(Item->GetParentVariableName()),
880 ParticipantProperties->GetCustomEvents().Find(Item->GetParentClass()),
889 ParticipantProperties->GetConditions().Find(Item->GetParentVariableName()),
898 ParticipantProperties->GetIntegers().Find(Item->GetParentVariableName()),
906 ParticipantProperties->GetFloats().Find(Item->GetParentVariableName()),
914 ParticipantProperties->GetBools().Find(Item->GetParentVariableName()),
922 ParticipantProperties->GetFNames().Find(Item->GetParentVariableName()),
931 ParticipantProperties->GetClassIntegers().Find(Item->GetParentVariableName()),
939 ParticipantProperties->GetClassFloats().Find(Item->GetParentVariableName()),
947 ParticipantProperties->GetClassBools().Find(Item->GetParentVariableName()),
955 ParticipantProperties->GetClassFNames().Find(Item->GetParentVariableName()),
963 ParticipantProperties->GetClassFTexts().Find(Item->GetParentVariableName()),
972 ParticipantProperties->GetEvents().Find(Item->GetParentVariableName()),
982 ParticipantProperties->GetCustomEvents().Find(Item->GetParentClass()),
991 ParticipantProperties->GetConditions().Find(Item->GetParentVariableName()),
1000 ParticipantProperties->GetIntegers().Find(Item->GetParentVariableName()),
1009 ParticipantProperties->GetFloats().Find(Item->GetParentVariableName()),
1018 ParticipantProperties->GetBools().Find(Item->GetParentVariableName()),
1027 ParticipantProperties->GetFNames().Find(Item->GetParentVariableName()),
1037 ParticipantProperties->GetClassIntegers().Find(Item->GetParentVariableName()),
1046 ParticipantProperties->GetClassFloats().Find(Item->GetParentVariableName()),
1055 ParticipantProperties->GetClassBools().Find(Item->GetParentVariableName()),
1064 ParticipantProperties->GetClassFNames().Find(Item->GetParentVariableName()),
1074 ParticipantProperties->GetClassFTexts().Find(Item->GetParentVariableName()),
1086 for (
const TSharedPtr<FDialogueBrowserTreeNode>& ChildItem : Item->GetChildren())
1092 for (
const TSharedPtr<FDialogueBrowserTreeNode>& ChildItem : Item->GetInlineChildren())
1099 const TArray<TSharedPtr<FDialogueBrowserTreeNode>>& InChildren
1102 TSharedPtr<SWrapBox> Buttons = SNew(SWrapBox)
1103 .PreferredWidth(600.f);
1106 const FText GraphNodeTooltip = LOCTEXT(
"JumpToNodeTipGraphNode",
"Opens the Dialogue Editor and jumps to the Node");
1107 const FText EdgeNodeTooltip = LOCTEXT(
"JumpToNodeTipEdgeNode",
"Opens the Dialogue Editor and jumps to the Edge");
1108 for (
const TSharedPtr<FDialogueBrowserTreeNode>& ChildItem : InChildren)
1110 const bool bIsEdgeNodeText = ChildItem->IsEdgeNodeText();
1111 if (ChildItem->IsGraphNodeText() || bIsEdgeNodeText)
1114 .HAlign(HAlign_Fill)
1115 .VAlign(VAlign_Fill)
1116 .Padding(2.f, 0.f, 0.f, 0.f)
1120 .ToolTipText(bIsEdgeNodeText ? EdgeNodeTooltip : GraphNodeTooltip)
1124 .Text(ChildItem->GetDisplayText())
1131 return Buttons.ToSharedRef();
1136 if (!InItem.IsValid())
1138 return SMissingWidget::MakeMissingWidget();
1140 if (!InItem->HasInlineChildren() || !InItem->IsText())
1142 return SMissingWidget::MakeMissingWidget();
1145 if (InItem->IsDialogueText())
1148 return SNew(SHorizontalBox)
1150 +SHorizontalBox::Slot()
1151 .HAlign(HAlign_Left)
1152 .VAlign(VAlign_Center)
1153 .Padding(0.f, 0.f, 10.f, 0.f)
1159 +SHorizontalBox::Slot()
1160 .HAlign(HAlign_Left)
1161 .VAlign(VAlign_Center)
1167 +SHorizontalBox::Slot()
1168 .HAlign(HAlign_Right)
1169 .VAlign(VAlign_Center)
1175 return SMissingWidget::MakeMissingWidget();
1180 return SNew(SHorizontalBox)
1182 +SHorizontalBox::Slot()
1184 .HAlign(HAlign_Left)
1187 .ButtonStyle(FEditorStyle::Get(),
"HoverHintOnly")
1188 .ToolTipText(LOCTEXT(
"FindInContentBrowserToolTip",
"Find the Dialogue in the Context Browser"))
1192 .HAlign(HAlign_Fill)
1193 .VAlign(VAlign_Fill)
1204 +SHorizontalBox::Slot()
1206 .HAlign(HAlign_Left)
1209 .ButtonStyle(FEditorStyle::Get(),
"HoverHintOnly")
1210 .ToolTipText(LOCTEXT(
"OpenDialogueToolTip",
"Opens the dialogue editor."))
1214 .HAlign(HAlign_Fill)
1215 .VAlign(VAlign_Fill)
1229 FilterString = FText::TrimPrecedingAndTrailing(InText).ToString();
1235 TSharedPtr<FDialogueBrowserTreeNode> InItem,
1236 const TSharedRef<STableViewBase>& OwnerTable
1240 TSharedPtr<STableRow<TSharedPtr<FDialogueBrowserTreeNode>>> TableRow;
1241 FMargin RowPadding = FMargin(2.f, 2.f);
1242 const bool bIsCategory = InItem->IsCategory();
1243 const bool bIsSeparator = InItem->IsSeparator();
1249 .Visibility(InItem->IsVisible() ? EVisibility::Visible : EVisibility::Collapsed);
1254 SNew(
STableRow<TSharedPtr<FDialogueBrowserTreeNode>>, OwnerTable)
1256 .Visibility(InItem->IsVisible() ? EVisibility::Visible : EVisibility::Collapsed)
1257 .ShowSelection(!bIsSeparator);
1262 if (!InItem->IsVisible())
1265 return TableRow.ToSharedRef();
1269 TSharedPtr<STextBlock> DefaultTextBlock =
1271 .Text(InItem->GetDisplayText())
1275 TSharedPtr<SWidget> RowContent = DefaultTextBlock;
1276 TSharedPtr<SHorizontalBox> RowContainer;
1277 TableRow->SetRowContent(SAssignNew(RowContainer, SHorizontalBox));
1282 RowPadding = FMargin(0);
1283 RowContent = SNew(SVerticalBox)
1284 .Visibility(EVisibility::HitTestInvisible)
1286 +SVerticalBox::Slot()
1289 .Padding(0.0f, 5.f, 0.0f, 5.f)
1294 .Padding(FEditorStyle::GetMargin(TEXT(
"Menu.Separator.Padding")))
1297 .BorderImage(FEditorStyle::GetBrush(TEXT(
"Menu.Separator")))
1300 else if (bIsCategory)
1305 TSharedPtr<FDialogueBrowserTreeParticipantProperties>* ParticipantPropertiesPtr =
1307 if (ParticipantPropertiesPtr)
1312 RowContent = SNew(SHorizontalBox)
1315 +SHorizontalBox::Slot()
1316 .HAlign(HAlign_Left)
1317 .VAlign(VAlign_Center)
1321 .Text(InItem->GetDisplayText())
1326 +SHorizontalBox::Slot()
1327 .HAlign(HAlign_Right)
1328 .VAlign(VAlign_Center)
1332 .Text(FText::FromString(FString::Printf(TEXT(
"Dialogue references %d"),
DialogueReferences)))
1337 RowContent = SNew(STextBlock)
1339 .Text(InItem->GetDisplayText())
1343 else if (InItem->IsText())
1345 if (InItem->HasInlineChildren())
1349 else if (InItem->IsDialogueText())
1351 RowContent = SNew(SHorizontalBox)
1354 +SHorizontalBox::Slot()
1355 .HAlign(HAlign_Left)
1356 .VAlign(VAlign_Center)
1363 +SHorizontalBox::Slot()
1364 .HAlign(HAlign_Right)
1365 .VAlign(VAlign_Center)
1370 else if (InItem->IsEventText())
1373 InItem->GetDisplayText(),
1377 else if (InItem->IsCustomEventText())
1380 InItem->GetDisplayText(),
1382 InItem->GetParentClass(),
1387 else if (InItem->IsConditionText())
1390 InItem->GetDisplayText(),
1394 else if (InItem->IsGraphNodeText() || InItem->IsEdgeNodeText())
1396 RowContent = SNew(SHorizontalBox)
1399 +SHorizontalBox::Slot()
1400 .HAlign(HAlign_Left)
1401 .VAlign(VAlign_Center)
1403 DefaultTextBlock.ToSharedRef()
1407 +SHorizontalBox::Slot()
1408 .HAlign(HAlign_Right)
1409 .VAlign(VAlign_Center)
1412 .ToolTipText(LOCTEXT(
"JumpToNodeTip",
"Opens the Editor for the Dialogue and jumps to the node"))
1416 .Text(LOCTEXT(
"JumpToNode",
"Jump"))
1426 RowContainer->AddSlot()
1428 .VAlign(VAlign_Fill)
1429 .HAlign(HAlign_Right)
1431 SNew(SExpanderArrow, TableRow)
1434 RowContainer->AddSlot()
1436 .Padding(RowPadding)
1438 RowContent.ToSharedRef()
1441 return TableRow.ToSharedRef();
1446 if (!InItem.IsValid() || InItem->IsSeparator())
1450 if (InItem->HasChildren())
1452 InItem->GetVisibleChildren(OutChildren);
1463 if (!InItem.IsValid())
1468 if (InItem->IsText())
1474 if (InItem->HasChildren())
1482 if (InItem.IsValid() && InItem->HasChildren())
1485 for (
const TSharedPtr<FDialogueBrowserTreeNode> & Child : InItem->GetChildren())
1494 if (Selection.IsValid())
1503 TSharedPtr<FDialogueBrowserTreeDialogueNode> DialogueItem =
1504 StaticCastSharedPtr<FDialogueBrowserTreeDialogueNode>(InItem);
1505 if (!DialogueItem.IsValid())
1507 return FReply::Unhandled();
1510 static constexpr bool bFocusContentBrowser =
true;
1511 if (GEditor && DialogueItem->GetDialogue().IsValid())
1513 TArray<UObject*> ObjectsToSyncTo{
const_cast<UDlgDialogue*
>(DialogueItem->GetDialogue().Get())};
1514 GEditor->SyncBrowserToObjects(ObjectsToSyncTo, bFocusContentBrowser);
1515 return FReply::Handled();
1518 return FReply::Unhandled();
1522 const TSharedPtr<FDialogueBrowserTreeNode>& Parent,
1523 const TSharedPtr<FDialogueBrowserTreeParticipantProperties>& ParticipantProperties,
1524 bool bHideEmptyCategories
1527 TArray<TSharedPtr<FDialogueBrowserTreeNode>> Categories;
1528 if (!bHideEmptyCategories || (bHideEmptyCategories && ParticipantProperties->HasDialogues()))
1530 TSharedPtr<FDialogueBrowserTreeNode> Category = MakeShared<FDialogueBrowserTreeCategoryNode>(
1531 FText::FromString(TEXT(
"Dialogues")),
1535 Categories.Add(Category);
1538 if (!bHideEmptyCategories || (bHideEmptyCategories && ParticipantProperties->HasEvents()))
1540 TSharedPtr<FDialogueBrowserTreeNode> Category = MakeShared<FDialogueBrowserTreeCategoryNode>(
1541 FText::FromString(TEXT(
"Events")),
1545 Categories.Add(Category);
1548 if (!bHideEmptyCategories || (bHideEmptyCategories && ParticipantProperties->HasConditions()))
1550 TSharedPtr<FDialogueBrowserTreeNode> Category = MakeShared<FDialogueBrowserTreeCategoryNode>(
1551 FText::FromString(TEXT(
"Conditions")),
1555 Categories.Add(Category);
1558 if (!bHideEmptyCategories || (bHideEmptyCategories && ParticipantProperties->HasDialogueValues()))
1560 TSharedPtr<FDialogueBrowserTreeNode> Category = MakeShared<FDialogueBrowserTreeCategoryNode>(
1561 FText::FromString(TEXT(
"Dialogue Values")),
1565 Categories.Add(Category);
1568 if (!bHideEmptyCategories || (bHideEmptyCategories && ParticipantProperties->HasClassVariables()))
1570 TSharedPtr<FDialogueBrowserTreeNode> Category = MakeShared<FDialogueBrowserTreeCategoryNode>(
1571 FText::FromString(TEXT(
"Class Variables")),
1575 Categories.Add(Category);
1581 const TSharedPtr<FDialogueBrowserTreeNode>& Parent,
1582 const TSharedPtr<FDialogueBrowserTreeParticipantProperties>& ParticipantProperties,
1583 bool bHideEmptyCategories
1586 TArray<TSharedPtr<FDialogueBrowserTreeNode>> Categories;
1587 if (!bHideEmptyCategories || (bHideEmptyCategories && ParticipantProperties->HasIntegers()))
1589 TSharedPtr<FDialogueBrowserTreeNode> Category = MakeShared<FDialogueBrowserTreeCategoryNode>(
1590 FText::FromString(TEXT(
"Integers")),
1594 Categories.Add(Category);
1597 if (!bHideEmptyCategories || (bHideEmptyCategories && ParticipantProperties->HasFloats()))
1599 TSharedPtr<FDialogueBrowserTreeNode> Category = MakeShared<FDialogueBrowserTreeCategoryNode>(
1600 FText::FromString(TEXT(
"Floats")),
1604 Categories.Add(Category);
1607 if (!bHideEmptyCategories || (bHideEmptyCategories && ParticipantProperties->HasBools()))
1609 TSharedPtr<FDialogueBrowserTreeNode> Category = MakeShared<FDialogueBrowserTreeCategoryNode>(
1610 FText::FromString(TEXT(
"Bools")),
1614 Categories.Add(Category);
1617 if (!bHideEmptyCategories || (bHideEmptyCategories && ParticipantProperties->HasFNames()))
1619 TSharedPtr<FDialogueBrowserTreeNode> Category = MakeShared<FDialogueBrowserTreeCategoryNode>(
1620 FText::FromString(TEXT(
"FNames")),
1624 Categories.Add(Category);
1631 const TSharedPtr<FDialogueBrowserTreeNode>& Parent,
1632 const TSharedPtr<FDialogueBrowserTreeParticipantProperties>& ParticipantProperties,
1633 bool bHideEmptyCategories
1636 TArray<TSharedPtr<FDialogueBrowserTreeNode>> Categories;
1638 if (!bHideEmptyCategories || (bHideEmptyCategories && ParticipantProperties->HasClassIntegers()))
1640 TSharedPtr<FDialogueBrowserTreeNode> Category = MakeShared<FDialogueBrowserTreeCategoryNode>(
1641 FText::FromString(TEXT(
"Integers")),
1645 Categories.Add(Category);
1648 if (!bHideEmptyCategories || (bHideEmptyCategories && ParticipantProperties->HasClassFloats()))
1650 TSharedPtr<FDialogueBrowserTreeNode> Category = MakeShared<FDialogueBrowserTreeCategoryNode>(
1651 FText::FromString(TEXT(
"Floats")),
1655 Categories.Add(Category);
1658 if (!bHideEmptyCategories || (bHideEmptyCategories && ParticipantProperties->HasClassBools()))
1660 TSharedPtr<FDialogueBrowserTreeNode> Category = MakeShared<FDialogueBrowserTreeCategoryNode>(
1661 FText::FromString(TEXT(
"Bools")),
1665 Categories.Add(Category);
1668 if (!bHideEmptyCategories || (bHideEmptyCategories && ParticipantProperties->HasClassFNames()))
1670 TSharedPtr<FDialogueBrowserTreeNode> Category = MakeShared<FDialogueBrowserTreeCategoryNode>(
1671 FText::FromString(TEXT(
"FNames")),
1675 Categories.Add(Category);
1678 if (!bHideEmptyCategories || (bHideEmptyCategories && ParticipantProperties->HasClassFTexts()))
1680 TSharedPtr<FDialogueBrowserTreeNode> Category = MakeShared<FDialogueBrowserTreeCategoryNode>(
1681 FText::FromString(TEXT(
"FTexts")),
1685 Categories.Add(Category);
1692 const FText& InText,
1693 const FSlateBrush* IconBrush,
1697 return SNew(SHorizontalBox)
1698 +SHorizontalBox::Slot()
1699 .VAlign(VAlign_Center)
1703 .HAlign(HAlign_Fill)
1704 .VAlign(VAlign_Fill)
1705 .WidthOverride(IconSize)
1706 .HeightOverride(IconSize)
1713 +SHorizontalBox::Slot()
1714 .VAlign(VAlign_Center)
1725 const FText& InText,
1726 const FSlateBrush* IconBrush,
1729 FName FunctionNameToOpen,
1736 HorizontalBox->AddSlot()
1738 .VAlign(VAlign_Center)
1742 .ButtonStyle(FEditorStyle::Get(),
"HoverHintOnly")
1744 .ContentPadding(4.f)
1745 .ForegroundColor(FSlateColor::UseForeground())
1750 .Image(FEditorStyle::GetBrush(
"PropertyWindow.Button_Browse"))
1751 .ColorAndOpacity(FSlateColor::UseForeground())
1756 HorizontalBox->AddSlot()
1758 .VAlign(VAlign_Center)
1762 .ButtonStyle(FEditorStyle::Get(),
"HoverHintOnly")
1764 .ContentPadding(4.f)
1765 .ForegroundColor(FSlateColor::UseForeground())
1770 .Image(FEditorStyle::GetBrush(
"PropertyWindow.Button_Edit"))
1771 .ColorAndOpacity( FSlateColor::UseForeground() )
1775 return HorizontalBox;
1783 return EVisibility::Visible;
1787 return FSourceCodeNavigation::CanNavigateToClass(Class) ? EVisibility::Visible : EVisibility::Collapsed;
1795 return EVisibility::Visible;
1799 return EVisibility::Collapsed;
1804 UBlueprint* Blueprint =
nullptr;
1805 if (
const UBlueprintGeneratedClass* BlueprintClass = Cast<UBlueprintGeneratedClass>(Class))
1807 Blueprint = Cast<UBlueprint>(BlueprintClass->ClassGeneratedBy);
1810 static constexpr bool bFocusContentBrowser =
true;
1811 TArray<UObject*> ObjectsToSyncTo;
1814 ObjectsToSyncTo.Add(Blueprint);
1816 GEditor->SyncBrowserToObjects(ObjectsToSyncTo, bFocusContentBrowser);
1818 return FReply::Handled();
1824 FName FunctionNameToOpen
1827 UBlueprint* Blueprint =
nullptr;
1828 if (
const UBlueprintGeneratedClass* BlueprintClass = Cast<UBlueprintGeneratedClass>(Class))
1830 Blueprint = Cast<UBlueprint>(BlueprintClass->ClassGeneratedBy);
1835 static constexpr bool bForceFullEditor =
true;
1836 static constexpr bool bAddBlueprintFunctionIfItDoesNotExist =
true;
1842 bAddBlueprintFunctionIfItDoesNotExist
1848 FSourceCodeNavigation::NavigateToClass(
Object->GetClass());
1851 return FReply::Handled();
1859 return LOCTEXT(
"OpenObjectBlueprintTooltipKey",
"Open Blueprint Editor");
1863 return FText::Format(
1864 LOCTEXT(
"OpenObjectBlueprintTooltipKey",
"Open Source File in {0}"),
1865 FSourceCodeNavigation::GetSelectedSourceCodeIDE()
1871 return LOCTEXT(
"BrowseButtonToolTipText",
"Browse to Asset in Content Browser");
1876 FMenuBuilder MenuBuilder(
true,
nullptr);
1877 MenuBuilder.AddMenuEntry(
1878 LOCTEXT(
"HideEmptyCategories",
"Hide empty categories"),
1879 LOCTEXT(
"HideEmptyCategories_ToolTip",
"Hides categories that do not have any children"),
1882 FExecuteAction::CreateLambda([
this]()
1888 FCanExecuteAction(),
1889 FIsActionChecked::CreateLambda([]() ->
bool
1891 return GetDefault<UDlgSystemSettings>()->bHideEmptyDialogueBrowserCategories;
1895 EUserInterfaceActionType::ToggleButton
1898 return MenuBuilder.MakeWidget();
1901#undef LOCTEXT_NAMESPACE
EDialogueTreeNodeTextType
@ FNameClassVariableDialogue
@ ParticipantClassVariableInt
@ ParticipantClassVariableBool
@ ParticipantClassVariableFText
@ ParticipantClassVariableFloat
@ IntClassVariableDialogue
@ ParticipantClassVariableFName
@ FloatClassVariableDialogue
@ ParticipantVariableBool
@ FTextClassVariableDialogue
@ ParticipantVariableFloat
@ ParticipantVariableFName
@ BoolClassVariableDialogue
EDialogueBlueprintOpenType
#define DEFAULT_FONT(...)
static bool PredicateSortByDialoguesNumDescending(FName FirstParticipant, FName SecondParticipant, const TMap< FName, TSharedPtr< FDialogueBrowserTreeParticipantProperties > > &ParticipantsProperties)
static bool PredicateCompareDialogueTreeNode(const TSharedPtr< FDialogueBrowserTreeNode > &FirstNode, const TSharedPtr< FDialogueBrowserTreeNode > SecondNode)
static bool OpenBlueprintEditor(UBlueprint *Blueprint, EDialogueBlueprintOpenType OpenType=EDialogueBlueprintOpenType::None, FName FunctionNameToOpen=NAME_None, bool bForceFullEditor=true, bool bAddBlueprintFunctionIfItDoesNotExist=false)
static TSharedPtr< FDialogueSearchFoundResult > GetGraphNodesForClassFloatVariableName(FName FloatVariableName, const UDlgDialogue *Dialogue)
static TSharedPtr< FDialogueSearchFoundResult > GetGraphNodesForClassFNameVariableName(FName FNameVariableName, const UDlgDialogue *Dialogue)
static TSharedPtr< FDialogueSearchFoundResult > GetGraphNodesForCustomEvent(const UClass *EventClass, const UDlgDialogue *Dialogue)
static TSharedPtr< FDialogueSearchFoundResult > GetGraphNodesForEventEventName(FName EventName, const UDlgDialogue *Dialogue)
static TSharedPtr< FDialogueSearchFoundResult > GetGraphNodesForConditionEventCallName(FName ConditionName, const UDlgDialogue *Dialogue)
static TSharedPtr< FDialogueSearchFoundResult > GetGraphNodesForFNameVariableName(FName FNameVariableName, const UDlgDialogue *Dialogue)
static TSharedPtr< FDialogueSearchFoundResult > GetGraphNodesForFloatVariableName(FName FloatVariableName, const UDlgDialogue *Dialogue)
static TSharedPtr< FDialogueSearchFoundResult > GetGraphNodesForBoolVariableName(FName BoolVariableName, const UDlgDialogue *Dialogue)
static TSharedPtr< FDialogueSearchFoundResult > GetGraphNodesForClassIntVariableName(FName IntVariableName, const UDlgDialogue *Dialogue)
static TSharedPtr< FDialogueSearchFoundResult > GetGraphNodesForIntVariableName(FName IntVariableName, const UDlgDialogue *Dialogue)
static TSharedPtr< FDialogueSearchFoundResult > GetGraphNodesForClassBoolVariableName(FName BoolVariableName, const UDlgDialogue *Dialogue)
static TSharedPtr< FDialogueSearchFoundResult > GetGraphNodesForClassFTextVariableName(FName FTextVariableName, const UDlgDialogue *Dialogue)
static const FName PROPERTY_ReloadAssetIcon
static const FName PROPERTY_OpenAssetIcon
static TSharedPtr< ISlateStyle > Get()
static const FName PROPERTY_FindAssetIcon
static const FName PROPERTY_ConditionIcon
static const FName PROPERTY_DlgDialogueClassThumbnail
static const FName PROPERTY_EventIcon
static void SortDefault(TArray< FName > &OutArray)
static FString CleanObjectName(FString Name)
static bool IsABlueprintClass(const UClass *Class)
void AddGraphNodeChildrenToItem(const TSharedPtr< FDialogueBrowserTreeNode > &InItem, const TSet< TWeakObjectPtr< const UDialogueGraphNode > > &GraphNodes, EDialogueTreeNodeTextType TextType)
TMap< FName, TSharedPtr< FDialogueBrowserTreeParticipantProperties > > ParticipantsProperties
TArray< TSharedPtr< FDialogueBrowserTreeNode > > MakeClassVariableCategoriesChildren(const TSharedPtr< FDialogueBrowserTreeNode > &Parent, const TSharedPtr< FDialogueBrowserTreeParticipantProperties > &ParticipantProperties, bool bHideEmptyCategories) const
void HandleSetExpansionRecursive(TSharedPtr< FDialogueBrowserTreeNode > InItem, bool bInIsItemExpanded)
static EVisibility GetOpenAssetButtonVisibility(UClass *Class)
TSharedPtr< FDialogueBrowserSortOption > SortOptionType
TArray< TSharedPtr< FDialogueBrowserTreeNode > > MakeParticipantCategoriesChildren(const TSharedPtr< FDialogueBrowserTreeNode > &Parent, const TSharedPtr< FDialogueBrowserTreeParticipantProperties > &ParticipantProperties, bool bHideEmptyCategories) const
SortOptionType DefaultSortOption
TSharedPtr< STreeView< TSharedPtr< FDialogueBrowserTreeNode > > > ParticipantsTreeView
void HandleDoubleClick(TSharedPtr< FDialogueBrowserTreeNode > InItem)
TArray< SortOptionType > SortOptions
void AddEdgeNodeChildrenToItem(const TSharedPtr< FDialogueBrowserTreeNode > &InItem, const TSet< TWeakObjectPtr< const UDialogueGraphNode_Edge > > &EdgeNodes, EDialogueTreeNodeTextType TextType)
TArray< TSharedPtr< FDialogueBrowserTreeNode > > MakeVariableCategoriesChildren(const TSharedPtr< FDialogueBrowserTreeNode > &Parent, const TSharedPtr< FDialogueBrowserTreeParticipantProperties > &ParticipantProperties, bool bHideEmptyCategories) const
TSharedRef< SWidget > FillViewOptionsEntries()
void BuildTreeViewItem(const TSharedPtr< FDialogueBrowserTreeNode > &Item)
void HandleSortSelectionChanged(SortOptionType Selection, ESelectInfo::Type SelectInfo)
TArray< TSharedPtr< FDialogueBrowserTreeNode > > RootChildren
static EVisibility GetBrowseAssetButtonVisibility(UClass *Class)
void HandleGetChildren(TSharedPtr< FDialogueBrowserTreeNode > InItem, TArray< TSharedPtr< FDialogueBrowserTreeNode > > &OutChildren)
TSharedRef< ITableRow > HandleGenerateRow(TSharedPtr< FDialogueBrowserTreeNode > InItem, const TSharedRef< STableViewBase > &OwnerTable)
FText GetFilterText() const
FReply FindInContentBrowserForItem(TSharedPtr< FDialogueBrowserTreeNode > InItem)
TSharedRef< SWidget > MakeInlineWidget(const TSharedPtr< FDialogueBrowserTreeNode > &InItem)
TSharedRef< SWidget > GetFilterTextBoxWidget()
TSharedRef< SWidget > MakeButtonsWidgetForDialogue(const TSharedPtr< FDialogueBrowserTreeNode > &InItem)
TSharedPtr< SSearchBox > FilterTextBoxWidget
void RefreshTree(bool bPreserveExpansion)
void Construct(const FArguments &InArgs)
static FReply OnOpenAssetClicked(UClass *Class, EDialogueBlueprintOpenType OpenType, FName FunctionNameToOpen)
TSharedPtr< FDialogueBrowserTreeNode > RootTreeItem
void AddVariableChildrenToItem(const TSharedPtr< FDialogueBrowserTreeNode > &Item, const TMap< FName, TSharedPtr< FDialogueBrowserTreeVariableProperties > > &Variables, EDialogueTreeNodeTextType VariableType)
static FText GetBrowseAssetText(UClass *Class)
void HandleSearchTextCommitted(const FText &InText, ETextCommit::Type InCommitType)
TSharedRef< SHorizontalBox > MakeCustomObjectIconAndTextWidget(const FText &InText, const FSlateBrush *IconBrush, UClass *Class, EDialogueBlueprintOpenType OpenType, FName FunctionNameToOpen, int32 IconSize=24)
TSharedRef< SWidget > MakeButtonWidgetForGraphNodes(const TArray< TSharedPtr< FDialogueBrowserTreeNode > > &InChildren)
void AddDialogueChildrenToItemFromProperty(const TSharedPtr< FDialogueBrowserTreeNode > &InItem, const TSharedPtr< FDialogueBrowserTreeVariableProperties > *PropertyPtr, EDialogueTreeNodeTextType TextType)
SortOptionType SelectedSortOption
void GenerateFilteredItems()
void HandleTreeSelectionChanged(TSharedPtr< FDialogueBrowserTreeNode > NewValue, ESelectInfo::Type SelectInfo)
TSharedRef< SHorizontalBox > MakeIconAndTextWidget(const FText &InText, const FSlateBrush *IconBrush, int32 IconSize=24)
void AddGraphNodeBaseChildrenToItemFromProperty(const TSharedPtr< FDialogueBrowserTreeNode > &InItem, const TSharedPtr< FDialogueBrowserTreeVariableProperties > *PropertyPtr, EDialogueTreeNodeTextType GraphNodeTextType, EDialogueTreeNodeTextType EdgeNodeTextType)
static FText GetJumpToAssetText(UClass *Class)
static FReply OnBrowseAssetClicked(UClass *Class)
UCLASS(BlueprintType, Meta = (DisplayThumbnail = "true"))
FGuid GetGUID() const
UFUNCTION(BlueprintPure, Category = "Dialogue|GUID")
UCLASS(Blueprintable, BlueprintType, Abstract, EditInlineNew)
static TArray< UDlgDialogue * > GetAllDialoguesFromMemory()
UCLASS(Config = Engine, DefaultConfig, meta = (DisplayName = "Dialogue System Settings"))
void SetHideEmptyDialogueBrowserCategories(bool InVariableValue)
bool bHideEmptyDialogueBrowserCategories
UPROPERTY(Category = "Browser", Config, EditAnywhere)