59 static constexpr int32 NodeIndex = 0;
60 static constexpr int32 NumberOfEdges = 1;
65 const TSharedRef<SNode>* pPrevNodeWidget = NodeToWidgetLookup.Find(ParentNode);
66 const TSharedRef<SNode>* pNextNodeWidget = NodeToWidgetLookup.Find(ChildNode);
67 if (pPrevNodeWidget !=
nullptr && pNextNodeWidget !=
nullptr)
69 const TSharedRef<SNode>& PrevNodeWidget = *pPrevNodeWidget;
70 const TSharedRef<SNode>& NextNodeWidget = *pNextNodeWidget;
72 StartGeom = FGeometry(FVector2D(ParentNode->NodePosX, ParentNode->NodePosY), FVector2D::ZeroVector, PrevNodeWidget->GetDesiredSize(), 1.0f);
73 EndGeom = FGeometry(FVector2D(ChildNode->NodePosX, ChildNode->NodePosY), FVector2D::ZeroVector, NextNodeWidget->GetDesiredSize(), 1.0f);
119 constexpr int WidthOverride = 16;
120 constexpr int HeightOverride = 16;
126 .WidthOverride(WidthOverride)
127 .HeightOverride(HeightOverride)
138 if (!SWidget::GetToolTip().IsValid())
140 const TSharedRef<SToolTip> DefaultToolTip = IDocumentation::Get()->CreateToolTip(TAttribute<FText>(
this, &Super::GetNodeTooltip),
nullptr,
141 GraphNode->GetDocumentationLink(), GraphNode->GetDocumentationExcerptName());
142 SetToolTip(DefaultToolTip);
145 ContentScale.Bind(
this, &Super::GetContentScale);
146 GetOrAddSlot(ENodeZone::Center)
147 .HAlign(HAlign_Center)
148 .VAlign(VAlign_Center)
152#if ENGINE_MINOR_VERSION >= 24
157 .Image(FEditorStyle::GetBrush(
"Graph.TransitionNode.ColorSpill"))
163 .Image(FEditorStyle::GetBrush(
"Graph.TransitionNode.Icon"))
169 .Image(FEditorStyle::GetBrush(
"Graph.TransitionNode.Body"))
174 .Image(FEditorStyle::GetBrush(
"Graph.TransitionNode.ColorSpill"))
180 .Image(FEditorStyle::GetBrush(
"Graph.TransitionNode.Icon"))
185 .Image(FEditorStyle::GetBrush(
"Graph.TransitionNode.Gloss"))
197 check(NodeIndex >= 0);
201 const FVector2D StartCenter = FGeometryHelper::CenterOf(StartGeom);
202 const FVector2D EndCenter = FGeometryHelper::CenterOf(EndGeom);
203 const FVector2D SeedPoint = (StartCenter + EndCenter) / 2.0f;
206 const FVector2D StartAnchorPoint = FGeometryHelper::FindClosestPointOnGeom(StartGeom, SeedPoint);
207 const FVector2D EndAnchorPoint = FGeometryHelper::FindClosestPointOnGeom(EndGeom, SeedPoint);
210 static constexpr float Height = 30.0f;
211 const FVector2D DesiredNodeSize = GetDesiredSize();
213 FVector2D DeltaPos(EndAnchorPoint - StartAnchorPoint);
214 if (DeltaPos.IsNearlyZero())
216 DeltaPos = FVector2D(10.0f, 0.0f);
219 const FVector2D Normal = FVector2D(DeltaPos.Y, -DeltaPos.X).GetSafeNormal();
220 const FVector2D NewCenter = StartAnchorPoint + (0.5f * DeltaPos) + (Height * Normal);
221 const FVector2D DeltaNormal = DeltaPos.GetSafeNormal();
227 static constexpr float MultiNodeSpace = 0.2f;
228 static constexpr float MultiNodeStep = 1.f + MultiNodeSpace;
230 const float MultiNodeStart = -((MaxNodes - 1) * MultiNodeStep) / 2.f;
231 const float MultiNodeOffset = MultiNodeStart + (NodeIndex * MultiNodeStep);
234 const FVector2D NewCorner = NewCenter - (0.5f * DesiredNodeSize) + (DeltaNormal * MultiNodeOffset * DesiredNodeSize.Size());
236 GraphNode->NodePosX = NewCorner.X;
237 GraphNode->NodePosY = NewCorner.Y;