Files
UnrealEngineUWP/Engine/Source/Editor/AnimGraph/Private/AnimationStateGraphSchema.cpp
Thomas Sarkanen 8ba3c4c087 Merging //UE4/Dev-Main to Dev-Anim (//UE4/Dev-Anim) @ CL 4643671
#rb none
#jira none

[CL 4665410 by Thomas Sarkanen in Dev-Anim branch]
2018-12-17 06:31:16 -05:00

43 lines
1.4 KiB
C++

// Copyright 1998-2019 Epic Games, Inc. All Rights Reserved.
#include "AnimationStateGraphSchema.h"
#include "AnimationStateGraph.h"
#include "AnimStateNode.h"
#include "AnimGraphNode_StateResult.h"
#define LOCTEXT_NAMESPACE "AnimationStateGraphSchema"
/////////////////////////////////////////////////////
// UAnimationStateGraphSchema
UAnimationStateGraphSchema::UAnimationStateGraphSchema(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
{
}
void UAnimationStateGraphSchema::CreateDefaultNodesForGraph(UEdGraph& Graph) const
{
// Create the result Create
FGraphNodeCreator<UAnimGraphNode_StateResult> NodeCreator(Graph);
UAnimGraphNode_StateResult* ResultSinkNode = NodeCreator.CreateNode();
NodeCreator.Finalize();
SetNodeMetaData(ResultSinkNode, FNodeMetadata::DefaultGraphNode);
UAnimationStateGraph* TypedGraph = CastChecked<UAnimationStateGraph>(&Graph);
TypedGraph->MyResultNode = ResultSinkNode;
}
void UAnimationStateGraphSchema::GetGraphDisplayInformation(const UEdGraph& Graph, /*out*/ FGraphDisplayInfo& DisplayInfo) const
{
DisplayInfo.PlainName = FText::FromString( Graph.GetName() );
if (const UAnimStateNode* StateNode = Cast<const UAnimStateNode>(Graph.GetOuter()))
{
DisplayInfo.PlainName = FText::Format( LOCTEXT("StateNameGraphTitle", "{0} (state)"), FText::FromString( StateNode->GetStateName() ) );
}
DisplayInfo.DisplayName = DisplayInfo.PlainName;
}
#undef LOCTEXT_NAMESPACE