A Demo Project for the UnrealEngineSDK
Loading...
Searching...
No Matches
DialogueGraphConnectionDrawingPolicy.h
Go to the documentation of this file.
1// Copyright Csaba Molnar, Daniel Butum. All Rights Reserved.
2#pragma once
3
4#include "Layout/ArrangedWidget.h"
5#include "Widgets/SWidget.h"
6#include "ConnectionDrawingPolicy.h"
7
8#include "DlgSystemSettings.h"
9
10class FSlateWindowElementList;
11class UEdGraph;
12
13// This class draws the connections for an UEdGraph using a Dialogue schema
14// Aka how the wires look and and the flow look.
16{
18
33public:
35 int32 InBackLayerID,
36 int32 InFrontLayerID,
37 float ZoomFactor,
38 const FSlateRect& InClippingRect,
39 FSlateWindowElementList& InDrawElements,
40 UEdGraph* InGraphObj
41 );
42
43 //
44 // FConnectionDrawingPolicy interface
45 //
46
47 // Determine how the wires looks
48 void DetermineWiringStyle(UEdGraphPin* OutputPin, UEdGraphPin* InputPin, /*inout*/ FConnectionParams& Params) override;
49
50 // Determinte to what geometries the wires are connected.
52 FArrangedChildren& ArrangedNodes,
53 TSharedRef<SWidget>& OutputPinWidget,
54 UEdGraphPin* OutputPin,
55 UEdGraphPin* InputPin,
56 /*out*/ FArrangedWidget*& StartWidgetGeometry,
57 /*out*/ FArrangedWidget*& EndWidgetGeometry
58 ) override;
59
60 // How should we draw the spline and arrow arrow?
61 void DrawSplineWithArrow(const FGeometry& StartGeom, const FGeometry& EndGeom, const FConnectionParams& Params) override;
62 void DrawSplineWithArrow(const FVector2D& StartPoint, const FVector2D& EndPoint, const FConnectionParams& Params) override;
63
64 // The method that actually draws the spline
65 void DrawConnection(int32 LayerId, const FVector2D& Start, const FVector2D& End, const FConnectionParams& Params) override;
66
67 // Sometimes the panel draws a preview connector; e.g. when the user is connecting pins
68 void DrawPreviewConnector(const FGeometry& PinGeometry, const FVector2D& StartPoint, const FVector2D& EndPoint, UEdGraphPin* Pin) override;
69
70 // Compute the tangent of the spline.
71 FVector2D ComputeSplineTangent(const FVector2D& Start, const FVector2D& End) const override;
72
73 // Draws the wire
74 void Draw(TMap<TSharedRef<SWidget>, FArrangedWidget>& PinGeometries, FArrangedChildren& ArrangedNodes) override;
75
76 // End of FConnectionDrawingPolicy interface
77
78protected:
79 void Internal_DrawLineWithArrow(const FVector2D& StartAnchorPoint, const FVector2D& EndAnchorPoint, const FConnectionParams& Params);
80
81protected:
82 // Map for widgets
83 UEdGraph* Graph = nullptr;
84
85 // Map for widgets
86 TMap<UEdGraphNode*, int32> NodeWidgetMap;
87
88 // Cache the settings
90};
void DrawConnection(int32 LayerId, const FVector2D &Start, const FVector2D &End, const FConnectionParams &Params) override
void DetermineWiringStyle(UEdGraphPin *OutputPin, UEdGraphPin *InputPin, FConnectionParams &Params) override
void DrawSplineWithArrow(const FGeometry &StartGeom, const FGeometry &EndGeom, const FConnectionParams &Params) override
void DetermineLinkGeometry(FArrangedChildren &ArrangedNodes, TSharedRef< SWidget > &OutputPinWidget, UEdGraphPin *OutputPin, UEdGraphPin *InputPin, FArrangedWidget *&StartWidgetGeometry, FArrangedWidget *&EndWidgetGeometry) override
FDialogueGraphConnectionDrawingPolicy(int32 InBackLayerID, int32 InFrontLayerID, float ZoomFactor, const FSlateRect &InClippingRect, FSlateWindowElementList &InDrawElements, UEdGraph *InGraphObj)
FVector2D ComputeSplineTangent(const FVector2D &Start, const FVector2D &End) const override
void DrawPreviewConnector(const FGeometry &PinGeometry, const FVector2D &StartPoint, const FVector2D &EndPoint, UEdGraphPin *Pin) override
void Internal_DrawLineWithArrow(const FVector2D &StartAnchorPoint, const FVector2D &EndAnchorPoint, const FConnectionParams &Params)
void Draw(TMap< TSharedRef< SWidget >, FArrangedWidget > &PinGeometries, FArrangedChildren &ArrangedNodes) override
UCLASS(Config = Engine, DefaultConfig, meta = (DisplayName = "Dialogue System Settings"))