4#include "Widgets/Layout/SBox.h"
5#include "Widgets/Images/SImage.h"
6#include "Widgets/SToolTip.h"
7#include "GraphEditorSettings.h"
8#include "SCommentBubble.h"
9#include "SLevelOfDetailBranchNode.h"
10#include "IDocumentation.h"
11#include "GraphEditorDragDropAction.h"
17#define LOCTEXT_NAMESPACE "DialogueEditor"
27 SetCursor(EMouseCursor::CardinalCross);
44 return Super::OnDrop(MyGeometry, DragDropEvent);
57 TArray<FOverlayWidgetInfo> Widgets;
58 static constexpr float DistanceBetweenWidgetsY = 1.5f;
59 FVector2D OriginRightSide(0.0f, 0.0f);
60 FVector2D OriginLeftSide(0.0f, 0.0f);
66 Overlay.OverlayOffset = FVector2D(WidgetSize.X -
IndexOverlayWidget->GetDesiredSize().X / 2.0f, OriginRightSide.Y);
76 Overlay.OverlayOffset = FVector2D(WidgetSize.X -
VoiceOverlayWidget->GetDesiredSize().X / 3.0f, OriginRightSide.Y);
86 Overlay.OverlayOffset = FVector2D(WidgetSize.X -
GenericOverlayWidget->GetDesiredSize().X / 3.0f, OriginRightSide.Y);
106 Overlay.OverlayOffset = FVector2D(-
EventOverlayWidget->GetDesiredSize().X / 1.5f, OriginLeftSide.Y);
107 Widgets.Add(Overlay);
116 Super::GetOverlayBrushes(bSelected, WidgetSize, Brushes);
127 SetupErrorReporting();
130 const FMargin NodePadding = 10.0f;
137 .ColorAndOpacity(FLinearColor::White)
138 .Font(FEditorStyle::GetFontStyle(
"BTEditor.Graph.BTNode.IndexText"))
146 static constexpr int WidthOverride = 24;
147 static constexpr int HeightOverride = 24;
153 .WidthOverride(WidthOverride)
154 .HeightOverride(HeightOverride)
169 .WidthOverride(WidthOverride)
170 .HeightOverride(HeightOverride)
185 .WidthOverride(WidthOverride)
186 .HeightOverride(HeightOverride)
201 .WidthOverride(WidthOverride)
202 .HeightOverride(HeightOverride)
213 if (!SWidget::GetToolTip().IsValid())
215 TSharedRef<SToolTip> DefaultToolTip = IDocumentation::Get()->CreateToolTip(TAttribute<FText>(
this, &Super::GetNodeTooltip),
nullptr,
216 GraphNode->GetDocumentationLink(), GraphNode->GetDocumentationExcerptName());
217 SetToolTip(DefaultToolTip);
222 ContentScale.Bind(
this, &Super::GetContentScale);
223 GetOrAddSlot(ENodeZone::Center)
225 .VAlign(VAlign_Center)
228 .BorderImage(FEditorStyle::GetBrush(
"Graph.StateNode.Body"))
243 .HAlign(HAlign_Center)
244 .VAlign(VAlign_Center)
245 .Padding(NodePadding)
256 TSharedPtr<SCommentBubble> CommentBubble;
257 const FSlateColor CommentColor = GetDefault<UGraphEditorSettings>()->DefaultCommentNodeTitleColor;
259 SAssignNew(CommentBubble, SCommentBubble)
260 .GraphNode(GraphNode)
261 .Text(
this, &Super::GetNodeComment)
262 .OnTextCommitted(
this, &Super::OnCommentTextCommitted)
263 .OnToggled(
this, &Super::OnCommentBubbleToggled)
264 .ColorAndOpacity(CommentColor)
266 .EnableTitleBarBubble(
true)
267 .EnableBubbleCtrls(
true)
268 .GraphLOD(
this, &Super::GetCurrentLOD)
269 .IsGraphNodeHovered(
this, &Super::IsHovered);
272 GetOrAddSlot(ENodeZone::TopCenter)
273 .SlotOffset(TAttribute<FVector2D>(CommentBubble.Get(), &SCommentBubble::GetOffset))
274 .SlotSize(TAttribute<FVector2D>(CommentBubble.Get(), &SCommentBubble::GetSize))
275 .AllowScaling(TAttribute<bool>(CommentBubble.Get(), &SCommentBubble::IsScalingAllowed))
278 CommentBubble.ToSharedRef()
300 .BorderImage(FEditorStyle::GetBrush(
"BTEditor.Graph.BTNode.Body"))
302 .HAlign(HAlign_Center)
303 .VAlign(VAlign_Center)
305 .Visibility(EVisibility::Visible)
311 +SVerticalBox::Slot()
320 +SVerticalBox::Slot()
340 TSharedPtr<SNodeTitle> NodeTitleMultipleLines = SNew(SNodeTitle, GraphNode);
341 TWeakPtr<SNodeTitle> WeakNodeTitle = NodeTitleMultipleLines;
342 auto GetNodeTitlePlaceholderWidth = [WeakNodeTitle]() -> FOptionalSize
344 TSharedPtr<SNodeTitle> NodeTitlePin = WeakNodeTitle.Pin();
345 const float DesiredWidth = NodeTitlePin.IsValid() ? NodeTitlePin->GetTitleSize().X : 0.0f;
346 return FMath::Max(75.0f, DesiredWidth);
348 auto GetNodeTitlePlaceholderHeight = [WeakNodeTitle]() -> FOptionalSize
350 TSharedPtr<SNodeTitle> NodeTitlePin = WeakNodeTitle.Pin();
351 const float DesiredHeight = NodeTitlePin.IsValid() ? NodeTitlePin->GetTitleSize().Y : 0.0f;
352 return FMath::Max(22.0f, DesiredHeight);
356 IconColor = FLinearColor::White;
357 const FSlateBrush* IconBrush =
nullptr;
358 if (GraphNode->ShowPaletteIconOnNode())
360 IconBrush = GraphNode->GetIconAndTint(IconColor).GetIcon();
365 +SHorizontalBox::Slot()
373 +SHorizontalBox::Slot()
377 ErrorReporting->AsWidget()
381 +SHorizontalBox::Slot()
384 SNew(SLevelOfDetailBranchNode)
389 .WidthOverride_Lambda(GetNodeTitlePlaceholderWidth)
390 .HeightOverride_Lambda(GetNodeTitlePlaceholderHeight)
397 +SHorizontalBox::Slot()
402 .ColorAndOpacity(
this, &Super::GetNodeTitleIconColor)
406 +SHorizontalBox::Slot()
412 +SVerticalBox::Slot()
417 .TextStyle(FEditorStyle::Get(),
"Graph.StateNode.NodeTitle")
419 .Text(NodeTitleMultipleLines.Get(), &SNodeTitle::GetHeadTitle)
424 +SVerticalBox::Slot()
427 NodeTitleMultipleLines.ToSharedRef()
446 TSharedPtr<SVerticalBox> VerticalBox = SNew(SVerticalBox);
449 for (int32 EntryIndex = 0; EntryIndex < SpechSequnceEntriesNum; EntryIndex++)
451 VerticalBox->AddSlot()
456 .BorderImage(FEditorStyle::GetBrush(
"PlainBorder"))
458 .Padding(FMargin(0.f, 2.f))
463 +SVerticalBox::Slot()
465 .VAlign(VAlign_Center)
471 .TextStyle(FEditorStyle::Get(),
"Graph.Node.NodeTitle")
476 +SVerticalBox::Slot()
507 return EVisibility::Hidden;
511 TSharedPtr<SGraphPanel> MyOwnerPanel = GetOwnerPanel();
512 return !MyOwnerPanel.IsValid() || MyOwnerPanel->GetCurrentLOD() > EGraphRenderingLOD::LowDetail ? EVisibility::Visible : EVisibility::Collapsed;
518 return LOCTEXT(
"NodeIndexTooltip",
"Node index: this shows the node index in the Dialogue.Nodes Array");
523 return LOCTEXT(
"NodeConditionTooltip",
"Node has enter conditions.\nOnly if these conditions are satisfied the node is entered.");
528 return LOCTEXT(
"NodeEventTooltip",
"Node has enter events.\nOn node enter this events are executed.");
533 return LOCTEXT(
"NodeVoiceTooltip",
"Node has some voice variables set. Either the SoundWave or the DialogueWave.");
538 return LOCTEXT(
"NodeGenericTooltip",
"Node has the generic data variable set.");
548#undef LOCTEXT_NAMESPACE
static const FName PROPERTY_VoiceIcon
static TSharedPtr< ISlateStyle > Get()
static const FName PROPERTY_GenericIcon
static const FName PROPERTY_ConditionIcon
static const FName PROPERTY_EventIcon
void CreatePinWidgets() override
const UDlgSystemSettings * Settings
TSharedPtr< SVerticalBox > PinsNodeBox
void UpdateGraphNode() override
void Construct(const FArguments &InArgs, UDialogueGraphNode_Base *InNode)
TSharedRef< SWidget > GetNodeBodyWidget()
FText GetGenericOverlayTooltipText() const
UDialogueGraphNode * DialogueGraphNode
FText GetDescriptionForSpeechSequenceEntryAt(int32 SpeechEntryIndex) const
FSlateColor GetBackgroundColor() const
FSlateColor GetOverlayWidgetBackgroundColor(bool bHovered) const
FText GetIndexOverlayTooltipText() const
void UpdateGraphNode() override
TSharedPtr< SWidget > GenericOverlayWidget
FText GetVoiceOverlayTooltipText() const
FReply OnDrop(const FGeometry &MyGeometry, const FDragDropEvent &DragDropEvent) override
void GetOverlayBrushes(bool bSelected, const FVector2D WidgetSize, TArray< FOverlayBrushInfo > &Brushes) const override
TSharedPtr< SBorder > NodeBodyWidget
void Construct(const FArguments &InArgs, UDialogueGraphNode *InNode)
const TArray< FDlgSpeechSequenceEntry > & GetSpeechSequenceEntries() const
FText GetEventOverlayTooltipText() const
TSharedRef< SWidget > GetTitleWidget()
TSharedPtr< SWidget > VoiceOverlayWidget
FText GetIndexText() const
TSharedRef< SWidget > GetDescriptionWidget()
void OnIndexHoverStateChanged(bool bHovered)
TSharedPtr< SWidget > IndexOverlayWidget
TSharedPtr< SWidget > TitleWidget
TSharedPtr< SWidget > EventOverlayWidget
TSharedPtr< SWidget > ConditionOverlayWidget
TArray< FOverlayWidgetInfo > GetOverlayWidgets(bool bSelected, const FVector2D &WidgetSize) const override
FText GetConditionOverlayTooltipText() const
FText GetSpeakerForSpeechSequenceEntryAt(int32 SpeechEntryIndex) const
EVisibility GetOverlayWidgetVisibility() const
EVisibility GetDescriptionVisibility() const
bool UseLowDetailNodeTitles() const override
FText GetDescription() const
TSharedPtr< SWidget > DescriptionWidget
bool HasEnterEvents() const
bool HasVoicePropertiesSet() const
bool HasGenericDataSet() const
virtual bool IsRootNode() const
bool IsSpeechSequenceNode() const
bool HasEnterConditions() const
bool bShowHasEnterEventsIcon
UPROPERTY(Category = "Graph Node", Config, EditAnywhere)
bool bShowHasVoiceIcon
UPROPERTY(Category = "Graph Node", Config, EditAnywhere)
TEnumAsByte< EHorizontalAlignment > DescriptionSpeakerHorizontalAlignment
UPROPERTY(Category = "Graph Node Speech Sequence", Config, EditAnywhere)
bool bShowHasGenericDataIcon
UPROPERTY(Category = "Graph Node", Config, EditAnywhere)
bool bShowHasEnterConditionsIcon
UPROPERTY(Category = "Graph Node", Config, EditAnywhere)
TEnumAsByte< EHorizontalAlignment > TitleHorizontalAlignment
UPROPERTY(Category = "Graph Node", Config, EditAnywhere)
FMargin DescriptionSpeakerMargin
UPROPERTY(Category = "Graph Node Speech Sequence", Config, EditAnywhere)
FLinearColor BorderBackgroundColor
UPROPERTY(Category = "Graph Node Color", Config, EditAnywhere)
float DescriptionWrapTextAt
UPROPERTY(Category = "Graph Node", Config, EditAnywhere)
FMargin DescriptionTextMargin
UPROPERTY(Category = "Graph Node", Config, EditAnywhere)