Files
UnrealEngineUWP/Engine/Source/Editor/GraphEditor/Public/GraphEditorDragDropAction.h
Michael Noland 6046bb9cc9 Blueprints: Add reroute nodes to help organize wires
- Clean up FDragConnection construction and add a factory function in SGraphPin to extend it for some pins
- Clean up arguments to FOnGetContextMenuFor in SGraphPanel
- Various modifications to SGraphPin to permit implementation of wire knots/reroute nodes
#codereview nick.whiting

[CL 2074801 by Michael Noland in Main branch]
2014-05-15 17:34:14 -04:00

81 lines
3.2 KiB
C++

// Copyright 1998-2014 Epic Games, Inc. All Rights Reserved.
#pragma once
// Base class for drag-drop actions that pass into the graph editor and perform an action when dropped
class GRAPHEDITOR_API FGraphEditorDragDropAction : public FDragDropOperation
{
public:
DRAG_DROP_OPERATOR_TYPE(FGraphEditorDragDropAction, FDragDropOperation)
void SetHoveredPin(class UEdGraphPin* InPin);
void SetHoveredNode(const TSharedPtr<class SGraphNode>& InNode);
void SetHoveredGraph(const TSharedPtr<class SGraphPanel>& InGraph);
void SetHoveredCategoryName(const FString& InHoverCategoryName);
void SetHoveredAction(TSharedPtr<struct FEdGraphSchemaAction> Action);
// Interface to override
virtual void HoverTargetChanged() {}
virtual FReply DroppedOnPin(FVector2D ScreenPosition, FVector2D GraphPosition) { return FReply::Unhandled(); }
virtual FReply DroppedOnNode(FVector2D ScreenPosition, FVector2D GraphPosition) { return FReply::Unhandled(); }
virtual FReply DroppedOnPanel( const TSharedRef< class SWidget >& Panel, FVector2D ScreenPosition, FVector2D GraphPosition, UEdGraph& Graph) { return FReply::Unhandled(); }
virtual FReply DroppedOnAction(TSharedRef<struct FEdGraphSchemaAction> Action) { return FReply::Unhandled(); }
virtual FReply DroppedOnCategory(FString Category) { return FReply::Unhandled(); }
virtual void OnDragBegin(const TSharedRef<class SGraphPin>& InPin) {}
// End of interface to override
protected:
void SetFeedbackMessage(const TSharedPtr<SWidget>& Message);
void SetSimpleFeedbackMessage(const FSlateBrush* Icon, const FSlateColor& IconColor, const FText& Message);
UEdGraphPin* GetHoveredPin() const;
UEdGraphNode* GetHoveredNode() const;
UEdGraph* GetHoveredGraph() const;
/** Constructs the window and widget if applicable */
virtual void Construct();
private:
// The pin that the drag action is currently hovering over
TWeakObjectPtr<class UEdGraphPin> HoveredPin;
// The node that the drag action is currently hovering over
TSharedPtr<class SGraphNode> HoveredNode;
// The graph that the drag action is currently hovering over
TSharedPtr<class SGraphPanel> HoveredGraph;
protected:
// Name of category we are hovering over
FString HoveredCategoryName;
// Action we are hovering over
TWeakPtr<struct FEdGraphSchemaAction> HoveredAction;
};
// Drag-drop action where an FEdGraphSchemaAction should be performed when dropped
class GRAPHEDITOR_API FGraphSchemaActionDragDropAction : public FGraphEditorDragDropAction
{
public:
DRAG_DROP_OPERATOR_TYPE(FGraphSchemaActionDragDropAction, FGraphEditorDragDropAction)
// FGraphEditorDragDropAction interface
virtual void HoverTargetChanged() OVERRIDE;
virtual FReply DroppedOnPanel( const TSharedRef< class SWidget >& Panel, FVector2D ScreenPosition, FVector2D GraphPosition, UEdGraph& Graph) OVERRIDE;
// End of FGraphEditorDragDropAction
static TSharedRef<FGraphSchemaActionDragDropAction> New(TSharedPtr<FEdGraphSchemaAction> InActionNode )
{
TSharedRef<FGraphSchemaActionDragDropAction> Operation = MakeShareable(new FGraphSchemaActionDragDropAction);
Operation->ActionNode = InActionNode;
Operation->Construct();
return Operation;
}
protected:
/** */
TSharedPtr<FEdGraphSchemaAction> ActionNode;
};