31 RootTreeItem = MakeShared<FDlgDataDisplayTreeRootNode>();
32 ActorsTreeView = SNew(STreeView<TSharedPtr<FDlgDataDisplayTreeNode>>)
38 .SelectionMode(ESelectionMode::Single)
43 .Visibility(EVisibility::Visible)
44 +SHeaderRow::Column(NAME_Name)
45 .DefaultLabel(LOCTEXT(
"Name",
"Name"))
51 .BorderImage(FCoreStyle::Get().GetBrush(
"ToolPanel.GroupBorder"))
52 .BorderBackgroundColor(FLinearColor::Gray)
64 +SHorizontalBox::Slot()
66 .Padding(0.f, 0.f, 4.f, 0.f)
72 +SHorizontalBox::Slot()
76 .ToolTipText(LOCTEXT(
"RefreshToolTip",
"Refreshes/Reloads the Actors Dialogue data."))
80 .Text(LOCTEXT(
"RefreshDialogues",
"Refresh"))
91 .BorderImage(FCoreStyle::Get().GetBrush(
"ToolPanel.GroupBorder"))
92 .Padding(FMargin(0.0f, 4.0f))
106 TSet<TSharedPtr<FDlgDataDisplayTreeNode>> OldExpansionState;
107 if (bPreserveExpansion)
131 TEXT(
"Failed to refresh SDlgDataDisplay tree. World is a null pointer. "
132 "Is the game running? "
133 "Did you setup the DlgSystem Console commands in your GameMode BeginPlay/StartPlay?")
143 TMap<FName, TSet<TWeakObjectPtr<const UDlgDialogue>>> ParticipantNamesDialoguesMap;
146 TSet<FName> ParticipantsNames;
147 Dialogue->GetAllParticipantNames(ParticipantsNames);
149 for (
const FName& ParticipantName : ParticipantsNames)
151 TSet<TWeakObjectPtr<const UDlgDialogue>>* ValuePtr = ParticipantNamesDialoguesMap.Find(ParticipantName);
152 if (ValuePtr ==
nullptr)
155 TSet<TWeakObjectPtr<const UDlgDialogue>> ValueArray{
Dialogue};
156 ParticipantNamesDialoguesMap.Add(ParticipantName, ValueArray);
167 for (TWeakObjectPtr<AActor>
Actor : Actors)
169 if (!
Actor.IsValid())
178 const FName ParticipantName = IDlgDialogueParticipant::Execute_GetParticipantName(
Actor.Get());
179 TSet<TWeakObjectPtr<const UDlgDialogue>> ActorDialogues;
180 TSet<TWeakObjectPtr<const UDlgDialogue>>* ActorDialoguesPtr = ParticipantNamesDialoguesMap.Find(ParticipantName);
181 if (ActorDialoguesPtr !=
nullptr)
184 ActorDialogues = *ActorDialoguesPtr;
188 TSharedPtr<FDlgDataDisplayActorProperties> ActorsPropertiesValue =
189 MakeShared<FDlgDataDisplayActorProperties>(ActorDialogues);
193 for (TWeakObjectPtr<const UDlgDialogue>
Dialogue : ActorDialogues)
201 TSet<FName> EventsNames;
202 Dialogue->GetEvents(ParticipantName, EventsNames);
203 for (
const FName& EventName : EventsNames)
205 ActorsPropertiesValue->AddDialogueToEvent(EventName,
Dialogue);
209 TSet<FName> ConditionNames;
210 Dialogue->GetConditions(ParticipantName, ConditionNames);
211 for (
const FName& ConditionName : ConditionNames)
213 ActorsPropertiesValue->AddDialogueToCondition(ConditionName,
Dialogue);
217 TSet<FName> IntVariableNames;
218 Dialogue->GetIntNames(ParticipantName, IntVariableNames);
219 for (
const FName& IntVariableName : IntVariableNames)
221 ActorsPropertiesValue->AddDialogueToIntVariable(IntVariableName,
Dialogue);
225 TSet<FName> FloatVariableNames;
226 Dialogue->GetFloatNames(ParticipantName, FloatVariableNames);
227 for (
const FName& FloatVariableName : FloatVariableNames)
229 ActorsPropertiesValue->AddDialogueToFloatVariable(FloatVariableName,
Dialogue);
233 TSet<FName> BoolVariableNames;
234 Dialogue->GetBoolNames(ParticipantName, BoolVariableNames);
235 for (
const FName& BoolVariableName : BoolVariableNames)
237 ActorsPropertiesValue->AddDialogueToBoolVariable(BoolVariableName,
Dialogue);
241 TSet<FName> FNameVariableNames;
242 Dialogue->GetNameNames(ParticipantName, FNameVariableNames);
243 for (
const FName& NameVariableName : FNameVariableNames)
245 ActorsPropertiesValue->AddDialogueToFNameVariable(NameVariableName,
Dialogue);
249 TSet<FName> ClassIntVariableNames;
250 Dialogue->GetClassIntNames(ParticipantName, ClassIntVariableNames);
251 for (
const FName& IntVariableName : ClassIntVariableNames)
253 ActorsPropertiesValue->AddDialogueToClassIntVariable(IntVariableName,
Dialogue);
257 TSet<FName> ClassFloatVariableNames;
258 Dialogue->GetClassFloatNames(ParticipantName, ClassFloatVariableNames);
259 for (
const FName& FloatVariableName : ClassFloatVariableNames)
261 ActorsPropertiesValue->AddDialogueToClassFloatVariable(FloatVariableName,
Dialogue);
265 TSet<FName> ClassBoolVariableNames;
266 Dialogue->GetClassBoolNames(ParticipantName, ClassBoolVariableNames);
267 for (
const FName& BoolVariableName : ClassBoolVariableNames)
269 ActorsPropertiesValue->AddDialogueToClassBoolVariable(BoolVariableName,
Dialogue);
273 TSet<FName> ClassFNameVariableNames;
274 Dialogue->GetClassNameNames(ParticipantName, ClassFNameVariableNames);
275 for (
const FName& NameVariableName : ClassFNameVariableNames)
277 ActorsPropertiesValue->AddDialogueToClassFNameVariable(NameVariableName,
Dialogue);
281 TSet<FName> ClassFTextVariableNames;
282 Dialogue->GetClassTextNames(ParticipantName, ClassFTextVariableNames);
283 for (
const FName& NameVariableName : ClassFTextVariableNames)
285 ActorsPropertiesValue->AddDialogueToClassFTextVariable(NameVariableName,
Dialogue);
294 if (!Elem.Key.IsValid())
300 TSharedPtr<FDlgDataDisplayTreeNode> ActorItem =
313 if (bPreserveExpansion && OldExpansionState.Num() > 0)
316 TArray<TSharedPtr<FDlgDataDisplayTreeNode>> AllNodes;
320 FDlgTreeViewHelper::RestoreTreeExpansionState<TSharedPtr<FDlgDataDisplayTreeNode>>(
ActorsTreeView,
403 TWeakObjectPtr<AActor>
Actor = Item->GetParentActor();
404 if (!
Actor.IsValid())
411 if (ValuePtr ==
nullptr)
415 TSharedPtr<FDlgDataDisplayActorProperties> ActorPropertiesValue = *ValuePtr;
419 switch (Item->GetTextType())
422 Item->AddChild(MakeShared<FDlgDataDisplayTreeCategoryNode>(
424 Item->AddChild(MakeShared<FDlgDataDisplayTreeCategoryNode>(
426 Item->AddChild(MakeShared<FDlgDataDisplayTreeCategoryNode>(
438 else if (Item->IsCategory())
441 switch (Item->GetCategoryType())
444 for (
const auto& Pair: ActorPropertiesValue->GetEvents())
446 const TSharedPtr<FDlgDataDisplayTreeNode> EventItem = MakeShared<FDlgDataDisplayTreeVariableNode>(
449 Item->AddChild(EventItem);
454 for (
const auto& Pair: ActorPropertiesValue->GetConditions())
456 const TSharedPtr<FDlgDataDisplayTreeNode> ConditionItem = MakeShared<FDlgDataDisplayTreeVariableNode>(
459 Item->AddChild(ConditionItem);
492 for (
const TSharedPtr<FDlgDataDisplayTreeNode>& ChildItem : Item->GetChildren())
506 const TSharedRef<STableViewBase>& OwnerTable)
509 TSharedPtr<STableRow<TSharedPtr<FDlgDataDisplayTreeNode>>> TableRow;
510 const FMargin RowPadding = FMargin(2.f, 2.f);
511 TableRow = SNew(
STableRow<TSharedPtr<FDlgDataDisplayTreeNode>>, OwnerTable)
515 TSharedPtr<STextBlock> DefaultTextBlock = SNew(STextBlock)
516 .Text(InItem->GetDisplayText())
519 TSharedPtr<SWidget> RowContent = DefaultTextBlock;
520 TSharedPtr<SHorizontalBox> RowContainer;
521 TableRow->SetRowContent(SAssignNew(RowContainer, SHorizontalBox));
523 if (InItem->IsText())
528 TSharedPtr<SDlgDataPropertyValue> RightWidget;
529 TSharedPtr<FDlgDataDisplayTreeVariableNode> VariableNode =
530 StaticCastSharedPtr<FDlgDataDisplayTreeVariableNode>(InItem);
533 switch (VariableNode->GetVariableType())
565 RowContent = SNew(SHorizontalBox)
567 +SHorizontalBox::Slot()
570 .VAlign(VAlign_Center)
572 DefaultTextBlock.ToSharedRef()
575 +SHorizontalBox::Slot()
578 .VAlign(VAlign_Center)
580 RightWidget.ToSharedRef()
586 RowContainer->AddSlot()
589 .HAlign(HAlign_Right)
591 SNew(SExpanderArrow, TableRow)
595 RowContainer->AddSlot()
599 RowContent.ToSharedRef()
602 return TableRow.ToSharedRef();