October3d55/M/WidgetFunctionLibrary/Source/WidgetFunctionLibraryEditor/Public/K2Nodes/K2Node_WidgetConstructObject.h

106 lines
4.2 KiB
C++

// Copyright 2022 Just2Devs. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "EdGraph/EdGraphNodeUtils.h"
#include "K2Node.h"
#include "K2Node_WidgetConstructObject.generated.h"
class FBlueprintActionDatabaseRegistrar;
class UEdGraph;
UCLASS(BlueprintType, Blueprintable)
class WIDGETFUNCTIONLIBRARYEDITOR_API UK2Node_WidgetConstructObject : public UK2Node
{
GENERATED_UCLASS_BODY()
public:
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Pin Properties", EditFixedSize)
TArray<FName> PinsNames;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Pin Properties", EditFixedSize)
TArray<bool> PinsEnabled;
#if WITH_EDITOR
// UObject interface
virtual void PostEditChangeProperty(struct FPropertyChangedEvent& PropertyChangedEvent) override;
// End of UObject interface
#endif
//~ Begin UEdGraphNode Interface.
virtual void ExpandNode(FKismetCompilerContext& CompilerContext, UEdGraph* SourceGraph) override;
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) override;
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;
virtual bool ShouldShowNodeProperties() const override { return true; };
//~ End UK2Node Interface
/** Create new pins to show properties on archetype */
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 = nullptr) 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 = nullptr) const;
/** Returns if the node uses World Object Context input */
virtual bool UseWorldContext() const { return false; };
/** Returns if the node uses Outer input */
virtual bool UseOuter() const { return true; }
protected:
/** Gets the default node title when no class is selected */
virtual FText GetBaseNodeTitle() 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;
};