Massive refactoring in FormatMessage and LuaCallNode

This commit is contained in:
2026-03-04 06:47:37 -05:00
parent 6428194393
commit cb6f9ebe1d
7 changed files with 318 additions and 467 deletions

View File

@@ -51,17 +51,27 @@ FText UK2Node_LuaInvoke::GetTooltipText() const
return Tooltip;
}
void UK2Node_LuaInvoke::ReconstructNode()
{
// Save the value of the Prototype Pin before it gets reconstructed.
UEdGraphPin* FunctionPin = FindPin(FunctionPinName);
if (FunctionPin != nullptr)
{
LuaFunctionPrototype = FunctionPin->DefaultValue;
}
Super::ReconstructNode();
}
void UK2Node_LuaInvoke::AllocateDefaultPins()
{
Pins.Reset();
Super::AllocateDefaultPins();
if (LuaFunctionPrototype.IsEmpty())
{
LuaFunctionPrototype = TEXT("class.func(int arg1, int arg2) : int ret1, int ret2");
}
// Parse the lua function prototype.
// Note that we use the saved value of the function
// prototype, because the function prototype pin
// has been deleted at this point.
FlxParsedProto ParsedProto(LuaFunctionPrototype);
if (!ParsedProto.ErrorMessage.IsEmpty())
{
@@ -142,7 +152,6 @@ void UK2Node_LuaInvoke::PinDefaultValueChanged(UEdGraphPin* Pin)
{
if ((Pin->PinName == FunctionPinName) && (Pin->DefaultValue != LuaFunctionPrototype))
{
LuaFunctionPrototype = Pin->DefaultValue;
ReconstructNode();
}
}
@@ -246,6 +255,7 @@ void UK2Node_LuaInvoke::ExpandNode(class FKismetCompilerContext& CompilerContext
UK2Node::ERedirectType UK2Node_LuaInvoke::DoPinsMatchForReconstruction(const UEdGraphPin* NewPin, int32 NewPinIndex, const UEdGraphPin* OldPin, int32 OldPinIndex) const
{
if (IsTemplate() || (GetGraph() == nullptr)) return ERedirectType_None;
if ((NewPin->PinName == OldPin->PinName) &&
(NewPin->Direction == OldPin->Direction) &&
(NewPin->PinType == OldPin->PinType))