2014-12-07 19:09:38 -05:00
|
|
|
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
|
Added a new documentation node to the blueprints to display udn documentation excerpts in the grapheditor.
#TTP 312311 - ROCKET: TASK: Add a "Documentation Node"
#Branch UE4
#Proj BlueprintGraph, EdGraph, Kismet, KismetCompiler, GraphEditor, Documentation, EditorStyle
#Change Updated UEdGraphSchema to include an interface call to retrieve an FEdGraphSchemaAction to create documentation nodes. At this point only the K2 interfaces implement this.
#Change Updated UEdGraphSchema_K2 to include a call to retrieve an FEdGraphSchemaAction to create documentation nodes. This is used to add the actions to the blueprint palette and context menus.
#Add Added FEdGraphSchemaAction_K2AddDocumentation in EdGraphSchema_K2_Actions.h/cpp to implement the calls in UEdGraphSchema to create documenation nodes from palette and context menus.
#Change Modified FK2ActionMenuBuilder to provide a static call to create a documentation action in the same style as the comment. Additionally added calls to FK2ActionMenuBuilder::GetPaletteActions and FK2ActionMenuBuilder::GetContextAllowedNodeTypes to call this to add entries in the palette and context menus.
#Add Added a new Brush GraphEditor.Documentation_16x, for the context menu icon in SlateEditorStyle.cpp.
#Change Modified GetPaletteItemIcon in SBlueprintPalette.cpp to return the new icon for the DocumentationNode
#Change Modified FKismetCompilerContext::IsNodePure to include the Documentaton node in the drop through ensure test to prevent asserts on compling if a documentation node is present.
#Change Added an entry for Documentation node in FNodeFactory::CreateNodeWidget.
#Change Modified IDocumentationPage interface to provide the ability to provide a TextWrapAt Attribute so this can be set before creating excerpt content if desired.
#Change Modified the UDNParser to control text wrap at values in the created widgets using a float Attribute WrapAt, Added a set call in the DocumentationPage and made the default behaviour mimic the code it replaced.
#Add Added the class UEdGraphNode_Documentation implemented in EdGraphNode_Documentation.h and UEdGraph.cpp, this is the UObject implementation for the documentation nodes.
#Add Added the class SGraphNodeDocumentation as the GraphPanel implementation of the EdGraphNode_Documentation.
#Change Moved the resizable code from SGraphNodeComment into a SGraphNodeResizable and changed SGraphNodeComment and SGraphNodeDocumentation inherit from it to avoid duplicating code.
#Change Added a documentation specific details customisation so the excerpts can be displayed as combo button.
#Change Added FBlueprintDocumentationDetails into BlueprintDetailsCustomization.h/cpp to handle the user interaction with the documentation node in the BP Editor.
ReviewedBy Chris.Wood, Mike.Beach
[CL 2247425 by Ben Cosh in Main branch]
2014-08-07 15:33:55 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "GraphEditorCommon.h"
|
|
|
|
|
#include "SGraphNodeResizable.h"
|
2014-10-03 16:16:40 -04:00
|
|
|
#include "ScopedTransaction.h"
|
Added a new documentation node to the blueprints to display udn documentation excerpts in the grapheditor.
#TTP 312311 - ROCKET: TASK: Add a "Documentation Node"
#Branch UE4
#Proj BlueprintGraph, EdGraph, Kismet, KismetCompiler, GraphEditor, Documentation, EditorStyle
#Change Updated UEdGraphSchema to include an interface call to retrieve an FEdGraphSchemaAction to create documentation nodes. At this point only the K2 interfaces implement this.
#Change Updated UEdGraphSchema_K2 to include a call to retrieve an FEdGraphSchemaAction to create documentation nodes. This is used to add the actions to the blueprint palette and context menus.
#Add Added FEdGraphSchemaAction_K2AddDocumentation in EdGraphSchema_K2_Actions.h/cpp to implement the calls in UEdGraphSchema to create documenation nodes from palette and context menus.
#Change Modified FK2ActionMenuBuilder to provide a static call to create a documentation action in the same style as the comment. Additionally added calls to FK2ActionMenuBuilder::GetPaletteActions and FK2ActionMenuBuilder::GetContextAllowedNodeTypes to call this to add entries in the palette and context menus.
#Add Added a new Brush GraphEditor.Documentation_16x, for the context menu icon in SlateEditorStyle.cpp.
#Change Modified GetPaletteItemIcon in SBlueprintPalette.cpp to return the new icon for the DocumentationNode
#Change Modified FKismetCompilerContext::IsNodePure to include the Documentaton node in the drop through ensure test to prevent asserts on compling if a documentation node is present.
#Change Added an entry for Documentation node in FNodeFactory::CreateNodeWidget.
#Change Modified IDocumentationPage interface to provide the ability to provide a TextWrapAt Attribute so this can be set before creating excerpt content if desired.
#Change Modified the UDNParser to control text wrap at values in the created widgets using a float Attribute WrapAt, Added a set call in the DocumentationPage and made the default behaviour mimic the code it replaced.
#Add Added the class UEdGraphNode_Documentation implemented in EdGraphNode_Documentation.h and UEdGraph.cpp, this is the UObject implementation for the documentation nodes.
#Add Added the class SGraphNodeDocumentation as the GraphPanel implementation of the EdGraphNode_Documentation.
#Change Moved the resizable code from SGraphNodeComment into a SGraphNodeResizable and changed SGraphNodeComment and SGraphNodeDocumentation inherit from it to avoid duplicating code.
#Change Added a documentation specific details customisation so the excerpts can be displayed as combo button.
#Change Added FBlueprintDocumentationDetails into BlueprintDetailsCustomization.h/cpp to handle the user interaction with the documentation node in the BP Editor.
ReviewedBy Chris.Wood, Mike.Beach
[CL 2247425 by Ben Cosh in Main branch]
2014-08-07 15:33:55 -04:00
|
|
|
|
|
|
|
|
namespace GraphNodeResizableDefs
|
|
|
|
|
{
|
|
|
|
|
/** Size of the hit result border for the window borders */
|
|
|
|
|
static const FSlateRect HitResultBorderSize( 10, 10, 10, 10 );
|
|
|
|
|
|
|
|
|
|
/** Default Title Bar Size */
|
|
|
|
|
static const float DefaultTitleBarHeight = 12.f;
|
|
|
|
|
|
|
|
|
|
/** Minimum size for node */
|
|
|
|
|
static const FVector2D MinNodeSize( 30.0f, 30.0f );
|
|
|
|
|
|
|
|
|
|
/** Maximum size for node */
|
|
|
|
|
static const FVector2D MaxNodeSize( 400.0f, 400.0f );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool SGraphNodeResizable::InSelectionArea(EResizableWindowZone InMouseZone) const
|
|
|
|
|
{
|
|
|
|
|
return ( (InMouseZone == CRWZ_RightBorder) || (InMouseZone == CRWZ_BottomBorder) || (InMouseZone == CRWZ_BottomRightBorder) ||
|
|
|
|
|
(InMouseZone == CRWZ_LeftBorder) || (InMouseZone == CRWZ_TopBorder) || (InMouseZone == CRWZ_TopLeftBorder) ||
|
|
|
|
|
(InMouseZone == CRWZ_TopRightBorder) || (InMouseZone == CRWZ_BottomLeftBorder) );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SGraphNodeResizable::OnMouseEnter( const FGeometry& MyGeometry, const FPointerEvent& MouseEvent )
|
|
|
|
|
{
|
|
|
|
|
// Determine the zone the mouse is in
|
|
|
|
|
if( !bUserIsDragging )
|
|
|
|
|
{
|
|
|
|
|
FVector2D LocalMouseCoordinates = MyGeometry.AbsoluteToLocal( MouseEvent.GetScreenSpacePosition() );
|
|
|
|
|
MouseZone = FindMouseZone(LocalMouseCoordinates);
|
2014-11-03 10:40:57 -05:00
|
|
|
SNodePanel::SNode::OnMouseEnter( MyGeometry, MouseEvent );
|
Added a new documentation node to the blueprints to display udn documentation excerpts in the grapheditor.
#TTP 312311 - ROCKET: TASK: Add a "Documentation Node"
#Branch UE4
#Proj BlueprintGraph, EdGraph, Kismet, KismetCompiler, GraphEditor, Documentation, EditorStyle
#Change Updated UEdGraphSchema to include an interface call to retrieve an FEdGraphSchemaAction to create documentation nodes. At this point only the K2 interfaces implement this.
#Change Updated UEdGraphSchema_K2 to include a call to retrieve an FEdGraphSchemaAction to create documentation nodes. This is used to add the actions to the blueprint palette and context menus.
#Add Added FEdGraphSchemaAction_K2AddDocumentation in EdGraphSchema_K2_Actions.h/cpp to implement the calls in UEdGraphSchema to create documenation nodes from palette and context menus.
#Change Modified FK2ActionMenuBuilder to provide a static call to create a documentation action in the same style as the comment. Additionally added calls to FK2ActionMenuBuilder::GetPaletteActions and FK2ActionMenuBuilder::GetContextAllowedNodeTypes to call this to add entries in the palette and context menus.
#Add Added a new Brush GraphEditor.Documentation_16x, for the context menu icon in SlateEditorStyle.cpp.
#Change Modified GetPaletteItemIcon in SBlueprintPalette.cpp to return the new icon for the DocumentationNode
#Change Modified FKismetCompilerContext::IsNodePure to include the Documentaton node in the drop through ensure test to prevent asserts on compling if a documentation node is present.
#Change Added an entry for Documentation node in FNodeFactory::CreateNodeWidget.
#Change Modified IDocumentationPage interface to provide the ability to provide a TextWrapAt Attribute so this can be set before creating excerpt content if desired.
#Change Modified the UDNParser to control text wrap at values in the created widgets using a float Attribute WrapAt, Added a set call in the DocumentationPage and made the default behaviour mimic the code it replaced.
#Add Added the class UEdGraphNode_Documentation implemented in EdGraphNode_Documentation.h and UEdGraph.cpp, this is the UObject implementation for the documentation nodes.
#Add Added the class SGraphNodeDocumentation as the GraphPanel implementation of the EdGraphNode_Documentation.
#Change Moved the resizable code from SGraphNodeComment into a SGraphNodeResizable and changed SGraphNodeComment and SGraphNodeDocumentation inherit from it to avoid duplicating code.
#Change Added a documentation specific details customisation so the excerpts can be displayed as combo button.
#Change Added FBlueprintDocumentationDetails into BlueprintDetailsCustomization.h/cpp to handle the user interaction with the documentation node in the BP Editor.
ReviewedBy Chris.Wood, Mike.Beach
[CL 2247425 by Ben Cosh in Main branch]
2014-08-07 15:33:55 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SGraphNodeResizable::OnMouseLeave( const FPointerEvent& MouseEvent )
|
|
|
|
|
{
|
|
|
|
|
if( !bUserIsDragging )
|
|
|
|
|
{
|
|
|
|
|
// Reset our mouse zone
|
|
|
|
|
MouseZone = CRWZ_NotInWindow;
|
2014-11-03 10:40:57 -05:00
|
|
|
SNodePanel::SNode::OnMouseLeave( MouseEvent );
|
Added a new documentation node to the blueprints to display udn documentation excerpts in the grapheditor.
#TTP 312311 - ROCKET: TASK: Add a "Documentation Node"
#Branch UE4
#Proj BlueprintGraph, EdGraph, Kismet, KismetCompiler, GraphEditor, Documentation, EditorStyle
#Change Updated UEdGraphSchema to include an interface call to retrieve an FEdGraphSchemaAction to create documentation nodes. At this point only the K2 interfaces implement this.
#Change Updated UEdGraphSchema_K2 to include a call to retrieve an FEdGraphSchemaAction to create documentation nodes. This is used to add the actions to the blueprint palette and context menus.
#Add Added FEdGraphSchemaAction_K2AddDocumentation in EdGraphSchema_K2_Actions.h/cpp to implement the calls in UEdGraphSchema to create documenation nodes from palette and context menus.
#Change Modified FK2ActionMenuBuilder to provide a static call to create a documentation action in the same style as the comment. Additionally added calls to FK2ActionMenuBuilder::GetPaletteActions and FK2ActionMenuBuilder::GetContextAllowedNodeTypes to call this to add entries in the palette and context menus.
#Add Added a new Brush GraphEditor.Documentation_16x, for the context menu icon in SlateEditorStyle.cpp.
#Change Modified GetPaletteItemIcon in SBlueprintPalette.cpp to return the new icon for the DocumentationNode
#Change Modified FKismetCompilerContext::IsNodePure to include the Documentaton node in the drop through ensure test to prevent asserts on compling if a documentation node is present.
#Change Added an entry for Documentation node in FNodeFactory::CreateNodeWidget.
#Change Modified IDocumentationPage interface to provide the ability to provide a TextWrapAt Attribute so this can be set before creating excerpt content if desired.
#Change Modified the UDNParser to control text wrap at values in the created widgets using a float Attribute WrapAt, Added a set call in the DocumentationPage and made the default behaviour mimic the code it replaced.
#Add Added the class UEdGraphNode_Documentation implemented in EdGraphNode_Documentation.h and UEdGraph.cpp, this is the UObject implementation for the documentation nodes.
#Add Added the class SGraphNodeDocumentation as the GraphPanel implementation of the EdGraphNode_Documentation.
#Change Moved the resizable code from SGraphNodeComment into a SGraphNodeResizable and changed SGraphNodeComment and SGraphNodeDocumentation inherit from it to avoid duplicating code.
#Change Added a documentation specific details customisation so the excerpts can be displayed as combo button.
#Change Added FBlueprintDocumentationDetails into BlueprintDetailsCustomization.h/cpp to handle the user interaction with the documentation node in the BP Editor.
ReviewedBy Chris.Wood, Mike.Beach
[CL 2247425 by Ben Cosh in Main branch]
2014-08-07 15:33:55 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FCursorReply SGraphNodeResizable::OnCursorQuery( const FGeometry& MyGeometry, const FPointerEvent& CursorEvent ) const
|
|
|
|
|
{
|
|
|
|
|
if (MouseZone == CRWZ_RightBorder || MouseZone == CRWZ_LeftBorder)
|
|
|
|
|
{
|
|
|
|
|
// right/left of node
|
|
|
|
|
return FCursorReply::Cursor(EMouseCursor::ResizeLeftRight);
|
|
|
|
|
}
|
|
|
|
|
else if (MouseZone == CRWZ_BottomRightBorder || MouseZone == CRWZ_TopLeftBorder)
|
|
|
|
|
{
|
|
|
|
|
// bottom right / top left hand corner
|
|
|
|
|
return FCursorReply::Cursor( EMouseCursor::ResizeSouthEast );
|
|
|
|
|
}
|
|
|
|
|
else if (MouseZone == CRWZ_BottomBorder || MouseZone == CRWZ_TopBorder)
|
|
|
|
|
{
|
|
|
|
|
// bottom / top of node
|
|
|
|
|
return FCursorReply::Cursor(EMouseCursor::ResizeUpDown);
|
|
|
|
|
}
|
|
|
|
|
else if (MouseZone == CRWZ_BottomLeftBorder || MouseZone == CRWZ_TopRightBorder)
|
|
|
|
|
{
|
|
|
|
|
// bottom left / top right hand corner
|
|
|
|
|
return FCursorReply::Cursor( EMouseCursor::ResizeSouthWest );
|
|
|
|
|
}
|
|
|
|
|
else if (MouseZone == CRWZ_TitleBar)
|
|
|
|
|
{
|
|
|
|
|
return FCursorReply::Cursor(EMouseCursor::CardinalCross);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return FCursorReply::Unhandled();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FReply SGraphNodeResizable::OnMouseButtonDown( const FGeometry& MyGeometry, const FPointerEvent& MouseEvent )
|
|
|
|
|
{
|
|
|
|
|
if ( InSelectionArea() && (MouseEvent.GetEffectingButton() == EKeys::LeftMouseButton) && IsEditable.Get() )
|
|
|
|
|
{
|
|
|
|
|
bUserIsDragging = true;
|
|
|
|
|
StoredUserSize = UserSize;
|
|
|
|
|
DragSize = UserSize;
|
|
|
|
|
//Find node anchor point
|
|
|
|
|
InitNodeAnchorPoint();
|
|
|
|
|
|
|
|
|
|
return FReply::Handled().CaptureMouse( SharedThis(this) );
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return FReply::Unhandled();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FReply SGraphNodeResizable::OnMouseButtonUp( const FGeometry& MyGeometry, const FPointerEvent& MouseEvent )
|
|
|
|
|
{
|
|
|
|
|
if ( (MouseEvent.GetEffectingButton() == EKeys::LeftMouseButton) && bUserIsDragging )
|
|
|
|
|
{
|
|
|
|
|
bUserIsDragging = false;
|
|
|
|
|
|
|
|
|
|
// Resize the node
|
|
|
|
|
UserSize.X = FMath::RoundToFloat(UserSize.X);
|
|
|
|
|
UserSize.Y = FMath::RoundToFloat(UserSize.Y);
|
|
|
|
|
|
|
|
|
|
GetNodeObj()->ResizeNode(UserSize);
|
2014-10-03 16:16:40 -04:00
|
|
|
|
|
|
|
|
// End resize transaction
|
|
|
|
|
ResizeTransactionPtr.Reset();
|
|
|
|
|
|
Added a new documentation node to the blueprints to display udn documentation excerpts in the grapheditor.
#TTP 312311 - ROCKET: TASK: Add a "Documentation Node"
#Branch UE4
#Proj BlueprintGraph, EdGraph, Kismet, KismetCompiler, GraphEditor, Documentation, EditorStyle
#Change Updated UEdGraphSchema to include an interface call to retrieve an FEdGraphSchemaAction to create documentation nodes. At this point only the K2 interfaces implement this.
#Change Updated UEdGraphSchema_K2 to include a call to retrieve an FEdGraphSchemaAction to create documentation nodes. This is used to add the actions to the blueprint palette and context menus.
#Add Added FEdGraphSchemaAction_K2AddDocumentation in EdGraphSchema_K2_Actions.h/cpp to implement the calls in UEdGraphSchema to create documenation nodes from palette and context menus.
#Change Modified FK2ActionMenuBuilder to provide a static call to create a documentation action in the same style as the comment. Additionally added calls to FK2ActionMenuBuilder::GetPaletteActions and FK2ActionMenuBuilder::GetContextAllowedNodeTypes to call this to add entries in the palette and context menus.
#Add Added a new Brush GraphEditor.Documentation_16x, for the context menu icon in SlateEditorStyle.cpp.
#Change Modified GetPaletteItemIcon in SBlueprintPalette.cpp to return the new icon for the DocumentationNode
#Change Modified FKismetCompilerContext::IsNodePure to include the Documentaton node in the drop through ensure test to prevent asserts on compling if a documentation node is present.
#Change Added an entry for Documentation node in FNodeFactory::CreateNodeWidget.
#Change Modified IDocumentationPage interface to provide the ability to provide a TextWrapAt Attribute so this can be set before creating excerpt content if desired.
#Change Modified the UDNParser to control text wrap at values in the created widgets using a float Attribute WrapAt, Added a set call in the DocumentationPage and made the default behaviour mimic the code it replaced.
#Add Added the class UEdGraphNode_Documentation implemented in EdGraphNode_Documentation.h and UEdGraph.cpp, this is the UObject implementation for the documentation nodes.
#Add Added the class SGraphNodeDocumentation as the GraphPanel implementation of the EdGraphNode_Documentation.
#Change Moved the resizable code from SGraphNodeComment into a SGraphNodeResizable and changed SGraphNodeComment and SGraphNodeDocumentation inherit from it to avoid duplicating code.
#Change Added a documentation specific details customisation so the excerpts can be displayed as combo button.
#Change Added FBlueprintDocumentationDetails into BlueprintDetailsCustomization.h/cpp to handle the user interaction with the documentation node in the BP Editor.
ReviewedBy Chris.Wood, Mike.Beach
[CL 2247425 by Ben Cosh in Main branch]
2014-08-07 15:33:55 -04:00
|
|
|
return FReply::Handled().ReleaseMouseCapture();
|
|
|
|
|
}
|
|
|
|
|
return FReply::Unhandled();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FReply SGraphNodeResizable::OnMouseMove(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent)
|
|
|
|
|
{
|
|
|
|
|
FVector2D LocalMouseCoordinates = MyGeometry.AbsoluteToLocal( MouseEvent.GetScreenSpacePosition() );
|
|
|
|
|
|
|
|
|
|
if (bUserIsDragging)
|
|
|
|
|
{
|
|
|
|
|
FVector2D GraphSpaceCoordinates = NodeCoordToGraphCoord( MouseEvent.GetScreenSpacePosition() );
|
|
|
|
|
FVector2D OldGraphSpaceCoordinates = NodeCoordToGraphCoord( MouseEvent.GetLastScreenSpacePosition() );
|
|
|
|
|
FVector2D Delta = GraphSpaceCoordinates - OldGraphSpaceCoordinates;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Clamp delta value based on resizing direction
|
|
|
|
|
if( MouseZone == CRWZ_LeftBorder || MouseZone == CRWZ_RightBorder )
|
|
|
|
|
{
|
|
|
|
|
Delta.Y = 0.0f;
|
|
|
|
|
}
|
|
|
|
|
else if( MouseZone == CRWZ_TopBorder || MouseZone == CRWZ_BottomBorder )
|
|
|
|
|
{
|
|
|
|
|
Delta.X = 0.0f;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//Resize node delta value
|
|
|
|
|
FVector2D DeltaNodeSize = Delta;
|
|
|
|
|
|
|
|
|
|
//Modify node size delta value based on resizing direction
|
|
|
|
|
if( (MouseZone == CRWZ_LeftBorder) || (MouseZone == CRWZ_TopBorder) || (MouseZone == CRWZ_TopLeftBorder) )
|
|
|
|
|
{
|
|
|
|
|
DeltaNodeSize = -DeltaNodeSize;
|
|
|
|
|
}
|
|
|
|
|
else if( MouseZone == CRWZ_TopRightBorder )
|
|
|
|
|
{
|
|
|
|
|
DeltaNodeSize.Y = -DeltaNodeSize.Y;
|
|
|
|
|
}
|
|
|
|
|
else if( MouseZone == CRWZ_BottomLeftBorder )
|
|
|
|
|
{
|
|
|
|
|
DeltaNodeSize.X = -DeltaNodeSize.X;
|
|
|
|
|
}
|
|
|
|
|
// Apply delta unfiltered to DragSize
|
|
|
|
|
DragSize.X += DeltaNodeSize.X;
|
|
|
|
|
DragSize.Y += DeltaNodeSize.Y;
|
|
|
|
|
// apply snap
|
|
|
|
|
const float SnapSize = SNodePanel::GetSnapGridSize();
|
|
|
|
|
FVector2D SnappedSize;
|
|
|
|
|
SnappedSize.X = SnapSize * FMath::RoundToFloat( DragSize.X/SnapSize );
|
|
|
|
|
SnappedSize.Y = SnapSize * FMath::RoundToFloat( DragSize.Y/SnapSize );
|
|
|
|
|
|
|
|
|
|
// Enforce min/max sizing
|
|
|
|
|
const FVector2D MinSize = GetNodeMinimumSize();
|
|
|
|
|
SnappedSize.X = FMath::Max( SnappedSize.X, MinSize.X );
|
|
|
|
|
SnappedSize.Y = FMath::Max( SnappedSize.Y, MinSize.Y );
|
|
|
|
|
|
|
|
|
|
const FVector2D MaxSize = GetNodeMaximumSize();
|
|
|
|
|
SnappedSize.X = FMath::Min( SnappedSize.X, MaxSize.X );
|
|
|
|
|
SnappedSize.Y = FMath::Min( SnappedSize.Y, MaxSize.Y );
|
|
|
|
|
|
|
|
|
|
FVector2D DeltaNodePos(0,0);
|
|
|
|
|
|
|
|
|
|
if( UserSize != SnappedSize )
|
|
|
|
|
{
|
|
|
|
|
//Modify node position (resizing top and left sides)
|
|
|
|
|
if( MouseZone != CRWZ_BottomBorder && MouseZone != CRWZ_RightBorder && MouseZone != CRWZ_BottomRightBorder )
|
|
|
|
|
{
|
|
|
|
|
//Delta value to move graph node position
|
|
|
|
|
DeltaNodePos = UserSize - SnappedSize;
|
|
|
|
|
|
|
|
|
|
//Clamp position delta based on resizing direction
|
|
|
|
|
if( MouseZone == CRWZ_BottomLeftBorder )
|
|
|
|
|
{
|
|
|
|
|
DeltaNodePos.Y = 0.0f;
|
|
|
|
|
}
|
|
|
|
|
else if( MouseZone == CRWZ_TopRightBorder )
|
|
|
|
|
{
|
|
|
|
|
DeltaNodePos.X = 0.0f;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
UserSize = SnappedSize;
|
|
|
|
|
GraphNode->ResizeNode( UserSize );
|
|
|
|
|
DeltaNodePos = GetCorrectedNodePosition() - GetPosition();
|
|
|
|
|
}
|
2014-10-03 16:16:40 -04:00
|
|
|
|
|
|
|
|
if (!ResizeTransactionPtr.IsValid() && UserSize != StoredUserSize)
|
|
|
|
|
{
|
|
|
|
|
// Start resize transaction. The transaction is started here so all MoveTo actions are captured while empty
|
|
|
|
|
// transactions are not created
|
|
|
|
|
ResizeTransactionPtr = MakeShareable(new FScopedTransaction(NSLOCTEXT("GraphEditor", "ResizeNodeAction", "Resize Node")));
|
|
|
|
|
}
|
|
|
|
|
|
Added a new documentation node to the blueprints to display udn documentation excerpts in the grapheditor.
#TTP 312311 - ROCKET: TASK: Add a "Documentation Node"
#Branch UE4
#Proj BlueprintGraph, EdGraph, Kismet, KismetCompiler, GraphEditor, Documentation, EditorStyle
#Change Updated UEdGraphSchema to include an interface call to retrieve an FEdGraphSchemaAction to create documentation nodes. At this point only the K2 interfaces implement this.
#Change Updated UEdGraphSchema_K2 to include a call to retrieve an FEdGraphSchemaAction to create documentation nodes. This is used to add the actions to the blueprint palette and context menus.
#Add Added FEdGraphSchemaAction_K2AddDocumentation in EdGraphSchema_K2_Actions.h/cpp to implement the calls in UEdGraphSchema to create documenation nodes from palette and context menus.
#Change Modified FK2ActionMenuBuilder to provide a static call to create a documentation action in the same style as the comment. Additionally added calls to FK2ActionMenuBuilder::GetPaletteActions and FK2ActionMenuBuilder::GetContextAllowedNodeTypes to call this to add entries in the palette and context menus.
#Add Added a new Brush GraphEditor.Documentation_16x, for the context menu icon in SlateEditorStyle.cpp.
#Change Modified GetPaletteItemIcon in SBlueprintPalette.cpp to return the new icon for the DocumentationNode
#Change Modified FKismetCompilerContext::IsNodePure to include the Documentaton node in the drop through ensure test to prevent asserts on compling if a documentation node is present.
#Change Added an entry for Documentation node in FNodeFactory::CreateNodeWidget.
#Change Modified IDocumentationPage interface to provide the ability to provide a TextWrapAt Attribute so this can be set before creating excerpt content if desired.
#Change Modified the UDNParser to control text wrap at values in the created widgets using a float Attribute WrapAt, Added a set call in the DocumentationPage and made the default behaviour mimic the code it replaced.
#Add Added the class UEdGraphNode_Documentation implemented in EdGraphNode_Documentation.h and UEdGraph.cpp, this is the UObject implementation for the documentation nodes.
#Add Added the class SGraphNodeDocumentation as the GraphPanel implementation of the EdGraphNode_Documentation.
#Change Moved the resizable code from SGraphNodeComment into a SGraphNodeResizable and changed SGraphNodeComment and SGraphNodeDocumentation inherit from it to avoid duplicating code.
#Change Added a documentation specific details customisation so the excerpts can be displayed as combo button.
#Change Added FBlueprintDocumentationDetails into BlueprintDetailsCustomization.h/cpp to handle the user interaction with the documentation node in the BP Editor.
ReviewedBy Chris.Wood, Mike.Beach
[CL 2247425 by Ben Cosh in Main branch]
2014-08-07 15:33:55 -04:00
|
|
|
SGraphNode::FNodeSet NodeFilter;
|
|
|
|
|
SGraphNode::MoveTo( GetPosition() + DeltaNodePos, NodeFilter );
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
MouseZone = FindMouseZone(LocalMouseCoordinates);
|
|
|
|
|
}
|
|
|
|
|
return SGraphNode::OnMouseMove( MyGeometry, MouseEvent );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SGraphNodeResizable::InitNodeAnchorPoint()
|
|
|
|
|
{
|
|
|
|
|
NodeAnchorPoint = GetPosition();
|
|
|
|
|
|
|
|
|
|
if( (MouseZone == CRWZ_LeftBorder) || (MouseZone == CRWZ_TopBorder) || (MouseZone == CRWZ_TopLeftBorder) )
|
|
|
|
|
{
|
|
|
|
|
NodeAnchorPoint += UserSize;
|
|
|
|
|
}
|
|
|
|
|
else if( MouseZone == CRWZ_BottomLeftBorder )
|
|
|
|
|
{
|
|
|
|
|
NodeAnchorPoint.X += UserSize.X;
|
|
|
|
|
}
|
|
|
|
|
else if( MouseZone == CRWZ_TopRightBorder )
|
|
|
|
|
{
|
|
|
|
|
NodeAnchorPoint.Y += UserSize.Y;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FVector2D SGraphNodeResizable::GetCorrectedNodePosition() const
|
|
|
|
|
{
|
|
|
|
|
FVector2D CorrectedPos = NodeAnchorPoint;
|
|
|
|
|
|
|
|
|
|
if( (MouseZone == CRWZ_LeftBorder) || (MouseZone == CRWZ_TopBorder) || (MouseZone == CRWZ_TopLeftBorder) )
|
|
|
|
|
{
|
|
|
|
|
CorrectedPos -= UserSize;
|
|
|
|
|
}
|
|
|
|
|
else if( MouseZone == CRWZ_BottomLeftBorder )
|
|
|
|
|
{
|
|
|
|
|
CorrectedPos.X -= UserSize.X;
|
|
|
|
|
}
|
|
|
|
|
else if( MouseZone == CRWZ_TopRightBorder )
|
|
|
|
|
{
|
|
|
|
|
CorrectedPos.Y -= UserSize.Y;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return CorrectedPos;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SGraphNodeResizable::EResizableWindowZone SGraphNodeResizable::FindMouseZone(const FVector2D& LocalMouseCoordinates) const
|
|
|
|
|
{
|
|
|
|
|
EResizableWindowZone OutMouseZone = CRWZ_NotInWindow;
|
|
|
|
|
|
|
|
|
|
const float InverseZoomFactor = 1.0f / FMath::Min(GetOwnerPanel()->GetZoomAmount(), 1.0f);
|
|
|
|
|
const FSlateRect HitResultBorderSize = GetHitTestingBorder( InverseZoomFactor );
|
|
|
|
|
|
|
|
|
|
const FVector2D NodeSize = GetDesiredSize();
|
|
|
|
|
// Test for hit in location of 'grab' zone
|
|
|
|
|
if (LocalMouseCoordinates.Y > ( NodeSize.Y - HitResultBorderSize.Bottom))
|
|
|
|
|
{
|
|
|
|
|
OutMouseZone = CRWZ_BottomBorder;
|
|
|
|
|
}
|
|
|
|
|
else if (LocalMouseCoordinates.Y <= (HitResultBorderSize.Top))
|
|
|
|
|
{
|
|
|
|
|
OutMouseZone = CRWZ_TopBorder;
|
|
|
|
|
}
|
|
|
|
|
else if (LocalMouseCoordinates.Y <= (HitResultBorderSize.Top + GetTitleBarHeight()))
|
|
|
|
|
{
|
|
|
|
|
OutMouseZone = CRWZ_TitleBar;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (LocalMouseCoordinates.X > (NodeSize.X - HitResultBorderSize.Right))
|
|
|
|
|
{
|
|
|
|
|
if (OutMouseZone == CRWZ_BottomBorder)
|
|
|
|
|
{
|
|
|
|
|
OutMouseZone = CRWZ_BottomRightBorder;
|
|
|
|
|
}
|
|
|
|
|
else if (OutMouseZone == CRWZ_TopBorder)
|
|
|
|
|
{
|
|
|
|
|
OutMouseZone = CRWZ_TopRightBorder;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
OutMouseZone = CRWZ_RightBorder;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (LocalMouseCoordinates.X <= HitResultBorderSize.Left)
|
|
|
|
|
{
|
|
|
|
|
if (OutMouseZone == CRWZ_TopBorder)
|
|
|
|
|
{
|
|
|
|
|
OutMouseZone = CRWZ_TopLeftBorder;
|
|
|
|
|
}
|
|
|
|
|
else if (OutMouseZone == CRWZ_BottomBorder)
|
|
|
|
|
{
|
|
|
|
|
OutMouseZone = CRWZ_BottomLeftBorder;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
OutMouseZone = CRWZ_LeftBorder;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Test for hit on rest of frame
|
|
|
|
|
if (OutMouseZone == CRWZ_NotInWindow)
|
|
|
|
|
{
|
|
|
|
|
if (LocalMouseCoordinates.Y > HitResultBorderSize.Top)
|
|
|
|
|
{
|
|
|
|
|
OutMouseZone = CRWZ_InWindow;
|
|
|
|
|
}
|
|
|
|
|
else if (LocalMouseCoordinates.X > HitResultBorderSize.Left)
|
|
|
|
|
{
|
|
|
|
|
OutMouseZone = CRWZ_InWindow;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return OutMouseZone;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
float SGraphNodeResizable::GetTitleBarHeight() const
|
|
|
|
|
{
|
|
|
|
|
// this can probably just be SGraphNode::GetTitleRect().Height()
|
|
|
|
|
return GraphNodeResizableDefs::DefaultTitleBarHeight;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FVector2D SGraphNodeResizable::GetNodeMinimumSize() const
|
|
|
|
|
{
|
|
|
|
|
return GraphNodeResizableDefs::MinNodeSize;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FVector2D SGraphNodeResizable::GetNodeMaximumSize() const
|
|
|
|
|
{
|
|
|
|
|
return GraphNodeResizableDefs::MaxNodeSize;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FSlateRect SGraphNodeResizable::GetHitTestingBorder(float InverseZoomFactor) const
|
|
|
|
|
{
|
|
|
|
|
return FSlateRect( GraphNodeResizableDefs::HitResultBorderSize.Left * InverseZoomFactor,
|
|
|
|
|
GraphNodeResizableDefs::HitResultBorderSize.Top * InverseZoomFactor,
|
|
|
|
|
GraphNodeResizableDefs::HitResultBorderSize.Right * InverseZoomFactor,
|
|
|
|
|
GraphNodeResizableDefs::HitResultBorderSize.Bottom * InverseZoomFactor );
|
|
|
|
|
}
|