Files
UnrealEngineUWP/Engine/Source/Editor/BlueprintGraph/Classes/K2Node_ConstructObjectFromClass.h
marc audy 157811767f Added a new AddComponentByClass node that allows a class to be selected or passed in. Unlike existing Add Component nodes, this node may be used any place functions can be called on an Actor, however, you cannot customize the component template beyond any properties that are exposed on spawn.
Based in part on PR #6681: Added new Blueprint node AddComponentByClass (Contributed by broly)
#jira UE-88602
#rb Michael.Noland

#ROBOMERGE-SOURCE: CL 13027087 via CL 13027104 via CL 13027247
#ROBOMERGE-BOT: RELEASE (Release-Engine-Staging -> Main) (v683-13008971)

[CL 13027278 by marc audy in Main branch]
2020-04-23 20:31:16 -04:00

95 lines
3.7 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "UObject/ObjectMacros.h"
#include "EdGraph/EdGraphNodeUtils.h"
#include "K2Node.h"
#include "K2Node_ConstructObjectFromClass.generated.h"
class FBlueprintActionDatabaseRegistrar;
class UEdGraph;
UCLASS(abstract)
class BLUEPRINTGRAPH_API UK2Node_ConstructObjectFromClass : public UK2Node
{
GENERATED_UCLASS_BODY()
//~ Begin UEdGraphNode Interface.
virtual void AllocateDefaultPins() override;
virtual FText GetNodeTitle(ENodeTitleType::Type TitleType) const override;
virtual void PinDefaultValueChanged(UEdGraphPin* Pin) override;
virtual FText GetTooltipText() const override;
virtual FText GetKeywords() const override;
virtual bool HasExternalDependencies(TArray<class UStruct*>* OptionalOutput) const override;
virtual bool IsCompatibleWithGraph(const UEdGraph* TargetGraph) const override;
virtual void PinConnectionListChanged(UEdGraphPin* Pin);
virtual void GetPinHoverText(const UEdGraphPin& Pin, FString& HoverTextOut) const override;
virtual void PostPlacedNewNode() override;
virtual void AddSearchMetaDataInfo(TArray<struct FSearchTagDataPair>& OutTaggedMetaData) const override;
//~ End UEdGraphNode Interface.
//~ Begin UK2Node Interface
virtual bool IsNodeSafeToIgnore() const override { return true; }
virtual void ReallocatePinsDuringReconstruction(TArray<UEdGraphPin*>& OldPins) override;
virtual void GetNodeAttributes( TArray<TKeyValuePair<FString, FString>>& OutNodeAttributes ) const override;
virtual void GetMenuActions(FBlueprintActionDatabaseRegistrar& ActionRegistrar) const override;
virtual FText GetMenuCategory() const override;
//~ End UK2Node Interface
/** Create new pins to show properties on archetype */
virtual void CreatePinsForClass(UClass* InClass, TArray<UEdGraphPin*>* OutClassPins = nullptr);
/** See if this is a spawn variable pin, or a 'default' pin */
virtual bool IsSpawnVarPin(UEdGraphPin* Pin) const;
/** Get the then output pin */
UEdGraphPin* GetThenPin() const;
/** Get the blueprint input pin */
UEdGraphPin* GetClassPin(const TArray<UEdGraphPin*>* InPinsToSearch=NULL) const;
/** Get the world context input pin, can return NULL */
UEdGraphPin* GetWorldContextPin() const;
/** Get the result output pin */
UEdGraphPin* GetResultPin() const;
/** Get the result input pin */
UEdGraphPin* GetOuterPin() const;
/** Get the class that we are going to spawn, if it's defined as default value */
UClass* GetClassToSpawn(const TArray<UEdGraphPin*>* InPinsToSearch=NULL) const;
/** Returns if the node uses World Object Context input */
virtual bool UseWorldContext() const;
/** Returns if the node uses Outer input */
virtual bool UseOuter() const { return false; }
protected:
/** Gets the node for use in lists and menus */
virtual FText GetBaseNodeTitle() const;
/** Gets the default node title when no class is selected */
virtual FText GetDefaultNodeTitle() const;
/** Gets the node title when a class has been selected. */
virtual FText GetNodeTitleFormat() const;
/** Gets base class to use for the 'class' pin. UObject by default. */
virtual UClass* GetClassPinBaseClass() const;
/**
* Takes the specified "MutatablePin" and sets its 'PinToolTip' field (according
* to the specified description)
*
* @param MutatablePin The pin you want to set tool-tip text on
* @param PinDescription A string describing the pin's purpose
*/
void SetPinToolTip(UEdGraphPin& MutatablePin, const FText& PinDescription) const;
/** Refresh pins when class was changed */
void OnClassPinChanged();
/** Tooltip text for this node. */
FText NodeTooltip;
/** Constructing FText strings can be costly, so we cache the node's title */
FNodeTextCache CachedNodeTitle;
};