Files
UnrealEngineUWP/Engine/Source/Editor/AnimationBlueprintEditor/Private/AnimationNodes/SGraphNodeStateMachineInstance.cpp
lucas dower 591fc0ed86 Pose watch widget now shows on Blend Space and State Machine nodes
#jira UE-106437, UE-106437
#rb Thomas.Sarkanen
#preflight 61a0bf1ec3287aab27415d7e

#ROBOMERGE-AUTHOR: lucas.dower
#ROBOMERGE-SOURCE: CL 18299107 in //UE5/Release-5.0/... via CL 18299120
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v895-18170469)

[CL 18299122 by lucas dower in ue5-release-engine-test branch]
2021-11-26 06:39:57 -05:00

53 lines
1.5 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#include "AnimationNodes/SGraphNodeStateMachineInstance.h"
#include "AnimationStateMachineGraph.h"
#include "AnimGraphNode_StateMachineBase.h"
#include "Engine/PoseWatch.h"
#include "AnimationEditorUtils.h"
#include "Widgets/Input/SButton.h"
#include "Widgets/Images/SImage.h"
#include "SPoseWatchOverlay.h"
#define LOCTEXT_NAMESPACE "SGraphNodeStateMachineInstance"
/////////////////////////////////////////////////////
// SGraphNodeStateMachineInstance
void SGraphNodeStateMachineInstance::Construct(const FArguments& InArgs, UAnimGraphNode_StateMachineBase* InNode)
{
GraphNode = InNode;
SetCursor(EMouseCursor::CardinalCross);
PoseWatchWidget = SNew(SPoseWatchOverlay, InNode);
UpdateGraphNode();
}
UEdGraph* SGraphNodeStateMachineInstance::GetInnerGraph() const
{
UAnimGraphNode_StateMachineBase* StateMachineInstance = CastChecked<UAnimGraphNode_StateMachineBase>(GraphNode);
return StateMachineInstance->EditorStateMachineGraph;
}
TArray<FOverlayWidgetInfo> SGraphNodeStateMachineInstance::GetOverlayWidgets(bool bSelected, const FVector2D& WidgetSize) const
{
TArray<FOverlayWidgetInfo> Widgets;
if (UAnimGraphNode_Base* AnimNode = CastChecked<UAnimGraphNode_Base>(GraphNode, ECastCheckedType::NullAllowed))
{
if (PoseWatchWidget->IsPoseWatchValid())
{
FOverlayWidgetInfo Info;
Info.OverlayOffset = PoseWatchWidget->GetOverlayOffset();
Info.Widget = PoseWatchWidget;
Widgets.Add(Info);
}
}
return Widgets;
}
#undef LOCTEXT_NAMESPACE