Files
UnrealEngineUWP/Engine/Source/Editor/BlueprintGraph/Classes/K2Node_CallDataTableFunction.h
dave jones2 c4107f5283 UE-196156 - Add exec toggle for pure nodes
Blueprint pure nodes were initially intended to be similar to "functional pure". In other words, they're deterministic and produce no side effects (eg: doesn't mutate state). However, pure nodes have violated both conditions for a while now.

Instead, pure nodes are simply function nodes with output values and no visible exec pins. While this can be convenient, they come with a downside: the pure node is evaluated for each connected output. This can lead to unexpected performance issues if the node is expensive to evaluate. In the case of non-deterministic nodes, this can lead to unexpected behavior. In both cases, the user often needs to cull multiple outputs of a pure node and cache the result manually.

The solution here is to add support for toggling purity at the call site. When a function node is placed, right-clicking on it and selecting either "Hide Exec pins" or "Show Exec Pins" will toggle purity. Additionally, the meaning of BlueprintPure and the "Pure" check box changes slightly: it now means that the function node _defaults_ to a pure state when placed in a graph. However, it can be toggled to show its exec pins.

In future changes, we'll also reevaluate which common library functions should continue to default as pure.

#jira UE-196156
#rb dan.oconnor, jodon.karlik, ben.zeigler

[CL 35309072 by dave jones2 in ue5-main branch]
2024-08-05 11:58:15 -04:00

29 lines
753 B
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "K2Node_CallFunction.h"
#include "UObject/ObjectMacros.h"
#include "UObject/UObjectGlobals.h"
#include "K2Node_CallDataTableFunction.generated.h"
class UEdGraphPin;
class UObject;
UCLASS(MinimalAPI)
class UK2Node_CallDataTableFunction : public UK2Node_CallFunction
{
GENERATED_UCLASS_BODY()
//~ Begin EdGraphNode Interface
virtual void PinDefaultValueChanged(UEdGraphPin* Pin) override;
virtual void NotifyPinConnectionListChanged(UEdGraphPin* Pin) override;
//~ End EdGraphNode Interface
//~ Begin UK2Node_CallFunction interface
virtual bool CanToggleNodePurity() const override { return false; }
//~ End UK2Node_CallFunction interface
};