You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
Unified the approach to gathering assets and spawning nodes from them. Previously each had its own slightly unique code doing similar things. Note that with this change it is now possible to directly spawn 'evaluator' style nodes from the context menu instead of relying on a context menu conversion step. Also tweaked icons, tooltips and titles for consistency #rb Jurre.deBaare [CL 16434364 by Thomas Sarkanen in ue5-main branch]
86 lines
2.9 KiB
C++
86 lines
2.9 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "AnimGraphNode_BlendSpaceGraph.h"
|
|
|
|
#include "AnimGraphNode_AssetPlayerBase.h"
|
|
#include "BlueprintNodeSpawner.h"
|
|
#include "BlueprintActionDatabaseRegistrar.h"
|
|
#include "Animation/AimOffsetBlendSpace.h"
|
|
#include "Animation/AimOffsetBlendSpace1D.h"
|
|
#include "AssetRegistry/AssetRegistryModule.h"
|
|
|
|
#define LOCTEXT_NAMESPACE "UAnimGraphNode_BlendSpaceGraph"
|
|
|
|
FText UAnimGraphNode_BlendSpaceGraph::GetNodeTitle(ENodeTitleType::Type TitleType) const
|
|
{
|
|
if(BlendSpaceGraph || BlendSpace)
|
|
{
|
|
const FText BlendSpaceName = FText::FromString(BlendSpaceGraph ? GetBlendSpaceGraphName() : GetBlendSpaceName());
|
|
|
|
if(TitleType == ENodeTitleType::EditableTitle)
|
|
{
|
|
return BlendSpaceName;
|
|
}
|
|
else if (TitleType == ENodeTitleType::ListView || TitleType == ENodeTitleType::MenuTitle)
|
|
{
|
|
FFormatNamedArguments Args;
|
|
Args.Add(TEXT("BlendSpaceName"), BlendSpaceName);
|
|
return FText::Format(LOCTEXT("BlendspaceListTitle", "Blendspace '{BlendSpaceName}'"), Args);
|
|
}
|
|
else
|
|
{
|
|
FFormatNamedArguments TitleArgs;
|
|
TitleArgs.Add(TEXT("BlendSpaceName"), BlendSpaceName);
|
|
FText Title = FText::Format(LOCTEXT("BlendSpaceFullTitle", "{BlendSpaceName}\nBlendspace"), TitleArgs);
|
|
|
|
if ((TitleType == ENodeTitleType::FullTitle) && (Node.GetGroupName() != NAME_None))
|
|
{
|
|
FFormatNamedArguments Args;
|
|
Args.Add(TEXT("Title"), Title);
|
|
Args.Add(TEXT("SyncGroupName"), FText::FromName(Node.GetGroupName()));
|
|
Title = FText::Format(LOCTEXT("BlendSpaceNodeGroupSubtitle", "{Title}\nSync group {SyncGroupName}"), Args);
|
|
}
|
|
|
|
return Title;
|
|
}
|
|
}
|
|
else if(BlendSpaceClass.Get())
|
|
{
|
|
return BlendSpaceClass.Get()->GetDisplayNameText();
|
|
}
|
|
else
|
|
{
|
|
return LOCTEXT("EmptyBlendspaceListTitle", "Blendspace");
|
|
}
|
|
}
|
|
|
|
void UAnimGraphNode_BlendSpaceGraph::GetMenuActions(FBlueprintActionDatabaseRegistrar& InActionRegistrar) const
|
|
{
|
|
UAnimGraphNode_AssetPlayerBase::GetMenuActionsHelper(
|
|
InActionRegistrar,
|
|
GetClass(),
|
|
{ UBlendSpace::StaticClass(), UBlendSpace1D::StaticClass() },
|
|
{ UAimOffsetBlendSpace::StaticClass(), UAimOffsetBlendSpace1D::StaticClass() },
|
|
[](const FAssetData& InAssetData)
|
|
{
|
|
return FText::Format(LOCTEXT("MenuDescFormat", "Blendspace '{0}'"), FText::FromName(InAssetData.AssetName));
|
|
},
|
|
[](const FAssetData& InAssetData)
|
|
{
|
|
return FText::Format(LOCTEXT("MenuDescTooltipFormat", "Blendspace\n'{0}'"), FText::FromName(InAssetData.ObjectPath));
|
|
},
|
|
[](UEdGraphNode* InNewNode, bool bInIsTemplateNode, const FAssetData InAssetData)
|
|
{
|
|
UAnimGraphNode_BlendSpaceGraph* GraphNode = CastChecked<UAnimGraphNode_BlendSpaceGraph>(InNewNode);
|
|
GraphNode->SetupFromAsset(InAssetData, bInIsTemplateNode);
|
|
});
|
|
}
|
|
|
|
void UAnimGraphNode_BlendSpaceGraph::BakeDataDuringCompilation(class FCompilerResultsLog& MessageLog)
|
|
{
|
|
UAnimBlueprint* AnimBlueprint = GetAnimBlueprint();
|
|
AnimBlueprint->FindOrAddGroup(Node.GetGroupName());
|
|
}
|
|
|
|
#undef LOCTEXT_NAMESPACE
|