Files

342 lines
9.7 KiB
C++
Raw Permalink Normal View History

// Copyright 1998-2019 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 "SGraphNodeResizable.h"
#include "ScopedTransaction.h"
#include "Framework/Application/SlateApplication.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);
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;
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);
// 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)
{
if (bUserIsDragging)
{
FVector2D GraphSpaceCoordinates = NodeCoordToGraphCoord( MouseEvent.GetScreenSpacePosition() );
FVector2D OldGraphSpaceCoordinates = NodeCoordToGraphCoord( MouseEvent.GetLastScreenSpacePosition() );
TSharedPtr<SWindow> OwnerWindow = FSlateApplication::Get().FindWidgetWindow(AsShared());
FVector2D Delta = (GraphSpaceCoordinates - OldGraphSpaceCoordinates) / (OwnerWindow.IsValid() ? OwnerWindow->GetDPIScaleFactor() : 1.0f);
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
//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();
}
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
{
const FVector2D LocalMouseCoordinates = MyGeometry.AbsoluteToLocal( MouseEvent.GetScreenSpacePosition() );
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
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 FSlateRect HitResultBorderSize = GetHitTestingBorder();
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
const FVector2D NodeSize = GetDesiredSize();
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
// 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 <= GetTitleBarHeight())
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
{
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() const
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 GraphNodeResizableDefs::HitResultBorderSize;
Copying //UE4/Dev-Build to //UE4/Dev-Main (Source: //UE4/Dev-Build @ 3209340) #lockdown Nick.Penwarden #rb none ========================== MAJOR FEATURES + CHANGES ========================== Change 3209340 on 2016/11/23 by Ben.Marsh Convert UE4 codebase to an "include what you use" model - where every header just includes the dependencies it needs, rather than every source file including large monolithic headers like Engine.h and UnrealEd.h. Measured full rebuild times around 2x faster using XGE on Windows, and improvements of 25% or more for incremental builds and full rebuilds on most other platforms. * Every header now includes everything it needs to compile. * There's a CoreMinimal.h header that gets you a set of ubiquitous types from Core (eg. FString, FName, TArray, FVector, etc...). Most headers now include this first. * There's a CoreTypes.h header that sets up primitive UE4 types and build macros (int32, PLATFORM_WIN64, etc...). All headers in Core include this first, as does CoreMinimal.h. * Every .cpp file includes its matching .h file first. * This helps validate that each header is including everything it needs to compile. * No engine code includes a monolithic header such as Engine.h or UnrealEd.h any more. * You will get a warning if you try to include one of these from the engine. They still exist for compatibility with game projects and do not produce warnings when included there. * There have only been minor changes to our internal games down to accommodate these changes. The intent is for this to be as seamless as possible. * No engine code explicitly includes a precompiled header any more. * We still use PCHs, but they're force-included on the compiler command line by UnrealBuildTool instead. This lets us tune what they contain without breaking any existing include dependencies. * PCHs are generated by a tool to get a statistical amount of coverage for the source files using it, and I've seeded the new shared PCHs to contain any header included by > 15% of source files. Tool used to generate this transform is at Engine\Source\Programs\IncludeTool. [CL 3209342 by Ben Marsh in Main branch]
2016-11-23 15:48:37 -05:00
}