Files
UnrealEngineUWP/Engine/Source/Editor/BlueprintGraph/Classes/K2Node_Event.h
Phillip Kavan f64e3e18d7 Some minor refactoring to assist with auto-importing external type object dependency namespaces into the Blueprint editor context in response to user actions.
Change summary:
- Moved base definition of UK2Node::HasExternalDependencies() up one level to UEdGraphNode (to avoid blind casts in a context where we may not necessarily have a UK2Node subtype).
- Updated subtype headers that override HasExternalDependencies() to relocate the declaration into the class declaration's 'UEdGraphNode overrides' section (for clarity).
- Reverted previous UBlueprintNodeSpawner::ImportTarget solution in favor of using node dependencies; this allows auto-import actions to scale more easily to all existing node subtypes and avoids data duplication.
- Modified SBlueprintActionMenu::OnActionSelected() to utilize the new method for determining which namespace(s) to auto-import after executing a node spawner action in response to a context menu item selection (UE-146803).
- Reverted FBlueprintNamespaceUtilities::GetPropertyValueNamespaces() back to its original 5.0 signature so that it uses a TSet<FString> for the output rather than a TArray<FString>; this fits in better with input to other APIs.
- Renamed FBlueprintEditor::FImportNamespaceParameters to FImportNamespaceExParameters (for clarity).
- Changed the 'FBlueprintEditor::FImportNamespaceParameters::AdditionalNamespaces' member to a TSet<FString> containing *all* namespaces to import rather than limiting to only additional ones.
- Reverted FBlueprintEditor::ImportNamespace() back to its original 5.0 signature and added/implemented FBlueprintEditor::ImportNamespaceEx() as the "extended" version that allows for batched imports and future customizations.
- Revised existing FBlueprintEditor::ImportNamespace() call sites to utilize and/or conform to the extended ImportNamespaceEx() API where appropriate.

#jira UE-146803
#rb Benjamin.Fox
#preflight 623cf3a433709ff50128e8d4

[CL 19505118 by Phillip Kavan in ue5-main branch]
2022-03-24 19:50:46 -04:00

125 lines
5.9 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "UObject/ObjectMacros.h"
#include "Templates/SubclassOf.h"
#include "Textures/SlateIcon.h"
#include "Engine/MemberReference.h"
#include "EdGraph/EdGraphNodeUtils.h"
#include "K2Node_EditablePinBase.h"
#include "K2Node_EventNodeInterface.h"
#include "K2Node_Event.generated.h"
class FKismetCompilerContext;
class FNodeHandlingFunctor;
class UEdGraph;
UCLASS(MinimalAPI)
class UK2Node_Event : public UK2Node_EditablePinBase, public IK2Node_EventNodeInterface
{
GENERATED_UCLASS_BODY()
BLUEPRINTGRAPH_API static const FName DelegateOutputName;
/** Name of function signature that this event implements */
UPROPERTY()
FName EventSignatureName_DEPRECATED;
/** Class that the function signature is from. */
UPROPERTY()
TSubclassOf<class UObject> EventSignatureClass_DEPRECATED;
/** Reference for the function this event is linked to */
UPROPERTY()
FMemberReference EventReference;
/** If true, we are actually overriding this function, not making a new event with a signature that matches */
UPROPERTY()
uint32 bOverrideFunction:1;
/** If true, this event is internal machinery, and should not be marked BlueprintCallable */
UPROPERTY()
uint32 bInternalEvent:1;
/** If this is not an override, allow user to specify a name for the function created by this entry point */
UPROPERTY()
FName CustomFunctionName;
/** Additional function flags to apply to this function */
UPROPERTY()
uint32 FunctionFlags;
//~ Begin UObject Interface
BLUEPRINTGRAPH_API virtual void Serialize(FArchive& Ar) override;
BLUEPRINTGRAPH_API virtual void PostLoad() override;
BLUEPRINTGRAPH_API virtual void PostDuplicate(bool bDuplicateForPIE) override;
//~ End UObject Interface
//~ Begin UEdGraphNode Interface
BLUEPRINTGRAPH_API virtual void AllocateDefaultPins() override;
BLUEPRINTGRAPH_API virtual FText GetTooltipText() const override;
BLUEPRINTGRAPH_API virtual FText GetKeywords() const override;
BLUEPRINTGRAPH_API virtual FText GetNodeTitle(ENodeTitleType::Type TitleType) const override;
BLUEPRINTGRAPH_API virtual FLinearColor GetNodeTitleColor() const override;
BLUEPRINTGRAPH_API virtual bool CanPasteHere(const UEdGraph* TargetGraph) const override;
BLUEPRINTGRAPH_API virtual bool IsCompatibleWithGraph(const UEdGraph* TargetGraph) const override;
BLUEPRINTGRAPH_API virtual FName GetCornerIcon() const override;
BLUEPRINTGRAPH_API virtual bool HasDeprecatedReference() const override;
BLUEPRINTGRAPH_API virtual FEdGraphNodeDeprecationResponse GetDeprecationResponse(EEdGraphNodeDeprecationType DeprecationType) const override;
BLUEPRINTGRAPH_API virtual UObject* GetJumpTargetForDoubleClick() const override;
BLUEPRINTGRAPH_API virtual FSlateIcon GetIconAndTint(FLinearColor& OutColor) const override;
BLUEPRINTGRAPH_API virtual FString GetFindReferenceSearchString() const override;
BLUEPRINTGRAPH_API virtual void FindDiffs(UEdGraphNode* OtherNode, struct FDiffResults& Results) override;
BLUEPRINTGRAPH_API virtual bool HasExternalDependencies(TArray<class UStruct*>* OptionalOutput) const override;
//~ End UEdGraphNode Interface
//~ Begin UK2Node Interface
virtual bool DrawNodeAsEntry() const override { return true; }
BLUEPRINTGRAPH_API virtual bool NodeCausesStructuralBlueprintChange() const override;
BLUEPRINTGRAPH_API virtual void GetRedirectPinNames(const UEdGraphPin& Pin, TArray<FString>& RedirectPinNames) const override;
BLUEPRINTGRAPH_API virtual void ValidateNodeDuringCompilation(class FCompilerResultsLog& MessageLog) const override;
BLUEPRINTGRAPH_API virtual void PinConnectionListChanged(UEdGraphPin* Pin) override;
BLUEPRINTGRAPH_API virtual void PostReconstructNode() override;
BLUEPRINTGRAPH_API virtual FString GetDocumentationLink() const override;
BLUEPRINTGRAPH_API virtual FString GetDocumentationExcerptName() const override;
BLUEPRINTGRAPH_API virtual FNodeHandlingFunctor* CreateNodeHandler(FKismetCompilerContext& CompilerContext) const override;
BLUEPRINTGRAPH_API virtual void ExpandNode(class FKismetCompilerContext& CompilerContext, UEdGraph* SourceGraph) override;
BLUEPRINTGRAPH_API virtual FText GetToolTipHeading() const override;
BLUEPRINTGRAPH_API virtual void GetNodeAttributes( TArray<TKeyValuePair<FString, FString>>& OutNodeAttributes ) const override;
BLUEPRINTGRAPH_API virtual FText GetMenuCategory() const override;
//~ End UK2Node Interface
//~ Begin IK2Node_EventNodeInterface Interface.
BLUEPRINTGRAPH_API virtual TSharedPtr<FEdGraphSchemaAction> GetEventNodeAction(const FText& ActionCategory) override;
//~ End IK2Node_EventNodeInterface Interface.
/** Checks whether the parameters for this event node are compatible with the specified function entry node */
BLUEPRINTGRAPH_API virtual bool IsFunctionEntryCompatible(const class UK2Node_FunctionEntry* EntryNode) const;
/** Checks if this event node is implementing an interface event */
BLUEPRINTGRAPH_API bool IsInterfaceEventNode() const;
BLUEPRINTGRAPH_API UFunction* FindEventSignatureFunction();
BLUEPRINTGRAPH_API void UpdateDelegatePin(bool bSilent = false);
BLUEPRINTGRAPH_API FName GetFunctionName() const;
BLUEPRINTGRAPH_API virtual bool IsUsedByAuthorityOnlyDelegate() const { return false; }
BLUEPRINTGRAPH_API virtual bool IsCosmeticTickEvent() const;
/** Returns localized string describing replication settings.
* Calling - whether this function is being called ("sending") or showing implementation ("receiving"). Determined whether we output "Replicated To Server" or "Replicated From Client".
*/
static FText GetLocalizedNetString(uint32 NetFlags, bool Calling);
/** Helper function to identify if two Event nodes are the same */
static BLUEPRINTGRAPH_API bool AreEventNodesIdentical(const UK2Node_Event* InNodeA, const UK2Node_Event* InNodeB);
protected:
void FixupEventReference(bool bForce = false);
private:
/** Constructing FText strings can be costly, so we cache the node's tooltip */
FNodeTextCache CachedTooltip;
};