Files
UnrealEngineUWP/Engine/Source/Editor/BlueprintGraph/Classes/K2Node_DynamicCast.h
Mike Beach 4be3e2524c [UE-11455] Fixing up some Blueprint breaking issues that were caused by upgrading a project to 4.7/4.8
* Preventing variable object type changes from breaking pin connections (when the type was changed to a super type)
    * Turning "wasted cast" errors into node warnings.
    * ValidateVariableNames() now walks the whole super chain to look for conflicting property names
    * Added a warning to the SpawnActor node (to catch when users are passing a null class)

[CL 2527127 by Mike Beach in Main branch]
2015-04-27 12:55:58 -04:00

78 lines
3.0 KiB
C++

// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
#pragma once
#include "K2Node.h"
#include "EdGraph/EdGraphNodeUtils.h" // for FNodeTextCache
#include "K2Node_DynamicCast.generated.h"
UCLASS(MinimalAPI)
class UK2Node_DynamicCast : public UK2Node
{
GENERATED_UCLASS_BODY()
/** The type that the input should try to be cast to */
UPROPERTY()
TSubclassOf<class UObject> TargetType;
// Begin UEdGraphNode interface
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"); }
virtual void GetContextMenuActions(const FGraphNodeContextMenuBuilder& Context) const override;
virtual void PostReconstructNode() override;
virtual void PostPlacedNewNode() override;
// End UEdGraphNode interface
// UK2Node interface
virtual ERedirectType DoPinsMatchForReconstruction(const UEdGraphPin* NewPin, int32 NewPinIndex, const UEdGraphPin* OldPin, int32 OldPinIndex) const override;
virtual class FNodeHandlingFunctor* CreateNodeHandler(class FKismetCompilerContext& CompilerContext) const override;
virtual bool HasExternalDependencies(TArray<class UStruct*>* OptionalOutput) const override;
virtual FText GetMenuCategory() const override;
virtual FBlueprintNodeSignature GetSignature() const override;
virtual bool IsNodePure() const override { return bIsPureCast; }
virtual bool IsConnectionDisallowed(const UEdGraphPin* MyPin, const UEdGraphPin* OtherPin, FString& OutReason) const override;
virtual void NotifyPinConnectionListChanged(UEdGraphPin* Pin) override;
virtual void ReallocatePinsDuringReconstruction(TArray<UEdGraphPin*>& OldPins) override;
virtual void ValidateNodeDuringCompilation(class FCompilerResultsLog& MessageLog) const override;
// 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 */
BLUEPRINTGRAPH_API virtual UEdGraphPin* GetCastSourcePin() const;
/** Get the boolean output pin that signifies a successful/failed cast. */
BLUEPRINTGRAPH_API virtual UEdGraphPin* GetBoolSuccessPin() const;
/**
* 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);
protected:
/** Flips the node's purity (adding/removing exec pins as needed). */
void TogglePurity();
/** Update exec pins when converting from impure to pure. */
bool ReconnectPureExecPins(TArray<UEdGraphPin*>& OldPins);
/** Constructing FText strings can be costly, so we cache the node's title */
FNodeTextCache CachedNodeTitle;
UPROPERTY()
bool bIsPureCast;
};