// Copyright Epic Games, Inc. All Rights Reserved. #pragma once #include "SGraphNodeAI.h" #include "Misc/NotifyHook.h" #include "Widgets/SBoxPanel.h" class SBorder; struct FNodeBounds; struct FOverlayBrushInfo; struct FOverlayWidgetInfo; class SHorizontalBox; class SToolTip; class SVerticalBox; class UConversationGraphNode; class SWidget; enum class ESubNodeWidgetLocation : uint8 { Above, Below }; struct FSubNodeWidgetStuff { TSharedPtr ChildNodeBox; TArray< TSharedPtr > ChildNodeWidgets; }; ////////////////////////////////////////////////////////////////////// class SConversationGraphNode : public SGraphNodeAI, public FNotifyHook { public: SLATE_BEGIN_ARGS(SConversationGraphNode){} SLATE_END_ARGS() void Construct(const FArguments& InArgs, UConversationGraphNode* InNode); // SGraphNode interface virtual void UpdateGraphNode() override; virtual void CreatePinWidgets() override; virtual void AddPin(const TSharedRef& PinToAdd) override; virtual TSharedPtr GetComplexTooltip() override; virtual void GetOverlayBrushes(bool bSelected, const FVector2f& WidgetSize, TArray& Brushes) const override; virtual TArray GetOverlayWidgets(bool bSelected, const FVector2f& WidgetSize) const override; virtual TSharedRef GetNodeUnderMouse(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent) override; virtual void MoveTo(const FVector2f& NewPosition, FNodeSet& NodeFilter, bool bMarkDirty = true) override; virtual FReply OnDrop(const FGeometry& MyGeometry, const FDragDropEvent& DragDropEvent) override; // End of SGraphNode interface /** handle double click */ virtual FReply OnMouseButtonDoubleClick( const FGeometry& InMyGeometry, const FPointerEvent& InMouseEvent ) override; /** * Ticks this widget. Override in derived classes, but always call the parent implementation. * * @param AllottedGeometry The space allotted for this widget * @param InCurrentTime Current absolute real time * @param InDeltaTime Real time passed since last tick */ virtual void Tick( const FGeometry& AllottedGeometry, const double InCurrentTime, const float InDeltaTime ) override; /** adds a sub node widget inside current node */ void AddSubNodeWidget(TSharedPtr NewSubNodeWidget, ESubNodeWidgetLocation Location); FVector2D GetCachedPosition() const { return CachedPosition; } protected: uint32 bSuppressDebuggerColor : 1; uint32 bSuppressDebuggerTriggers : 1; /** time spent in current state */ float DebuggerStateDuration; /** currently displayed state */ int32 DebuggerStateCounter; /** debugger colors */ FLinearColor FlashColor; float FlashAlpha; /** height offsets for search triggers */ TArray TriggerOffsets; /** cached draw position */ FVector2D CachedPosition; TMap ChildNodeStuff; TSharedPtr OutputPinBox; /** The widget we use to display the index of the node */ TSharedPtr IndexOverlay; /** The node body widget, cached here so we can determine its size when we want ot position our overlays */ TSharedPtr NodeBody; FSlateColor GetBorderBackgroundColor() const; FSlateColor GetBackgroundColor() const; virtual const FSlateBrush* GetNameIcon() const override; virtual EVisibility GetBlueprintIconVisibility() const; /** Get the visibility of the index overlay */ EVisibility GetIndexVisibility() const; /** Get the text to display in the index overlay */ FText GetIndexText() const; /** Get the tooltip for the index overlay */ FText GetIndexTooltipText() const; /** Get the color to display for the index overlay. This changes on hover state of sibling nodes */ FSlateColor GetIndexColor(bool bHovered) const; /** Handle hover state changing for the index widget - we use this to highlight sibling nodes */ void OnIndexHoverStateChanged(bool bHovered); FText GetPinTooltip(UEdGraphPin* GraphPinObj) const; bool IsNodeReachable() const; EVisibility GetTaskRequirementsVisibility() const; EVisibility GetTaskGeneratesChoicesVisibility() const; void PropertyRowsRefreshed(); virtual void NotifyPostChange(const FPropertyChangedEvent& PropertyChangedEvent, class FEditPropertyChain* PropertyThatChanged) override; TSharedPtr PropertyRowGenerator; class SVerticalBox::FSlot* PropertyDetailsSlot; };