You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
Big conversion of FStrings and FNames to FText. Version bump to move some MaterialFunction UProperty from a TArray<FString> to TArray<FText> (some Engine assets are older than being allowed to auto-convert the UProperty) Auto conversion of FName to FText (and back) now supported (as well as TArrays of those types). Searching categories by both the localized string and the source string is now supported in Blueprints. #jira UE-14481 - We are missing ability to translate node categories #codereview Justin.Sargent [CL 2542875 by Michael Schoell in Main branch]
115 lines
3.3 KiB
C++
115 lines
3.3 KiB
C++
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "AnimGraphPrivatePCH.h"
|
|
#include "AnimationGraphSchema.h"
|
|
#include "AnimGraphNode_BlendSpaceBase.h"
|
|
#include "AnimGraphNode_BlendSpacePlayer.h"
|
|
#include "AnimGraphNode_RotationOffsetBlendSpace.h"
|
|
#include "GraphEditorActions.h"
|
|
|
|
#define LOCTEXT_NAMESPACE "AnimGraphNode_BlendSpaceBase"
|
|
|
|
/////////////////////////////////////////////////////
|
|
|
|
// Action to add a sequence player node to the graph
|
|
struct FNewBlendSpacePlayerAction : public FEdGraphSchemaAction_K2NewNode
|
|
{
|
|
FNewBlendSpacePlayerAction(class UBlendSpaceBase* BlendSpace)
|
|
{
|
|
check(BlendSpace);
|
|
|
|
const bool bIsAimOffset = BlendSpace->IsA(UAimOffsetBlendSpace::StaticClass()) || BlendSpace->IsA(UAimOffsetBlendSpace1D::StaticClass());
|
|
if (bIsAimOffset)
|
|
{
|
|
UAnimGraphNode_RotationOffsetBlendSpace* Template = NewObject<UAnimGraphNode_RotationOffsetBlendSpace>();
|
|
Template->Node.BlendSpace = BlendSpace;
|
|
NodeTemplate = Template;
|
|
TooltipDescription = TEXT("Evaluates an aim offset at a particular coordinate to produce a pose");
|
|
}
|
|
else
|
|
{
|
|
UAnimGraphNode_BlendSpacePlayer* Template = NewObject<UAnimGraphNode_BlendSpacePlayer>();
|
|
Template->Node.BlendSpace = BlendSpace;
|
|
NodeTemplate = Template;
|
|
TooltipDescription = TEXT("Evaluates a blend space at a particular coordinate to produce a pose");
|
|
}
|
|
|
|
MenuDescription = NodeTemplate->GetNodeTitle(ENodeTitleType::ListView);
|
|
|
|
Category = LOCTEXT("Animation", "Animations");
|
|
|
|
// Grab extra keywords
|
|
Keywords = FText::FromString(BlendSpace->GetPathName());
|
|
}
|
|
};
|
|
|
|
/////////////////////////////////////////////////////
|
|
// UAnimGraphNode_BlendSpaceBase
|
|
|
|
UAnimGraphNode_BlendSpaceBase::UAnimGraphNode_BlendSpaceBase(const FObjectInitializer& ObjectInitializer)
|
|
: Super(ObjectInitializer)
|
|
{
|
|
}
|
|
|
|
FLinearColor UAnimGraphNode_BlendSpaceBase::GetNodeTitleColor() const
|
|
{
|
|
return FLinearColor(0.2f, 0.8f, 0.2f);
|
|
}
|
|
|
|
void UAnimGraphNode_BlendSpaceBase::CustomizePinData(UEdGraphPin* Pin, FName SourcePropertyName, int32 ArrayIndex) const
|
|
{
|
|
UBlendSpaceBase * BlendSpace = GetBlendSpace();
|
|
|
|
if (BlendSpace != NULL)
|
|
{
|
|
if (SourcePropertyName == TEXT("X"))
|
|
{
|
|
Pin->PinFriendlyName = FText::FromString(BlendSpace->GetBlendParameter(0).DisplayName);
|
|
}
|
|
else if (SourcePropertyName == TEXT("Y"))
|
|
{
|
|
Pin->PinFriendlyName = FText::FromString(BlendSpace->GetBlendParameter(1).DisplayName);
|
|
Pin->bHidden = (BlendSpace->NumOfDimension == 1) ? 1 : 0;
|
|
}
|
|
else if (SourcePropertyName == TEXT("Z"))
|
|
{
|
|
Pin->PinFriendlyName = FText::FromString(BlendSpace->GetBlendParameter(2).DisplayName);
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
void UAnimGraphNode_BlendSpaceBase::PreloadRequiredAssets()
|
|
{
|
|
PreloadObject(GetBlendSpace());
|
|
|
|
Super::PreloadRequiredAssets();
|
|
}
|
|
|
|
void UAnimGraphNode_BlendSpaceBase::PostProcessPinName(const UEdGraphPin* Pin, FString& DisplayName) const
|
|
{
|
|
if(Pin->Direction == EGPD_Input)
|
|
{
|
|
UBlendSpaceBase * BlendSpace = GetBlendSpace();
|
|
|
|
if(BlendSpace != NULL)
|
|
{
|
|
if(Pin->PinName == TEXT("X"))
|
|
{
|
|
DisplayName = BlendSpace->GetBlendParameter(0).DisplayName;
|
|
}
|
|
else if(Pin->PinName == TEXT("Y"))
|
|
{
|
|
DisplayName = BlendSpace->GetBlendParameter(1).DisplayName;
|
|
}
|
|
else if(Pin->PinName == TEXT("Z"))
|
|
{
|
|
DisplayName = BlendSpace->GetBlendParameter(2).DisplayName;
|
|
}
|
|
}
|
|
}
|
|
|
|
Super::PostProcessPinName(Pin, DisplayName);
|
|
}
|
|
|
|
#undef LOCTEXT_NAMESPACE |