Files
UnrealEngineUWP/Engine/Source/Editor/BlueprintGraph/Classes/K2Node_GetClassDefaults.h
Phillip Kavan 5948f6ee41 [UE-16820] Provide ability to access class default property values at runtime in a Blueprint script.
#codereview Maciej.Mroz, Nick.Whiting

[CL 2600715 by Phillip Kavan in Main branch]
2015-06-25 12:09:53 -04:00

73 lines
2.3 KiB
C++

// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
#pragma once
#include "K2Node.h"
#include "K2Node_GetClassDefaults.generated.h"
UCLASS(MinimalAPI)
class UK2Node_GetClassDefaults : public UK2Node
{
GENERATED_UCLASS_BODY()
// Begin UObject interface
virtual void PostEditChangeProperty(struct FPropertyChangedEvent& PropertyChangedEvent) override;
// End UObject interface
// Begin UEdGraphNode interface
virtual FText GetNodeTitle(ENodeTitleType::Type TitleType) const override;
virtual void AllocateDefaultPins() override;
virtual void PostPlacedNewNode() override;
virtual void PinDefaultValueChanged(UEdGraphPin* Pin) override;
virtual void PinConnectionListChanged(UEdGraphPin* Pin) override;
// End UEdGraphNode interface
// Begin UK2Node interface
virtual bool IsNodePure() const override { return true; }
virtual bool ShouldShowNodeProperties() const override { return true; }
virtual void ReallocatePinsDuringReconstruction(TArray<UEdGraphPin*>& OldPins) override;
virtual class FNodeHandlingFunctor* CreateNodeHandler(class FKismetCompilerContext& CompilerContext) const override;
virtual void GetMenuActions(FBlueprintActionDatabaseRegistrar& ActionRegistrar) const override;
virtual FText GetMenuCategory() const override;
// End UK2Node interface
public:
/** Finds and returns the class input pin from the current set of pins. */
UEdGraphPin* FindClassPin() const
{
return FindClassPin(Pins);
}
protected:
/**
* Finds and returns the class input pin.
*
* @param FromPins A list of pins to search.
*/
UEdGraphPin* FindClassPin(const TArray<UEdGraphPin*>& FromPins) const;
/**
* Determines the input class type from the given pin.
*
* @param FromPin Input class pin. If not set (default), then it will fall back to using FindClassPin().
*/
UClass* GetInputClass(const UEdGraphPin* FromPin = nullptr) const;
/**
* Creates the full set of output pins (properties) from the given input class.
*
* @param InClass Input class type.
*/
void CreateOutputPins(UClass* InClass);
/** Will be called whenever the class pin selector changes its value. */
void OnClassPinChanged();
private:
/** Class pin name */
static FString ClassPinName;
/** Output pin visibility control */
UPROPERTY(EditAnywhere, Category=PinOptions, EditFixedSize)
TArray<FOptionalPinFromProperty> ShowPinForProperties;
};