Files
UnrealEngineUWP/Engine/Source/Developer/RigVMDeveloper/Private/RigVMModel/Nodes/RigVMRerouteNode.cpp
helge mathee 1a6205ca7f Control Rig: Reroute node title based on value type
#rb na
#jira na

#ROBOMERGE-AUTHOR: helge.mathee
#ROBOMERGE-SOURCE: CL 17458359 in //UE5/Main/...
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v870-17433530)

[CL 17458365 by helge mathee in ue5-release-engine-test branch]
2021-09-08 10:34:56 -04:00

65 lines
1.4 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#include "RigVMModel/Nodes/RigVMRerouteNode.h"
const FString URigVMRerouteNode::RerouteName = TEXT("Reroute");
const FString URigVMRerouteNode::ValueName = TEXT("Value");
URigVMRerouteNode::URigVMRerouteNode()
: bShowAsFullNode(true)
{
}
FString URigVMRerouteNode::GetNodeTitle() const
{
if(const URigVMPin* ValuePin = FindPin(ValueName))
{
FString TypeDisplayName;
if(const UScriptStruct* ScriptStruct = Cast<UScriptStruct>(ValuePin->GetCPPTypeObject()))
{
TypeDisplayName = ScriptStruct->GetDisplayNameText().ToString();
}
else if(const UEnum* Enum = Cast<UEnum>(ValuePin->GetCPPTypeObject()))
{
TypeDisplayName = Enum->GetName();
}
else if(const UClass* Class = Cast<UClass>(ValuePin->GetCPPTypeObject()))
{
TypeDisplayName = Class->GetDisplayNameText().ToString();
}
else if(ValuePin->IsArray())
{
TypeDisplayName = ValuePin->GetArrayElementCppType();
}
else
{
TypeDisplayName = ValuePin->GetCPPType();
}
if(TypeDisplayName.IsEmpty())
{
return RerouteName;
}
TypeDisplayName = TypeDisplayName.Left(1).ToUpper() + TypeDisplayName.Mid(1);
if(ValuePin->IsArray())
{
TypeDisplayName += TEXT(" Array");
}
return TypeDisplayName;
}
return RerouteName;
}
bool URigVMRerouteNode::GetShowsAsFullNode() const
{
return bShowAsFullNode;
}
FLinearColor URigVMRerouteNode::GetNodeColor() const
{
return FLinearColor::White;
}