A Demo Project for the UnrealEngineSDK
Loading...
Searching...
No Matches
NewComment_DialogueGraphSchemaAction.cpp
Go to the documentation of this file.
1// Copyright Csaba Molnar, Daniel Butum. All Rights Reserved.
3
4#include "EdGraphNode_Comment.h"
5
7
8#define LOCTEXT_NAMESPACE "NewComment_DialogueGraphSchemaAction"
9
11// FNewComment_DialogueGraphSchemaAction
13 const FVector2D Location, bool bSelectNewNode/* = true*/)
14{
15 // Add menu item for creating comment boxes
16 UEdGraphNode_Comment* CommentTemplate = NewObject<UEdGraphNode_Comment>();
17
18 // Wrap comment around other nodes, this makes it possible to select other nodes and press the "C" key on the keyboard.
19 FVector2D SpawnLocation = Location;
20 FSlateRect Bounds;
21 if (FDialogueEditorUtilities::GetBoundsForSelectedNodes(ParentGraph, Bounds, 50.0f))
22 {
23 CommentTemplate->SetBounds(Bounds);
24 SpawnLocation.X = CommentTemplate->NodePosX;
25 SpawnLocation.Y = CommentTemplate->NodePosY;
26 }
27
28 return FEdGraphSchemaAction_NewNode::SpawnNodeFromTemplate<UEdGraphNode_Comment>(ParentGraph, CommentTemplate, SpawnLocation, bSelectNewNode);
29}
30
31#undef LOCTEXT_NAMESPACE
static bool GetBoundsForSelectedNodes(const UEdGraph *Graph, FSlateRect &Rect, float Padding=0.0f)
UEdGraphNode * PerformAction(UEdGraph *ParentGraph, UEdGraphPin *FromPin, const FVector2D Location, bool bSelectNewNode=true) override