Files
UnrealEngineUWP/Engine/Source/Editor/BlueprintGraph/Public/CallFunctionHandler.h
dave jones2 939f991649 UE-146987 - Cleaned up the original fix for erroneous implicit casts in python script nodes.
Since UK2Node_ExecutePythonScript uses wildcards for its pins, it's dependent on its linked inputs. During node reconstruction, we were updating the python node's pins based on incorrect data. For example, one of the input nodes needed to change its pin type from real/double to real/float during reconstruction. However, this reconstruction occurred after the linked python node was reconstructed. As a result, the python node assumed that its linked input node was using a real/double type.

We can fix this by simply changing the priority of UK2Node_ExecutePythonScript to Low_UsesDependentWildcard. Additionally, this change reverts 19482561.

#rb jamie.dale
#preflight 625882d8010ebc5d4e8a5cc7
#jira UE-146987

[CL 19810564 by dave jones2 in ue5-main branch]
2022-04-19 12:18:56 -04:00

75 lines
2.5 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "KismetCompilerMisc.h"
#include "K2Node_CallFunction.h"
class FKismetCompilerContext;
struct FKismetFunctionContext;
//////////////////////////////////////////////////////////////////////////
// FKCHandler_CallFunction
class FKCHandler_CallFunction : public FNodeHandlingFunctor
{
public:
FKCHandler_CallFunction(FKismetCompilerContext& InCompilerContext)
: FNodeHandlingFunctor(InCompilerContext)
{
}
/**
* Searches for the function referenced by a graph node in the CallingContext class's list of functions,
* validates that the wiring matches up correctly, and creates an execution statement.
*/
void CreateFunctionCallStatement(FKismetFunctionContext& Context, UEdGraphNode* Node, UEdGraphPin* SelfPin);
bool IsCalledFunctionPure(UEdGraphNode* Node)
{
if(UK2Node_CallFunction* CallFunctionNode = Cast<UK2Node_CallFunction>(Node))
{
return CallFunctionNode->bIsPureFunc;
}
return false;
}
bool IsCalledFunctionFinal(UEdGraphNode* Node)
{
if(UK2Node_CallFunction* CallFunctionNode = Cast<UK2Node_CallFunction>(Node))
{
return CallFunctionNode->bIsFinalFunction;
}
return false;
}
bool IsCalledFunctionFromInterface(UEdGraphNode* Node)
{
if(UK2Node_CallFunction* CallFunctionNode = Cast<UK2Node_CallFunction>(Node))
{
return CallFunctionNode->bIsInterfaceCall;
}
return false;
}
private:
// Get the name of the function to call from the node
virtual FName GetFunctionNameFromNode(UEdGraphNode* Node) const;
UClass* GetCallingContext(FKismetFunctionContext& Context, UEdGraphNode* Node);
UClass* GetTrueCallingClass(FKismetFunctionContext& Context, UEdGraphPin* SelfPin);
public:
virtual void RegisterNets(FKismetFunctionContext& Context, UEdGraphNode* Node) override;
virtual void RegisterNet(FKismetFunctionContext& Context, UEdGraphPin* Net) override;
virtual UFunction* FindFunction(FKismetFunctionContext& Context, UEdGraphNode* Node);
virtual void Transform(FKismetFunctionContext& Context, UEdGraphNode* Node) override;
virtual void Compile(FKismetFunctionContext& Context, UEdGraphNode* Node) override;
virtual void CheckIfFunctionIsCallable(UFunction* Function, FKismetFunctionContext& Context, UEdGraphNode* Node);
virtual void AdditionalCompiledStatementHandling(FKismetFunctionContext& Context, UEdGraphNode* Node, FBlueprintCompiledStatement& Statement) {}
private:
TMap<UEdGraphPin*, FBPTerminal*> InterfaceTermMap;
};