Files
UnrealEngineUWP/Engine/Source/Editor/AnimGraph/Private/AnimationStateGraphSchema.cpp
Matthew Griffin bb70b349ce Merging CL 2804086 from //UE4/Release-4.11 to Dev-Main (//UE4/Dev-Main) to isolate copyright update
#lockdown Nick.Penwarden

[CL 2819020 by Matthew Griffin in Main branch]
2016-01-07 08:17:16 -05:00

48 lines
1.6 KiB
C++

// Copyright 1998-2016 Epic Games, Inc. All Rights Reserved.
#include "AnimGraphPrivatePCH.h"
#include "BlueprintUtilities.h"
#include "GraphEditorActions.h"
#include "ScopedTransaction.h"
#include "AssetData.h"
#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