更新对话编辑器
This commit is contained in:
parent
45eec41cbf
commit
3959389f3e
Binary file not shown.
BIN
ProjectFish/Content/DataAssets/Dialogue/DemoDialogue.uasset
Normal file
BIN
ProjectFish/Content/DataAssets/Dialogue/DemoDialogue.uasset
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -167,11 +167,22 @@ void FDialogueAssetEditor::SaveGraphData()
|
||||
if (!Pin1->Connections.Contains(Pin2))
|
||||
{
|
||||
Pin1->Connections.Add(Pin2);
|
||||
//按照横向位置进行排序
|
||||
Pin1->Connections.Sort([](const UDialogueRuntimePin& A, const UDialogueRuntimePin& B)
|
||||
{
|
||||
return A.Parent->Position.X < B.Parent->Position.X;
|
||||
});
|
||||
|
||||
if (Pin1->Direction == EGPD_Input)
|
||||
{
|
||||
if (!Pin2->Connections.Contains(Pin1))
|
||||
{
|
||||
Pin2->Connections.Add(Pin1);
|
||||
//按照横向位置进行排序
|
||||
Pin2->Connections.Sort([](const UDialogueRuntimePin& A, const UDialogueRuntimePin& B)
|
||||
{
|
||||
return A.Parent->Position.X < B.Parent->Position.X;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,7 +5,9 @@
|
||||
|
||||
#include "Node//DialogueGraphNode_NPC.h"
|
||||
#include "Node/DialogueGraphNode_Player.h"
|
||||
#include "Node/DialogueGraphNode_Root.h"
|
||||
#include "Widget/DialogueGraphNode.h"
|
||||
#include "Widget/GraphNodeWidget_Root.h"
|
||||
|
||||
|
||||
TSharedPtr<SGraphNode> FDialogueGraphPanelNodeFactory::CreateNode(class UEdGraphNode* InNode) const
|
||||
@ -15,5 +17,8 @@ TSharedPtr<SGraphNode> FDialogueGraphPanelNodeFactory::CreateNode(class UEdGraph
|
||||
|
||||
if (UDialogueGraphNode_Player* PlayerNode = Cast<UDialogueGraphNode_Player>(InNode))
|
||||
return SNew(SDialogueGraphNode, PlayerNode);
|
||||
|
||||
if (UDialogueGraphNode_Root* RootNode = Cast<UDialogueGraphNode_Root>(InNode))
|
||||
return SNew(SGraphNodeWidget_Root, RootNode);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -35,6 +35,269 @@ UEdGraphNode* FDialogueGraphSchemaAction_NewNode::PerformAction(UEdGraph* Parent
|
||||
return NewNode;
|
||||
}
|
||||
|
||||
FVerticalConnectionDrawingPolicy::FVerticalConnectionDrawingPolicy(int32 InBackLayerID, int32 InFrontLayerID,
|
||||
float InZoomFactor, const FSlateRect& InClippingRect, FSlateWindowElementList& InDrawElements)
|
||||
: FConnectionDrawingPolicy(InBackLayerID, InFrontLayerID, InZoomFactor, InClippingRect, InDrawElements)
|
||||
{
|
||||
}
|
||||
|
||||
void FVerticalConnectionDrawingPolicy::DrawSplineWithArrow(const FVector2D& StartPoint, const FVector2D& EndPoint,
|
||||
const FConnectionParams& Params)
|
||||
{
|
||||
// Draw the spline
|
||||
DrawConnection(
|
||||
WireLayerID,
|
||||
StartPoint,
|
||||
EndPoint,
|
||||
Params);
|
||||
|
||||
// Draw the arrow
|
||||
if (ArrowImage != nullptr)
|
||||
{
|
||||
FVector2D ArrowPoint = EndPoint - ArrowRadius;
|
||||
|
||||
FSlateDrawElement::MakeRotatedBox(
|
||||
DrawElementsList,
|
||||
ArrowLayerID,
|
||||
FPaintGeometry(ArrowPoint, ArrowImage->ImageSize * ZoomFactor, ZoomFactor),
|
||||
ArrowImage,
|
||||
ESlateDrawEffect::None,
|
||||
FMath::DegreesToRadians(90), // 旋转角度(弧度)
|
||||
ArrowImage->ImageSize * 0.5f * ZoomFactor, // 旋转中心
|
||||
FSlateDrawElement::RelativeToElement,
|
||||
Params.WireColor
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
void FVerticalConnectionDrawingPolicy::DrawSplineWithArrow(const FGeometry& StartGeom, const FGeometry& EndGeom,
|
||||
const FConnectionParams& Params)
|
||||
{
|
||||
//@TODO: These values should be pushed into the Slate style, they are compensating for a bit of
|
||||
// empty space inside of the pin brush images.
|
||||
const float StartFudgeX = 4.0f;
|
||||
const float EndFudgeX = 4.0f;
|
||||
const FVector2D StartPoint = FGeometryHelper::CenterOf(StartGeom) - FVector2D(ArrowRadius.X, StartFudgeX);
|
||||
const FVector2D EndPoint = FGeometryHelper::CenterOf(EndGeom) - FVector2D(0, ArrowRadius.Y - EndFudgeX);
|
||||
|
||||
DrawSplineWithArrow(StartPoint, EndPoint, Params);
|
||||
}
|
||||
|
||||
// void FVerticalConnectionDrawingPolicy::DrawConnection(int32 LayerId, const FVector2D& Start, const FVector2D& End,
|
||||
// const FConnectionParams& Params)
|
||||
// {
|
||||
// const FVector2D& P0 = Start;
|
||||
// const FVector2D& P1 = End;
|
||||
// // FVector2D P0 = GetCorrectedPinPosition(Start, Params.AssociatedPin1, Params.StartDirection);
|
||||
// // FVector2D P1 = GetCorrectedPinPosition(End, Params.AssociatedPin2, Params.EndDirection);
|
||||
//
|
||||
// // 计算连线方向
|
||||
// const FVector2D Delta = P1 - P0;
|
||||
// const bool bIsVerticalConnection = FMath::Abs(Delta.Y) > FMath::Abs(Delta.X);
|
||||
//
|
||||
// // 根据连线方向计算切线
|
||||
// FVector2D SplineTangent;
|
||||
// if (bIsVerticalConnection)
|
||||
// {
|
||||
// // 垂直连线:主要控制垂直方向的弯曲
|
||||
// SplineTangent = FVector2D(0, FMath::Abs(Delta.Y) * 0.5f);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// // 水平连线:保持原有逻辑
|
||||
// SplineTangent = FVector2D(FMath::Abs(Delta.X) * 0.5f, 0);
|
||||
// }
|
||||
//
|
||||
// // 修改切线方向计算,适应垂直连线
|
||||
// FVector2D P0Tangent, P1Tangent;
|
||||
//
|
||||
// if (bIsVerticalConnection)
|
||||
// {
|
||||
// // 垂直连线的切线逻辑
|
||||
// if (Params.StartDirection == EGPD_Output)
|
||||
// {
|
||||
// // 输出引脚:根据连线方向调整
|
||||
// P0Tangent = (Delta.Y >= 0) ? SplineTangent : -SplineTangent;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// // 输入引脚:根据连线方向调整
|
||||
// P0Tangent = (Delta.Y >= 0) ? -SplineTangent : SplineTangent;
|
||||
// }
|
||||
//
|
||||
// if (Params.EndDirection == EGPD_Input)
|
||||
// {
|
||||
// // 输入引脚:根据连线方向调整
|
||||
// P1Tangent = (Delta.Y >= 0) ? SplineTangent : -SplineTangent;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// // 输出引脚:根据连线方向调整
|
||||
// P1Tangent = (Delta.Y >= 0) ? -SplineTangent : SplineTangent;
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// // 水平连线保持原有逻辑
|
||||
// P0Tangent = (Params.StartDirection == EGPD_Output) ? SplineTangent : -SplineTangent;
|
||||
// P1Tangent = (Params.EndDirection == EGPD_Input) ? SplineTangent : -SplineTangent;
|
||||
// }
|
||||
//
|
||||
// // 使用自定义切线(如果提供了的话)
|
||||
// if (!Params.StartTangent.IsNearlyZero())
|
||||
// {
|
||||
// P0Tangent = Params.StartTangent;
|
||||
// }
|
||||
// if (!Params.EndTangent.IsNearlyZero())
|
||||
// {
|
||||
// P1Tangent = Params.EndTangent;
|
||||
// }
|
||||
//
|
||||
// // 后面的碰撞检测等逻辑保持不变...
|
||||
// if (Settings->bTreatSplinesLikePins)
|
||||
// {
|
||||
// // [保持原有的碰撞检测逻辑不变]
|
||||
// // ... 这里是你原有的碰撞检测代码 ...
|
||||
// }
|
||||
//
|
||||
// // 绘制连线(这部分保持不变)
|
||||
// FSlateDrawElement::MakeDrawSpaceSpline(
|
||||
// DrawElementsList,
|
||||
// LayerId,
|
||||
// P0, P0Tangent,
|
||||
// P1, P1Tangent,
|
||||
// Params.WireThickness,
|
||||
// ESlateDrawEffect::None,
|
||||
// Params.WireColor
|
||||
// );
|
||||
//
|
||||
// // 修改中点的方向计算
|
||||
// if (Params.bDrawBubbles || (MidpointImage != nullptr))
|
||||
// {
|
||||
// // 重新参数化表计算(保持不变)
|
||||
// FInterpCurve<float> SplineReparamTable;
|
||||
// const float SplineLength = MakeSplineReparamTable(P0, P0Tangent, P1, P1Tangent, SplineReparamTable);
|
||||
//
|
||||
// // 气泡绘制逻辑(保持不变)
|
||||
// if (Params.bDrawBubbles)
|
||||
// {
|
||||
// // [保持原有的气泡绘制逻辑]
|
||||
// // ... 这里是你原有的气泡绘制代码 ...
|
||||
// }
|
||||
//
|
||||
// // 修改中点图标的旋转逻辑
|
||||
// if (MidpointImage != nullptr)
|
||||
// {
|
||||
// const float MidpointAlpha = SplineReparamTable.Eval(SplineLength * 0.5f, 0.f);
|
||||
// const FVector2D Midpoint = FMath::CubicInterp(P0, P0Tangent, P1, P1Tangent, MidpointAlpha);
|
||||
//
|
||||
// const FVector2D MidpointPlusE = FMath::CubicInterp(P0, P0Tangent, P1, P1Tangent, MidpointAlpha + KINDA_SMALL_NUMBER);
|
||||
// const FVector2D MidpointMinusE = FMath::CubicInterp(P0, P0Tangent, P1, P1Tangent, MidpointAlpha - KINDA_SMALL_NUMBER);
|
||||
// FVector2D SlopeUnnormalized = MidpointPlusE - MidpointMinusE;
|
||||
//
|
||||
// // 如果是垂直连线,调整角度计算
|
||||
// float AngleInRadians;
|
||||
// if (bIsVerticalConnection)
|
||||
// {
|
||||
// // 垂直连线:主要考虑Y轴方向
|
||||
// if (FMath::Abs(SlopeUnnormalized.Y) > FMath::Abs(SlopeUnnormalized.X))
|
||||
// {
|
||||
// // 主要垂直方向,旋转90度
|
||||
// AngleInRadians = FMath::Atan2(SlopeUnnormalized.Y, SlopeUnnormalized.X) + FMath::DegreesToRadians(90.0f);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// AngleInRadians = FMath::Atan2(SlopeUnnormalized.Y, SlopeUnnormalized.X);
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// AngleInRadians = SlopeUnnormalized.IsNearlyZero() ? 0.0f : FMath::Atan2(SlopeUnnormalized.Y, SlopeUnnormalized.X);
|
||||
// }
|
||||
//
|
||||
// const FVector2D MidpointDrawPos = Midpoint - MidpointRadius;
|
||||
//
|
||||
// FSlateDrawElement::MakeRotatedBox(
|
||||
// DrawElementsList,
|
||||
// LayerId,
|
||||
// FPaintGeometry(MidpointDrawPos, MidpointImage->ImageSize * ZoomFactor, ZoomFactor),
|
||||
// MidpointImage,
|
||||
// ESlateDrawEffect::None,
|
||||
// AngleInRadians,
|
||||
// TOptional<FVector2D>(),
|
||||
// FSlateDrawElement::RelativeToElement,
|
||||
// Params.WireColor
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
FVector2D FVerticalConnectionDrawingPolicy::ComputeSplineTangent(const FVector2D& Start, const FVector2D& End) const
|
||||
{
|
||||
// 修改为垂直方向:
|
||||
const FVector2D Delta = End - Start;
|
||||
|
||||
// 如果是主要垂直方向的连线,使用垂直切线
|
||||
if (FMath::Abs(Delta.Y) > FMath::Abs(Delta.X))
|
||||
{
|
||||
// 垂直连线:主要控制垂直曲线
|
||||
return FVector2D(0, FMath::Abs(Delta.Y) * 0.5f);
|
||||
}
|
||||
else
|
||||
{
|
||||
// 水平连线:保持原有逻辑
|
||||
return FVector2D(FMath::Abs(Delta.X) * 0.5f, 0);
|
||||
}
|
||||
}
|
||||
|
||||
FVector2D FVerticalConnectionDrawingPolicy::GetPinPos(const UEdGraphPin* Pin) const
|
||||
{
|
||||
// const FVector2D NodeSize = GetDesiredSize();
|
||||
// FVector2D NodePosition;
|
||||
// if (Pin->Direction == EGPD_Input)
|
||||
// {
|
||||
// // 输入引脚:位于节点顶部中央
|
||||
// NodePosition = FVector2D(NodeWidth * 0.5f, 0.0f);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// // 输出引脚:位于节点底部中央
|
||||
// NodePosition = FVector2D(NodeWidth * 0.5f, NodeHeight);
|
||||
// }
|
||||
//
|
||||
//
|
||||
// if (Pin->Direction == EGPD_Input)
|
||||
// {
|
||||
// // 输入引脚在顶部中央
|
||||
// return NodePosition + FVector2D(NodeSize.X * 0.5f, 0.0f);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// // 输出引脚在底部中央
|
||||
// return NodePosition + FVector2D(NodeSize.X * 0.5f, NodeSize.Y);
|
||||
// }
|
||||
return FVector2D();
|
||||
}
|
||||
|
||||
// FVector2D FVerticalConnectionDrawingPolicy::GetCorrectedPinPosition(const FVector2D& OriginalPosition, UEdGraphPin* Pin,
|
||||
// EEdGraphPinDirection Direction)
|
||||
// {
|
||||
// if (!Pin)
|
||||
// return OriginalPosition;
|
||||
//
|
||||
// // 获取引脚的视觉widget
|
||||
// TSharedPtr<SGraphPin> GraphPin = GetPinWidget(Pin);
|
||||
// if (!GraphPin.IsValid())
|
||||
// return OriginalPosition;
|
||||
//
|
||||
// // 计算引脚的真正中心点
|
||||
// FGeometry PinGeometry = GraphPin->GetCachedGeometry();
|
||||
// FVector2D PinCenter = PinGeometry.GetAbsolutePosition() + PinGeometry.GetAbsoluteSize() * 0.5f;
|
||||
//
|
||||
// // 转换为绘制空间坐标
|
||||
// return PinCenter;
|
||||
// }
|
||||
|
||||
void UDialogueGraphSchema::CreateDefaultNodesForGraph(UEdGraph& Graph) const
|
||||
{
|
||||
FGraphNodeCreator<UDialogueGraphNode_Root> NodeCreator(Graph);
|
||||
@ -81,4 +344,12 @@ const FPinConnectionResponse UDialogueGraphSchema::CanCreateConnection(const UEd
|
||||
return FPinConnectionResponse(CONNECT_RESPONSE_MAKE, TEXT(""));
|
||||
}
|
||||
|
||||
FConnectionDrawingPolicy* UDialogueGraphSchema::CreateConnectionDrawingPolicy(int32 InBackLayerID, int32 InFrontLayerID,
|
||||
float InZoomFactor, const FSlateRect& InClippingRect, FSlateWindowElementList& InDrawElements,
|
||||
class UEdGraph* InGraphObj) const
|
||||
{
|
||||
return new FVerticalConnectionDrawingPolicy(InBackLayerID, InFrontLayerID, InZoomFactor,
|
||||
InClippingRect, InDrawElements);
|
||||
}
|
||||
|
||||
#undef LOCTEXT_NAMESPACE
|
||||
|
||||
@ -10,8 +10,8 @@ UDialogueGraphNode_Base::UDialogueGraphNode_Base()
|
||||
|
||||
void UDialogueGraphNode_Base::AllocateDefaultPins()
|
||||
{
|
||||
DefaultInputPin = CreatePin(EGPD_Input, TEXT("PinCategory_Default"), TEXT("In"));
|
||||
CreatePin(EGPD_Output, TEXT("PinCategory_Default"), TEXT("Out"));
|
||||
DefaultInputPin = CreatePin(EGPD_Input, TEXT("PinCategory_Default"), TEXT(""));
|
||||
CreatePin(EGPD_Output, TEXT("PinCategory_Default"), TEXT(""));
|
||||
}
|
||||
|
||||
void UDialogueGraphNode_Base::SetPostion(FVector2D InPos)
|
||||
|
||||
@ -5,5 +5,5 @@
|
||||
|
||||
void UDialogueGraphNode_Root::AllocateDefaultPins()
|
||||
{
|
||||
CreatePin(EGPD_Output, TEXT("PinCategory_Default"), TEXT("In"));
|
||||
CreatePin(EGPD_Output, TEXT("PinCategory_Default"), TEXT(""));
|
||||
}
|
||||
|
||||
@ -25,36 +25,52 @@ TSharedRef<SWidget> SDialogueGraphNode::CreateNodeContentArea()
|
||||
.VAlign(VAlign_Fill)
|
||||
.Padding( FMargin(0,3) )
|
||||
[
|
||||
SNew(SHorizontalBox)
|
||||
+SHorizontalBox::Slot()
|
||||
.HAlign(HAlign_Left)
|
||||
.FillWidth(1.0f)
|
||||
SNew(SVerticalBox)
|
||||
+SVerticalBox::Slot()
|
||||
.HAlign(HAlign_Center)
|
||||
.FillHeight(1.0f)
|
||||
[
|
||||
// LEFT
|
||||
SAssignNew(LeftNodeBox, SVerticalBox)
|
||||
// LEFT to Top
|
||||
//SAssignNew(LeftNodeBox, SVerticalBox)
|
||||
SNew(SBox)
|
||||
.RenderTransformPivot(FVector2D(0.5f, 0.5f)) // 设置旋转中心点为中心
|
||||
.RenderTransform(FSlateRenderTransform(FQuat2D(FMath::DegreesToRadians(90.0f)))) // 旋转90度
|
||||
[
|
||||
SAssignNew(LeftNodeBox, SVerticalBox)
|
||||
]
|
||||
]
|
||||
+SHorizontalBox::Slot()
|
||||
.AutoWidth()
|
||||
+SVerticalBox::Slot()
|
||||
.AutoHeight()
|
||||
.HAlign(HAlign_Center)
|
||||
.Padding(10.0f, 5.0f)
|
||||
[
|
||||
SNew(SBorder)
|
||||
.BorderBackgroundColor(FSlateColor(FLinearColor::Gray))
|
||||
.Padding(10.0f)
|
||||
.Content()
|
||||
[
|
||||
SAssignNew(DialogueText, STextBlock)
|
||||
.MinDesiredWidth(260.0f)
|
||||
// SNew(SBorder)
|
||||
// .BorderBackgroundColor(FSlateColor(FLinearColor::Gray))
|
||||
// .Padding(10.0f)
|
||||
// .Content()
|
||||
// [
|
||||
// SAssignNew(DialogueText, STextBlock)
|
||||
// .MinDesiredWidth(260.0f)
|
||||
// .Text(this, &SDialogueGraphNode::GetDialogueText)
|
||||
// .WrapTextAt(250.0f)
|
||||
// ]
|
||||
SAssignNew(DialogueText, STextBlock)
|
||||
.AutoWrapText(true)
|
||||
.Text(this, &SDialogueGraphNode::GetDialogueText)
|
||||
.WrapTextAt(250.0f)
|
||||
]
|
||||
]
|
||||
+SHorizontalBox::Slot()
|
||||
.AutoWidth()
|
||||
.HAlign(HAlign_Right)
|
||||
+SVerticalBox::Slot()
|
||||
.FillHeight(1.0f)
|
||||
.HAlign(HAlign_Center)
|
||||
[
|
||||
// RIGHT
|
||||
SAssignNew(RightNodeBox, SVerticalBox)
|
||||
// RIGHT to Bottom
|
||||
//SAssignNew(RightNodeBox, SVerticalBox)
|
||||
SNew(SBox)
|
||||
.RenderTransformPivot(FVector2D(0.5f, 0.5f)) // 设置旋转中心点为中心
|
||||
.RenderTransform(FSlateRenderTransform(FQuat2D(FMath::DegreesToRadians(90.0f)))) // 旋转90度
|
||||
[
|
||||
SAssignNew(RightNodeBox, SVerticalBox)
|
||||
]
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
@ -0,0 +1,50 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
|
||||
#include "Widget/GraphNodeWidget_Root.h"
|
||||
|
||||
|
||||
void SGraphNodeWidget_Root::Construct(const FArguments& InArgs, UDialogueGraphNode_Base* InNode)
|
||||
{
|
||||
GraphNode = InNode;
|
||||
UpdateGraphNode();
|
||||
}
|
||||
|
||||
TSharedRef<SWidget> SGraphNodeWidget_Root::CreateNodeContentArea()
|
||||
{
|
||||
// NODE CONTENT AREA
|
||||
return SNew(SBorder)
|
||||
.BorderImage( FAppStyle::GetBrush("NoBorder") )
|
||||
.HAlign(HAlign_Fill)
|
||||
.VAlign(VAlign_Fill)
|
||||
.Padding( FMargin(0,3) )
|
||||
[
|
||||
SNew(SVerticalBox)
|
||||
+SVerticalBox::Slot()
|
||||
.HAlign(HAlign_Center)
|
||||
.FillHeight(1.0f)
|
||||
[
|
||||
// LEFT to Top
|
||||
//SAssignNew(LeftNodeBox, SVerticalBox)
|
||||
SNew(SBox)
|
||||
.RenderTransformPivot(FVector2D(0.5f, 0.5f)) // 设置旋转中心点为中心
|
||||
.RenderTransform(FSlateRenderTransform(FQuat2D(FMath::DegreesToRadians(90.0f)))) // 旋转90度
|
||||
[
|
||||
SAssignNew(LeftNodeBox, SVerticalBox)
|
||||
]
|
||||
]
|
||||
+SVerticalBox::Slot()
|
||||
.FillHeight(1.0f)
|
||||
.HAlign(HAlign_Center)
|
||||
[
|
||||
// RIGHT to Bottom
|
||||
//SAssignNew(RightNodeBox, SVerticalBox)
|
||||
SNew(SBox)
|
||||
.RenderTransformPivot(FVector2D(0.5f, 0.5f)) // 设置旋转中心点为中心
|
||||
.RenderTransform(FSlateRenderTransform(FQuat2D(FMath::DegreesToRadians(90.0f)))) // 旋转90度
|
||||
[
|
||||
SAssignNew(RightNodeBox, SVerticalBox)
|
||||
]
|
||||
]
|
||||
];
|
||||
}
|
||||
@ -3,9 +3,11 @@
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "ConnectionDrawingPolicy.h"
|
||||
#include "EdGraph/EdGraphSchema.h"
|
||||
#include "DialogueGraphSchema.generated.h"
|
||||
|
||||
struct FConnectionParams;
|
||||
/**
|
||||
* 创建节点的Action
|
||||
*/
|
||||
@ -26,6 +28,18 @@ protected:
|
||||
UClass* ClassTemplate = nullptr;
|
||||
};
|
||||
|
||||
//自定义连线绘制方式
|
||||
class FVerticalConnectionDrawingPolicy : public FConnectionDrawingPolicy
|
||||
{
|
||||
public:
|
||||
FVerticalConnectionDrawingPolicy(int32 InBackLayerID, int32 InFrontLayerID, float InZoomFactor, const FSlateRect& InClippingRect, FSlateWindowElementList& InDrawElements);
|
||||
virtual void DrawSplineWithArrow(const FVector2D& StartPoint, const FVector2D& EndPoint, const FConnectionParams& Params) override;
|
||||
virtual void DrawSplineWithArrow(const FGeometry& StartGeom, const FGeometry& EndGeom, const FConnectionParams& Params) override;
|
||||
//virtual void DrawConnection(int32 LayerId, const FVector2D& Start, const FVector2D& End, const FConnectionParams& Params) override;
|
||||
virtual FVector2D ComputeSplineTangent(const FVector2D& Start, const FVector2D& End) const override;
|
||||
//virtual FVector2D GetCorrectedPinPosition(const FVector2D& OriginalPosition, UEdGraphPin* Pin, EEdGraphPinDirection Direction);
|
||||
virtual FVector2D GetPinPos(const UEdGraphPin* Pin) const;
|
||||
};
|
||||
/**
|
||||
* 对话图表规则
|
||||
*/
|
||||
@ -42,4 +56,6 @@ public:
|
||||
|
||||
// 连接规则
|
||||
virtual const FPinConnectionResponse CanCreateConnection(const UEdGraphPin* A, const UEdGraphPin* B) const override;
|
||||
//修改连线的绘制方式
|
||||
virtual FConnectionDrawingPolicy* CreateConnectionDrawingPolicy(int32 InBackLayerID, int32 InFrontLayerID, float InZoomFactor, const FSlateRect& InClippingRect, FSlateWindowElementList& InDrawElements, class UEdGraph* InGraphObj) const override;
|
||||
};
|
||||
|
||||
@ -0,0 +1,22 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "SGraphNode.h"
|
||||
#include "Node/DialogueGraphNode_Base.h"
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class DIALOGUEEDITOR_API SGraphNodeWidget_Root: public SGraphNode
|
||||
{
|
||||
public:
|
||||
SLATE_BEGIN_ARGS(SGraphNodeWidget_Root)
|
||||
{}
|
||||
SLATE_END_ARGS()
|
||||
|
||||
void Construct(const FArguments& InArgs, UDialogueGraphNode_Base* InNode);
|
||||
/** SGraphNode Interface */
|
||||
virtual TSharedRef<SWidget> CreateNodeContentArea() override;
|
||||
};
|
||||
Loading…
x
Reference in New Issue
Block a user