Files
UnrealEngineUWP/Engine/Source/Editor/BlueprintGraph/Classes/K2Node_SpawnActor.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

70 lines
2.8 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "UObject/ObjectMacros.h"
#include "Textures/SlateIcon.h"
#include "K2Node.h"
#include "EdGraph/EdGraphNodeUtils.h"
#include "K2Node_SpawnActor.generated.h"
class UEdGraph;
UCLASS(MinimalAPI)
class UK2Node_SpawnActor : public UK2Node
{
GENERATED_UCLASS_BODY()
//~ Begin UEdGraphNode Interface.
virtual void AllocateDefaultPins() override;
virtual FLinearColor GetNodeTitleColor() const override;
virtual FText GetNodeTitle(ENodeTitleType::Type TitleType) const override;
virtual void PinDefaultValueChanged(UEdGraphPin* Pin) override;
virtual FText GetTooltipText() const override;
virtual bool IsDeprecated() const override;
virtual FEdGraphNodeDeprecationResponse GetDeprecationResponse(EEdGraphNodeDeprecationType DeprecationType) const override;
virtual FSlateIcon GetIconAndTint(FLinearColor& OutColor) const override;
virtual bool IsCompatibleWithGraph(const UEdGraph* TargetGraph) const override;
virtual bool HasExternalDependencies(TArray<class UStruct*>* OptionalOutput) const override;
//~ End UEdGraphNode Interface.
//~ Begin UK2Node Interface
virtual bool IsNodeSafeToIgnore() const override { return true; }
virtual void ReallocatePinsDuringReconstruction(TArray<UEdGraphPin*>& OldPins) override;
virtual class FNodeHandlingFunctor* CreateNodeHandler(class FKismetCompilerContext& CompilerContext) const override;
virtual void ExpandNode(class FKismetCompilerContext& CompilerContext, UEdGraph* SourceGraph) override;
virtual void GetNodeAttributes( TArray<TKeyValuePair<FString, FString>>& OutNodeAttributes ) const override;
//~ End UK2Node Interface
/** Create new pins to show properties on archetype */
void CreatePinsForClass(UClass* InClass);
/** See if this is a spawn variable pin, or a 'default' pin */
BLUEPRINTGRAPH_API bool IsSpawnVarPin(UEdGraphPin* Pin) const;
/** Get the then output pin */
BLUEPRINTGRAPH_API UEdGraphPin* GetThenPin() const;
/** Get the blueprint input pin */
BLUEPRINTGRAPH_API UEdGraphPin* GetBlueprintPin(const TArray<UEdGraphPin*>* InPinsToSearch=NULL) const;
/** Get the world context input pin, can return NULL */
BLUEPRINTGRAPH_API UEdGraphPin* GetWorldContextPin() const;
/** Get the spawn transform input pin */
BLUEPRINTGRAPH_API UEdGraphPin* GetSpawnTransformPin() const;
/** Get the no collision fail input pin */
BLUEPRINTGRAPH_API UEdGraphPin* GetNoCollisionFailPin() const;
/** Get the result output pin */
BLUEPRINTGRAPH_API UEdGraphPin* GetResultPin() const;
private:
/** Get the class that we are going to spawn */
BLUEPRINTGRAPH_API UClass* GetClassToSpawn(const TArray<UEdGraphPin*>* InPinsToSearch=NULL) const;
/** Tooltip text for this node. */
FText NodeTooltip;
/** Constructing FText strings can be costly, so we cache the node's title */
FNodeTextCache CachedNodeTitle;
};