Skip to content

Commit 223d190

Browse files
committed
Addressed UE 5.6 deprecations
1 parent e6d5b9e commit 223d190

File tree

5 files changed

+62
-18
lines changed

5 files changed

+62
-18
lines changed

Source/FlowEditor/Private/Asset/FlowObjectDiff.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,19 @@ void FFlowObjectDiff::InitializeDetailsDiffFromNode(UEdGraphNode* Node, const UO
5151

5252
if (NodeDiffType == ENodeDiffType::Old && !OldDetailsView.IsValid())
5353
{
54+
#if ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION < 6
5455
OldDetailsView = MakeShared<FDetailsDiff>(Object, FOnDisplayedPropertiesChanged());
56+
#else
57+
OldDetailsView = MakeShared<FDetailsDiff>(Object);
58+
#endif
5559
}
5660
else if (NodeDiffType == ENodeDiffType::New && !NewDetailsView.IsValid())
5761
{
62+
#if ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION < 6
5863
NewDetailsView = MakeShared<FDetailsDiff>(Object, FOnDisplayedPropertiesChanged());
64+
#else
65+
NewDetailsView = MakeShared<FDetailsDiff>(Object);
66+
#endif
5967
}
6068
}
6169

Source/FlowEditor/Private/Graph/FlowGraphConnectionDrawingPolicy.cpp

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -112,15 +112,25 @@ void FFlowGraphConnectionDrawingPolicy::BuildPaths()
112112
}
113113
}
114114

115+
#if ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION < 6
115116
void FFlowGraphConnectionDrawingPolicy::DrawConnection(int32 LayerId, const FVector2D& Start, const FVector2D& End, const FConnectionParams& Params)
117+
#else
118+
void FFlowGraphConnectionDrawingPolicy::DrawConnection(int32 LayerId, const FVector2f& Start, const FVector2f& End, const FConnectionParams& Params)
119+
#endif
116120
{
117121
switch (UFlowGraphSettings::Get()->ConnectionDrawType)
118122
{
119123
case EFlowConnectionDrawType::Default:
120124
FConnectionDrawingPolicy::DrawConnection(LayerId, Start, End, Params);
121125
break;
122126
case EFlowConnectionDrawType::Circuit:
127+
#if ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION < 6
128+
const FVector2f& P0 = Start;
129+
const FVector2f& P1 = End;
130+
DrawCircuitSpline(LayerId, P0, P1, Params);
131+
#else
123132
DrawCircuitSpline(LayerId, Start, End, Params);
133+
#endif
124134
break;
125135
default: ;
126136
}
@@ -219,22 +229,22 @@ void FFlowGraphConnectionDrawingPolicy::Draw(TMap<TSharedRef<SWidget>, FArranged
219229
FConnectionDrawingPolicy::Draw(InPinGeometries, ArrangedNodes);
220230
}
221231

222-
void FFlowGraphConnectionDrawingPolicy::DrawCircuitSpline(const int32& LayerId, const FVector2D& Start, const FVector2D& End, const FConnectionParams& Params) const
232+
void FFlowGraphConnectionDrawingPolicy::DrawCircuitSpline(const int32& LayerId, const FVector2f& Start, const FVector2f& End, const FConnectionParams& Params) const
223233
{
224-
const FVector2D StartingPoint = FVector2D(Start.X + UFlowGraphSettings::Get()->CircuitConnectionSpacing.X, Start.Y);
225-
const FVector2D EndPoint = FVector2D(End.X - UFlowGraphSettings::Get()->CircuitConnectionSpacing.Y, End.Y);
226-
const FVector2D ControlPoint = GetControlPoint(StartingPoint, EndPoint);
234+
const FVector2f StartingPoint = FVector2f(Start.X + UFlowGraphSettings::Get()->CircuitConnectionSpacing.X, Start.Y);
235+
const FVector2f EndPoint = FVector2f(End.X - UFlowGraphSettings::Get()->CircuitConnectionSpacing.Y, End.Y);
236+
const FVector2f ControlPoint = GetControlPoint(StartingPoint, EndPoint);
227237

228-
const FVector2D StartDirection = (Params.StartDirection == EGPD_Output) ? FVector2D(1.0f, 0.0f) : FVector2D(-1.0f, 0.0f);
229-
const FVector2D EndDirection = (Params.EndDirection == EGPD_Input) ? FVector2D(1.0f, 0.0f) : FVector2D(-1.0f, 0.0f);
238+
const FVector2f StartDirection = (Params.StartDirection == EGPD_Output) ? FVector2f(1.0f, 0.0f) : FVector2f(-1.0f, 0.0f);
239+
const FVector2f EndDirection = (Params.EndDirection == EGPD_Input) ? FVector2f(1.0f, 0.0f) : FVector2f(-1.0f, 0.0f);
230240

231241
DrawCircuitConnection(LayerId, Start, StartDirection, StartingPoint, EndDirection, Params);
232242
DrawCircuitConnection(LayerId, StartingPoint, StartDirection, ControlPoint, EndDirection, Params);
233243
DrawCircuitConnection(LayerId, ControlPoint, StartDirection, EndPoint, EndDirection, Params);
234244
DrawCircuitConnection(LayerId, EndPoint, StartDirection, End, EndDirection, Params);
235245
}
236246

237-
void FFlowGraphConnectionDrawingPolicy::DrawCircuitConnection(const int32& LayerId, const FVector2D& Start, const FVector2D& StartDirection, const FVector2D& End, const FVector2D& EndDirection, const FConnectionParams& Params) const
247+
void FFlowGraphConnectionDrawingPolicy::DrawCircuitConnection(const int32& LayerId, const FVector2f& Start, const FVector2f& StartDirection, const FVector2f& End, const FVector2f& EndDirection, const FConnectionParams& Params) const
238248
{
239249
FSlateDrawElement::MakeDrawSpaceSpline(DrawElementsList, LayerId, Start, StartDirection, End, EndDirection, Params.WireThickness, ESlateDrawEffect::None, Params.WireColor);
240250

@@ -249,7 +259,7 @@ void FFlowGraphConnectionDrawingPolicy::DrawCircuitConnection(const int32& Layer
249259
{
250260
const float BubbleSpacing = 64.f * ZoomFactor;
251261
const float BubbleSpeed = 192.f * ZoomFactor;
252-
const FVector2D BubbleSize = BubbleImage->ImageSize * ZoomFactor * 0.2f * Params.WireThickness;
262+
const FVector2f BubbleSize = BubbleImage->ImageSize * ZoomFactor * 0.2f * Params.WireThickness;
253263

254264
const float Time = (FPlatformTime::Seconds() - GStartTime);
255265
const float BubbleOffset = FMath::Fmod(Time * BubbleSpeed, BubbleSpacing);
@@ -260,7 +270,7 @@ void FFlowGraphConnectionDrawingPolicy::DrawCircuitConnection(const int32& Layer
260270
if (Distance < SplineLength)
261271
{
262272
const float Alpha = SplineReparamTable.Eval(Distance, 0.f);
263-
FVector2D BubblePos = FMath::CubicInterp(Start, StartDirection, End, EndDirection, Alpha);
273+
FVector2f BubblePos = FMath::CubicInterp(Start, StartDirection, End, EndDirection, Alpha);
264274
BubblePos -= (BubbleSize * 0.5f);
265275

266276
FSlateDrawElement::MakeBox(DrawElementsList, LayerId, FPaintGeometry(BubblePos, BubbleSize, ZoomFactor), BubbleImage, ESlateDrawEffect::None, Params.WireColor);
@@ -270,9 +280,9 @@ void FFlowGraphConnectionDrawingPolicy::DrawCircuitConnection(const int32& Layer
270280
}
271281
}
272282

273-
FVector2D FFlowGraphConnectionDrawingPolicy::GetControlPoint(const FVector2D& Source, const FVector2D& Target)
283+
FVector2f FFlowGraphConnectionDrawingPolicy::GetControlPoint(const FVector2f& Source, const FVector2f& Target)
274284
{
275-
const FVector2D Delta = Target - Source;
285+
const FVector2f Delta = Target - Source;
276286
const float Tangent = FMath::Tan(UFlowGraphSettings::Get()->CircuitConnectionAngle * (PI / 180.f));
277287

278288
const float DeltaX = FMath::Abs(Delta.X);
@@ -281,24 +291,24 @@ FVector2D FFlowGraphConnectionDrawingPolicy::GetControlPoint(const FVector2D& So
281291
const float SlopeWidth = DeltaY / Tangent;
282292
if (DeltaX > SlopeWidth)
283293
{
284-
return Delta.X > 0.f ? FVector2D(Target.X - SlopeWidth, Source.Y) : FVector2D(Source.X - SlopeWidth, Target.Y);
294+
return Delta.X > 0.f ? FVector2f(Target.X - SlopeWidth, Source.Y) : FVector2f(Source.X - SlopeWidth, Target.Y);
285295
}
286296

287297
const float SlopeHeight = DeltaX * Tangent;
288298
if (DeltaY > SlopeHeight)
289299
{
290300
if (Delta.Y > 0.f)
291301
{
292-
return Delta.X < 0.f ? FVector2D(Source.X, Target.Y - SlopeHeight) : FVector2D(Target.X, Source.Y + SlopeHeight);
302+
return Delta.X < 0.f ? FVector2f(Source.X, Target.Y - SlopeHeight) : FVector2f(Target.X, Source.Y + SlopeHeight);
293303
}
294304

295305
if (Delta.X < 0.f)
296306
{
297-
return FVector2D(Source.X, Target.Y + SlopeHeight);
307+
return FVector2f(Source.X, Target.Y + SlopeHeight);
298308
}
299309
}
300310

301-
return FVector2D(Target.X, Source.Y - SlopeHeight);
311+
return FVector2f(Target.X, Source.Y - SlopeHeight);
302312
}
303313

304314
bool FFlowGraphConnectionDrawingPolicy::ShouldChangeTangentForReroute(UFlowGraphNode_Reroute* Reroute)

Source/FlowEditor/Private/Graph/FlowGraphEditor.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,11 @@ void SFlowGraphEditor::Construct(const FArguments& InArgs, const TSharedPtr<FFlo
4646
Arguments._GraphEvents.OnSelectionChanged = FOnSelectionChanged::CreateSP(this, &SFlowGraphEditor::OnSelectedNodesChanged);
4747
Arguments._GraphEvents.OnNodeDoubleClicked = FSingleNodeEvent::CreateSP(this, &SFlowGraphEditor::OnNodeDoubleClicked);
4848
Arguments._GraphEvents.OnTextCommitted = FOnNodeTextCommitted::CreateSP(this, &SFlowGraphEditor::OnNodeTitleCommitted);
49+
#if ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION < 6
4950
Arguments._GraphEvents.OnSpawnNodeByShortcut = FOnSpawnNodeByShortcut::CreateStatic(&SFlowGraphEditor::OnSpawnGraphNodeByShortcut, static_cast<UEdGraph*>(FlowAsset->GetGraph()));
51+
#else
52+
Arguments._GraphEvents.OnSpawnNodeByShortcutAtLocation = FOnSpawnNodeByShortcutAtLocation::CreateStatic(&SFlowGraphEditor::OnSpawnGraphNodeByShortcut, static_cast<UEdGraph*>(FlowAsset->GetGraph()));
53+
#endif
5054

5155
SGraphEditor::Construct(Arguments);
5256
}
@@ -286,7 +290,11 @@ void SFlowGraphEditor::RedoGraphAction()
286290
GEditor->RedoTransaction();
287291
}
288292

293+
#if ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION < 6
289294
FReply SFlowGraphEditor::OnSpawnGraphNodeByShortcut(FInputChord InChord, const FVector2D& InPosition, UEdGraph* InGraph)
295+
#else
296+
FReply SFlowGraphEditor::OnSpawnGraphNodeByShortcut(FInputChord InChord, const FVector2f& InPosition, UEdGraph* InGraph)
297+
#endif
290298
{
291299
UEdGraph* Graph = InGraph;
292300

@@ -296,6 +304,7 @@ FReply SFlowGraphEditor::OnSpawnGraphNodeByShortcut(FInputChord InChord, const F
296304
if (Action.IsValid())
297305
{
298306
TArray<UEdGraphPin*> DummyPins;
307+
299308
Action->PerformAction(Graph, DummyPins, InPosition);
300309
return FReply::Handled();
301310
}
@@ -307,7 +316,11 @@ FReply SFlowGraphEditor::OnSpawnGraphNodeByShortcut(FInputChord InChord, const F
307316
void SFlowGraphEditor::OnCreateComment() const
308317
{
309318
FFlowGraphSchemaAction_NewComment CommentAction;
319+
#if ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION < 6
310320
CommentAction.PerformAction(FlowAsset->GetGraph(), nullptr, GetPasteLocation());
321+
#else
322+
CommentAction.PerformAction(FlowAsset->GetGraph(), nullptr, GetPasteLocation2f());
323+
#endif
311324
}
312325

313326
bool SFlowGraphEditor::IsTabFocused() const
@@ -657,7 +670,11 @@ bool SFlowGraphEditor::CanCopyNodes() const
657670

658671
void SFlowGraphEditor::PasteNodes()
659672
{
673+
#if ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION < 6
660674
PasteNodesHere(GetPasteLocation());
675+
#else
676+
PasteNodesHere(GetPasteLocation2f());
677+
#endif
661678
}
662679

663680
void SFlowGraphEditor::PasteNodesHere(const FVector2D& Location)

Source/FlowEditor/Public/Graph/FlowGraphConnectionDrawingPolicy.h

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,19 @@ class FLOWEDITOR_API FFlowGraphConnectionDrawingPolicy : public FConnectionDrawi
5454
void BuildPaths();
5555

5656
// FConnectionDrawingPolicy interface
57+
#if ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION < 6
5758
virtual void DrawConnection(int32 LayerId, const FVector2D& Start, const FVector2D& End, const FConnectionParams& Params) override;
59+
#else
60+
virtual void DrawConnection(int32 LayerId, const FVector2f& Start, const FVector2f& End, const FConnectionParams& Params);
61+
#endif
5862
virtual void DetermineWiringStyle(UEdGraphPin* OutputPin, UEdGraphPin* InputPin, FConnectionParams& Params) override;
5963
virtual void Draw(TMap<TSharedRef<SWidget>, FArrangedWidget>& PinGeometries, FArrangedChildren& ArrangedNodes) override;
6064
// End of FConnectionDrawingPolicy interface
6165

6266
protected:
63-
void DrawCircuitSpline(const int32& LayerId, const FVector2D& Start, const FVector2D& End, const FConnectionParams& Params) const;
64-
void DrawCircuitConnection(const int32& LayerId, const FVector2D& Start, const FVector2D& StartDirection, const FVector2D& End, const FVector2D& EndDirection, const FConnectionParams& Params) const;
65-
static FVector2D GetControlPoint(const FVector2D& Source, const FVector2D& Target);
67+
void DrawCircuitSpline(const int32& LayerId, const FVector2f& Start, const FVector2f& End, const FConnectionParams& Params) const;
68+
void DrawCircuitConnection(const int32& LayerId, const FVector2f& Start, const FVector2f& StartDirection, const FVector2f& End, const FVector2f& EndDirection, const FConnectionParams& Params) const;
69+
static FVector2f GetControlPoint(const FVector2f& Source, const FVector2f& Target);
6670

6771
bool ShouldChangeTangentForReroute(class UFlowGraphNode_Reroute* Reroute);
6872
bool FindPinCenter(const UEdGraphPin* Pin, FVector2D& OutCenter) const;

Source/FlowEditor/Public/Graph/FlowGraphEditor.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,12 @@ class FLOWEDITOR_API SFlowGraphEditor : public SGraphEditor
4646
static void UndoGraphAction();
4747
static void RedoGraphAction();
4848

49+
#if ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION < 6
4950
static FReply OnSpawnGraphNodeByShortcut(FInputChord InChord, const FVector2D& InPosition, UEdGraph* InGraph);
51+
#else
52+
static FReply OnSpawnGraphNodeByShortcut(FInputChord InChord, const FVector2f& InPosition, UEdGraph* InGraph);
53+
#endif
54+
5055
void OnCreateComment() const;
5156

5257
public:

0 commit comments

Comments
 (0)