Files
integration/Source/Integration/LuprexK2Node.cpp

63 lines
1.6 KiB
C++
Raw Normal View History

2026-03-04 02:56:15 -05:00
#include "LuprexK2Node.h"
#include "EdGraphSchema_K2.h"
#include "K2Node_CallFunction.h"
#include "KismetCompiler.h"
FName UlxK2Node::AddPrefix(const FString &Name, char Prefix)
{
TCHAR PrefixChars[3];
PrefixChars[0] = Prefix;
PrefixChars[1] = ':';
PrefixChars[2] = 0;
FString Prefixed = PrefixChars + Name;
return FName(*Prefixed);
}
FName UlxK2Node::RemovePrefix(FName Name)
{
TCHAR pname[FName::StringBufferSize];
Name.ToString(pname);
if ((pname[0] != 0) && (pname[1] == ':'))
{
return FName(pname + 2);
}
return Name;
}
FEdGraphPinType UlxK2Node::PropertyToPinType(const FProperty *Property)
{
FEdGraphPinType PinType;
if (Property)
{
GetDefault<UEdGraphSchema_K2>()->ConvertPropertyToPinType(Property, PinType);
}
return PinType;
}
void UlxK2Node::SetErrorMsg(const FString &Msg)
{
if (bHasCompilerMessage) return;
bHasCompilerMessage = true;
ErrorType = EMessageSeverity::Error;
ErrorMsg = Msg;
}
UEdGraphPin* UlxK2Node::ChainExecPin(UEdGraphPin *ExecOut, UK2Node *NextNode, const TCHAR *OutputPinName)
{
ExecOut->MakeLinkTo(NextNode->GetExecPin());
UEdGraphPin *Result = NextNode->FindPinChecked(FName(OutputPinName), EGPD_Output);
check(Result->PinType.PinCategory == UEdGraphSchema_K2::PC_Exec);
return Result;
}
UK2Node_CallFunction* UlxK2Node::MakeCallFunctionNode(FKismetCompilerContext &CompilerContext, UEdGraph *SourceGraph, UFunction *Func)
{
UK2Node_CallFunction* CallNode = CompilerContext.SpawnIntermediateNode<UK2Node_CallFunction>(this, SourceGraph);
CallNode->SetFromFunction(Func);
CallNode->AllocateDefaultPins();
CompilerContext.MessageLog.NotifyIntermediateObjectCreation(CallNode, this);
return CallNode;
}