// Copyright Epic Games, Inc. All Rights Reserved. #pragma once #include "BlueprintEditor.h" #include "Containers/UnrealString.h" #include "Delegates/Delegate.h" #include "Engine/MemberReference.h" #include "Input/DragAndDrop.h" #include "Input/Reply.h" #include "Math/Vector2D.h" #include "MyBlueprintItemDragDropAction.h" #include "Templates/SharedPointer.h" #include "UObject/NameTypes.h" class FText; class UBlueprint; class UClass; class UEdGraph; class UFunction; struct FEdGraphSchemaAction; /******************************************************************************* * FKismetDragDropAction *******************************************************************************/ class KISMET_API FKismetDragDropAction : public FMyBlueprintItemDragDropAction { public: DRAG_DROP_OPERATOR_TYPE(FKismetDragDropAction, FMyBlueprintItemDragDropAction) // FGraphEditorDragDropAction interface virtual void HoverTargetChanged() override; virtual FReply DroppedOnPanel( const TSharedRef< class SWidget >& Panel, const FVector2f& ScreenPosition, const FVector2f& GraphPosition, UEdGraph& Graph) override; // End of FGraphSchemaActionDragDropAction DECLARE_DELEGATE_RetVal_ThreeParams(bool, FCanBeDroppedDelegate, TSharedPtr /*DropAction*/, UEdGraph* /*HoveredGraphIn*/, FText& /*ImpededReasonOut*/); static TSharedRef New(TSharedPtr InActionNode, FNodeCreationAnalytic AnalyticCallback, FCanBeDroppedDelegate CanBeDroppedDelegate) { TSharedRef Operation = MakeShareable(new FKismetDragDropAction); Operation->SourceAction = InActionNode; Operation->AnalyticCallback = AnalyticCallback; Operation->CanBeDroppedDelegate = CanBeDroppedDelegate; Operation->Construct(); return Operation; } protected: bool ActionWillShowExistingNode() const; /** */ FCanBeDroppedDelegate CanBeDroppedDelegate; }; /******************************************************************************* * FKismetFunctionDragDropAction *******************************************************************************/ class KISMET_API FKismetFunctionDragDropAction : public FKismetDragDropAction { public: DRAG_DROP_OPERATOR_TYPE(FKismetFunctionDragDropAction, FKismetDragDropAction) FKismetFunctionDragDropAction(); // FGraphEditorDragDropAction interface virtual FReply DroppedOnPanel( const TSharedRef< class SWidget >& Panel, const FVector2f& ScreenPosition, const FVector2f& GraphPosition, UEdGraph& Graph) override; virtual FReply DroppedOnPin(const FVector2f& ScreenPosition, const FVector2f& GraphPosition) override; // End of FGraphEditorDragDropAction static TSharedRef New(TSharedPtr InActionNode, FName InFunctionName, UClass* InOwningClass, const FMemberReference& InCallOnMember, FNodeCreationAnalytic AnalyticCallback, FCanBeDroppedDelegate CanBeDroppedDelegate = FCanBeDroppedDelegate()); protected: /** Name of function being dragged */ FName FunctionName; /** Class that function belongs to */ UClass* OwningClass; /** Call on member reference */ FMemberReference CallOnMember; /** Looks up the functions field on OwningClass using FunctionName */ UFunction const* GetFunctionProperty() const; /** Constructs an action to execute, placing a function call node for the associated function */ class UBlueprintFunctionNodeSpawner* GetDropAction(UEdGraph& Graph) const; }; /******************************************************************************* * FKismetMacroDragDropAction *******************************************************************************/ class KISMET_API FKismetMacroDragDropAction : public FKismetDragDropAction { public: DRAG_DROP_OPERATOR_TYPE(FKismetMacroDragDropAction, FKismetDragDropAction) FKismetMacroDragDropAction(); // FGraphEditorDragDropAction interface virtual FReply DroppedOnPanel( const TSharedRef< class SWidget >& Panel, const FVector2f& ScreenPosition, const FVector2f& GraphPosition, UEdGraph& Graph) override; // End of FGraphEditorDragDropAction static TSharedRef New(TSharedPtr InActionNode, FName InMacroName, UBlueprint* InBlueprint, UEdGraph* InMacro, FNodeCreationAnalytic AnalyticCallback); protected: // FMyBlueprintItemDragDropAction interface virtual UBlueprint* GetSourceBlueprint() const override { return Blueprint; } // End of FMyBlueprintItemDragDropAction interface protected: /** Name of macro being dragged */ FName MacroName; /** Graph for the macro being dragged */ UEdGraph* Macro; /** Blueprint we are operating on */ UBlueprint* Blueprint; };