2016-01-07 08:17:16 -05:00
|
|
|
// Copyright 1998-2016 Epic Games, Inc. All Rights Reserved.
|
2014-03-14 14:13:41 -04:00
|
|
|
|
|
|
|
|
#include "AnimGraphPrivatePCH.h"
|
2014-04-24 08:49:31 -04:00
|
|
|
#include "AnimationCustomTransitionSchema.h"
|
|
|
|
|
#include "AnimGraphNode_CustomTransitionResult.h"
|
|
|
|
|
#include "AnimGraphNode_TransitionPoseEvaluator.h"
|
|
|
|
|
#include "AnimStateTransitionNode.h"
|
2014-04-24 14:34:01 -04:00
|
|
|
#include "AnimationCustomTransitionGraph.h"
|
2014-03-14 14:13:41 -04:00
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////
|
|
|
|
|
// UAnimationCustomTransitionSchema
|
|
|
|
|
|
2014-10-14 10:29:11 -04:00
|
|
|
UAnimationCustomTransitionSchema::UAnimationCustomTransitionSchema(const FObjectInitializer& ObjectInitializer)
|
|
|
|
|
: Super(ObjectInitializer)
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void UAnimationCustomTransitionSchema::CreateDefaultNodesForGraph(UEdGraph& Graph) const
|
|
|
|
|
{
|
|
|
|
|
// Create the result node
|
|
|
|
|
FGraphNodeCreator<UAnimGraphNode_CustomTransitionResult> ResultNodeCreator(Graph);
|
|
|
|
|
UAnimGraphNode_CustomTransitionResult* ResultSinkNode = ResultNodeCreator.CreateNode();
|
|
|
|
|
ResultSinkNode->NodePosX = 0;
|
|
|
|
|
ResultSinkNode->NodePosY = 0;
|
|
|
|
|
ResultNodeCreator.Finalize();
|
2014-09-12 18:37:04 -04:00
|
|
|
SetNodeMetaData(ResultSinkNode, FNodeMetadata::DefaultGraphNode);
|
2014-03-14 14:13:41 -04:00
|
|
|
|
|
|
|
|
UAnimationCustomTransitionGraph* TypedGraph = CastChecked<UAnimationCustomTransitionGraph>(&Graph);
|
|
|
|
|
TypedGraph->MyResultNode = ResultSinkNode;
|
|
|
|
|
|
|
|
|
|
// Create the source and destination input states
|
|
|
|
|
{
|
|
|
|
|
FGraphNodeCreator<UAnimGraphNode_TransitionPoseEvaluator> SourceNodeCreator(Graph);
|
|
|
|
|
UAnimGraphNode_TransitionPoseEvaluator* SourcePoseNode = SourceNodeCreator.CreateNode();
|
|
|
|
|
SourcePoseNode->Node.DataSource = EEvaluatorDataSource::EDS_SourcePose;
|
|
|
|
|
SourcePoseNode->NodePosX = -300;
|
|
|
|
|
SourcePoseNode->NodePosY = -150;
|
|
|
|
|
SourceNodeCreator.Finalize();
|
2014-09-12 18:37:04 -04:00
|
|
|
SetNodeMetaData(SourcePoseNode, FNodeMetadata::DefaultGraphNode);
|
2014-03-14 14:13:41 -04:00
|
|
|
|
|
|
|
|
}
|
|
|
|
|
{
|
|
|
|
|
FGraphNodeCreator<UAnimGraphNode_TransitionPoseEvaluator> DestinationNodeCreator(Graph);
|
|
|
|
|
UAnimGraphNode_TransitionPoseEvaluator* DestinationPoseNode = DestinationNodeCreator.CreateNode();
|
|
|
|
|
DestinationPoseNode->Node.DataSource = EEvaluatorDataSource::EDS_DestinationPose;
|
|
|
|
|
DestinationPoseNode->NodePosX = -300;
|
|
|
|
|
DestinationPoseNode->NodePosY = 150;
|
|
|
|
|
DestinationNodeCreator.Finalize();
|
2014-09-12 18:37:04 -04:00
|
|
|
SetNodeMetaData(DestinationPoseNode, FNodeMetadata::DefaultGraphNode);
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void UAnimationCustomTransitionSchema::GetGraphDisplayInformation(const UEdGraph& Graph, /*out*/ FGraphDisplayInfo& DisplayInfo) const
|
|
|
|
|
{
|
2014-04-23 18:30:37 -04:00
|
|
|
DisplayInfo.PlainName = FText::FromString( Graph.GetName() );
|
2014-03-14 14:13:41 -04:00
|
|
|
|
|
|
|
|
if (const UAnimStateTransitionNode* TransNode = Cast<const UAnimStateTransitionNode>(Graph.GetOuter()))
|
|
|
|
|
{
|
2014-04-23 18:30:37 -04:00
|
|
|
DisplayInfo.PlainName = FText::Format( NSLOCTEXT("Animation", "CustomBlendGraphTitle", "{0} (custom blend)"), TransNode->GetNodeTitle(ENodeTitleType::FullTitle) );
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
2014-04-23 18:30:37 -04:00
|
|
|
|
|
|
|
|
DisplayInfo.DisplayName = DisplayInfo.PlainName;
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|