2014-12-07 19:09:38 -05:00
|
|
|
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
|
2014-03-14 14:13:41 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
#pragma once
|
2014-05-29 16:42:22 -04:00
|
|
|
#include "K2Node.h"
|
2014-09-02 19:08:09 -04:00
|
|
|
#include "EdGraph/EdGraphNodeUtils.h" // for FNodeTextCache
|
2014-03-14 14:13:41 -04:00
|
|
|
#include "K2Node_DynamicCast.generated.h"
|
|
|
|
|
|
|
|
|
|
UCLASS(MinimalAPI)
|
|
|
|
|
class UK2Node_DynamicCast : public UK2Node
|
|
|
|
|
{
|
2015-03-17 05:38:32 -04:00
|
|
|
GENERATED_UCLASS_BODY()
|
2014-03-14 14:13:41 -04:00
|
|
|
|
|
|
|
|
/** The type that the input should try to be cast to */
|
|
|
|
|
UPROPERTY()
|
|
|
|
|
TSubclassOf<class UObject> TargetType;
|
|
|
|
|
|
|
|
|
|
// Begin UEdGraphNode interface
|
2014-06-13 06:14:46 -04:00
|
|
|
virtual void AllocateDefaultPins() override;
|
|
|
|
|
virtual FLinearColor GetNodeTitleColor() const override;
|
|
|
|
|
virtual FText GetNodeTitle(ENodeTitleType::Type TitleType) const override;
|
|
|
|
|
virtual FName GetPaletteIcon(FLinearColor& OutColor) const override{ return TEXT("GraphEditor.Cast_16x"); }
|
2014-10-27 13:10:00 -04:00
|
|
|
virtual void GetContextMenuActions(const FGraphNodeContextMenuBuilder& Context) const override;
|
2014-12-15 15:30:07 -05:00
|
|
|
virtual void PostReconstructNode() override;
|
2014-12-10 18:18:54 -05:00
|
|
|
virtual void PostPlacedNewNode() override;
|
2014-03-14 14:13:41 -04:00
|
|
|
// End UEdGraphNode interface
|
|
|
|
|
|
|
|
|
|
// UK2Node interface
|
2014-06-13 06:14:46 -04:00
|
|
|
virtual ERedirectType DoPinsMatchForReconstruction(const UEdGraphPin* NewPin, int32 NewPinIndex, const UEdGraphPin* OldPin, int32 OldPinIndex) const override;
|
|
|
|
|
virtual class FNodeHandlingFunctor* CreateNodeHandler(class FKismetCompilerContext& CompilerContext) const override;
|
2015-04-25 17:47:39 -04:00
|
|
|
virtual bool HasExternalDependencies(TArray<class UStruct*>* OptionalOutput) const override;
|
2014-07-14 16:15:27 -04:00
|
|
|
virtual FText GetMenuCategory() const override;
|
2014-09-17 17:07:37 -04:00
|
|
|
virtual FBlueprintNodeSignature GetSignature() const override;
|
2014-10-27 13:10:00 -04:00
|
|
|
virtual bool IsNodePure() const override { return bIsPureCast; }
|
2014-12-15 15:30:07 -05:00
|
|
|
virtual bool IsConnectionDisallowed(const UEdGraphPin* MyPin, const UEdGraphPin* OtherPin, FString& OutReason) const override;
|
|
|
|
|
virtual void NotifyPinConnectionListChanged(UEdGraphPin* Pin) override;
|
2015-01-15 13:54:47 -05:00
|
|
|
virtual void ReallocatePinsDuringReconstruction(TArray<UEdGraphPin*>& OldPins) override;
|
2015-04-27 12:55:58 -04:00
|
|
|
virtual void ValidateNodeDuringCompilation(class FCompilerResultsLog& MessageLog) const override;
|
2014-03-14 14:13:41 -04:00
|
|
|
// End of UK2Node interface
|
|
|
|
|
|
|
|
|
|
/** Get the 'valid cast' exec pin */
|
|
|
|
|
BLUEPRINTGRAPH_API UEdGraphPin* GetValidCastPin() const;
|
|
|
|
|
|
|
|
|
|
/** Get the 'invalid cast' exec pin */
|
|
|
|
|
BLUEPRINTGRAPH_API UEdGraphPin* GetInvalidCastPin() const;
|
|
|
|
|
|
|
|
|
|
/** Get the cast result pin */
|
|
|
|
|
BLUEPRINTGRAPH_API UEdGraphPin* GetCastResultPin() const;
|
|
|
|
|
|
|
|
|
|
/** Get the input object to be casted pin */
|
2014-04-02 18:09:23 -04:00
|
|
|
BLUEPRINTGRAPH_API virtual UEdGraphPin* GetCastSourcePin() const;
|
2014-09-02 19:08:09 -04:00
|
|
|
|
2014-11-21 14:51:28 -05:00
|
|
|
/** Get the boolean output pin that signifies a successful/failed cast. */
|
|
|
|
|
BLUEPRINTGRAPH_API virtual UEdGraphPin* GetBoolSuccessPin() const;
|
|
|
|
|
|
2014-10-27 13:10:00 -04:00
|
|
|
/**
|
|
|
|
|
* Will change the node's purity, and reallocate pins accordingly (adding/
|
|
|
|
|
* removing exec pins).
|
|
|
|
|
*
|
|
|
|
|
* @param bNewPurity The new value for bIsPureCast.
|
|
|
|
|
*/
|
|
|
|
|
void SetPurity(bool bNewPurity);
|
|
|
|
|
|
2014-09-02 19:08:09 -04:00
|
|
|
protected:
|
2014-10-27 13:10:00 -04:00
|
|
|
/** Flips the node's purity (adding/removing exec pins as needed). */
|
|
|
|
|
void TogglePurity();
|
|
|
|
|
|
2015-01-15 13:54:47 -05:00
|
|
|
/** Update exec pins when converting from impure to pure. */
|
|
|
|
|
bool ReconnectPureExecPins(TArray<UEdGraphPin*>& OldPins);
|
|
|
|
|
|
2014-09-02 19:08:09 -04:00
|
|
|
/** Constructing FText strings can be costly, so we cache the node's title */
|
|
|
|
|
FNodeTextCache CachedNodeTitle;
|
2014-10-27 13:10:00 -04:00
|
|
|
|
|
|
|
|
UPROPERTY()
|
|
|
|
|
bool bIsPureCast;
|
2014-03-14 14:13:41 -04:00
|
|
|
};
|
|
|
|
|
|