107 lines
4.2 KiB
C++
107 lines
4.2 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#pragma once
|
|
|
|
#include "Containers/Array.h"
|
|
#include "Containers/UnrealString.h"
|
|
#include "CoreMinimal.h"
|
|
#include "EdGraph/EdGraphNode.h"
|
|
#include "EdGraph/EdGraphNodeUtils.h"
|
|
#include "HAL/PlatformMath.h"
|
|
#include "Internationalization/Text.h"
|
|
#include "K2Node.h"
|
|
#include "UObject/NameTypes.h"
|
|
#include "UObject/ObjectMacros.h"
|
|
#include "UObject/UObjectGlobals.h"
|
|
|
|
#include "K2Node_ConstructObjectFromClass.generated.h"
|
|
|
|
class FBlueprintActionDatabaseRegistrar;
|
|
class UClass;
|
|
class UEdGraph;
|
|
class UEdGraphPin;
|
|
class UObject;
|
|
template <typename KeyType, typename ValueType> struct TKeyValuePair;
|
|
|
|
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;
|
|
virtual FString GetPinMetaData(FName InPinName, FName InKey) override;
|
|
//~ End UEdGraphNode Interface.
|
|
|
|
//~ Begin UK2Node Interface
|
|
virtual bool IsNodeSafeToIgnore() const override { return true; }
|
|
virtual void ReallocatePinsDuringReconstruction(TArray<UEdGraphPin*>& OldPins) override;
|
|
virtual ERedirectType DoPinsMatchForReconstruction(const UEdGraphPin* NewPin, int32 NewPinIndex, const UEdGraphPin* OldPin, int32 OldPinIndex) const 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 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;
|
|
};
|