2014-12-07 19:09:38 -05:00
|
|
|
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
|
2014-03-14 14:13:41 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "GraphEditorCommon.h"
|
|
|
|
|
#include "SGraphNodeComment.h"
|
|
|
|
|
//#include "TextWrapperHelpers.h"
|
2014-08-14 07:02:37 -04:00
|
|
|
#include "BlueprintEditorUtils.h"
|
2014-09-05 07:39:52 -04:00
|
|
|
#include "TutorialMetaData.h"
|
2014-10-14 22:50:06 -04:00
|
|
|
#include "SInlineEditableTextBlock.h"
|
2014-03-14 14:13:41 -04:00
|
|
|
|
|
|
|
|
namespace SCommentNodeDefs
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
/** Size of the hit result border for the window borders */
|
|
|
|
|
/* L, T, R, B */
|
|
|
|
|
static const FSlateRect HitResultBorderSize(10,10,10,10);
|
|
|
|
|
|
|
|
|
|
/** Minimum resize width for comment */
|
|
|
|
|
static const float MinWidth = 30.0;
|
|
|
|
|
|
|
|
|
|
/** Minimum resize height for comment */
|
|
|
|
|
static const float MinHeight = 30.0;
|
|
|
|
|
|
2015-04-28 04:58:34 -04:00
|
|
|
/** TitleBarColor = CommentColor * TitleBarColorMultiplier */
|
2014-03-14 14:13:41 -04:00
|
|
|
static const float TitleBarColorMultiplier = 0.6f;
|
|
|
|
|
|
|
|
|
|
/** Titlebar Offset - taken from the widget borders in UpdateGraphNode */
|
|
|
|
|
static const FSlateRect TitleBarOffset(13,8,-3,0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void SGraphNodeComment::Construct(const FArguments& InArgs, UEdGraphNode* InNode)
|
|
|
|
|
{
|
|
|
|
|
this->GraphNode = InNode;
|
|
|
|
|
this->bIsSelected = false;
|
|
|
|
|
|
|
|
|
|
// Set up animation
|
|
|
|
|
{
|
|
|
|
|
ZoomCurve = SpawnAnim.AddCurve(0, 0.1f);
|
|
|
|
|
FadeCurve = SpawnAnim.AddCurve(0.15f, 0.15f);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Cache these values so they do not force a re-build of the node next tick.
|
|
|
|
|
CachedCommentTitle = GetNodeComment();
|
|
|
|
|
CachedWidth = InNode->NodeWidth;
|
|
|
|
|
|
|
|
|
|
this->UpdateGraphNode();
|
|
|
|
|
|
|
|
|
|
// Pull out sizes
|
|
|
|
|
UserSize.X = InNode->NodeWidth;
|
|
|
|
|
UserSize.Y = InNode->NodeHeight;
|
|
|
|
|
|
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 = CRWZ_NotInWindow;
|
2014-03-14 14:13:41 -04:00
|
|
|
bUserIsDragging = false;
|
|
|
|
|
}
|
|
|
|
|
|
---- Merging with SlateDev branch ----
Introduces the concept of "Active Ticking" to allow Slate to go to sleep when there is no need to update the UI.
While asleep, Slate will skip the Tick & Paint pass for that frame entirely.
- There are TWO ways to "wake" Slate and cause a Tick/Paint pass:
1. Provide some sort of input (mouse movement, clicks, and key presses). Slate will always tick when the user is active.
- Therefore, if the logic in a given widget's Tick is only relevant in response to user action, there is no need to register an active tick.
2. Register an Active Tick. Currently this is an all-or-nothing situation, so if a single active tick needs to execute, all of Slate will be ticked.
- The purpose of an Active Tick is to allow a widget to "drive" Slate and guarantee a Tick/Paint pass in the absence of any user action.
- Examples include animation, async operations that update periodically, progress updates, loading bars, etc.
- An empty active tick is registered for viewports when they are real-time, so game project widgets are unaffected by this change and should continue to work as before.
- An Active Tick is registered by creating an FWidgetActiveTickDelegate and passing it to SWidget::RegisterActiveTick()
- There are THREE ways to unregister an active tick:
1. Return EActiveTickReturnType::StopTicking from the active tick function
2. Pass the FActiveTickHandle returned by RegisterActiveTick() to SWidget::UnregisterActiveTick()
3. Destroy the widget responsible for the active tick
- Sleeping is currently disabled, can be enabled with Slate.AllowSlateToSleep cvar
- There is currently a little buffer time during which Slate continues to tick following any input. Long-term, this is planned to be removed.
- The duration of the buffer can be adjusted using Slate.SleepBufferPostInput cvar (defaults to 1.0f)
- The FCurveSequence API has been updated to work with the active tick system
- Playing a curve sequence now requires that you pass the widget being animated by the sequence
- The active tick will automatically be registered on behalf of the widget and unregister when the sequence is complete
- GetLerpLooping() has been removed. Instead, pass true as the second param to Play() to indicate that the animation will loop. This causes the active tick to be registered indefinitely until paused or jumped to the start/end.
[CL 2391669 by Dan Hertzka in Main branch]
2014-12-17 16:07:57 -05:00
|
|
|
void SGraphNodeComment::Tick( const FGeometry& AllottedGeometry, const double InCurrentTime, const float InDeltaTime )
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
|
|
|
|
SGraphNode::Tick(AllottedGeometry, InCurrentTime, InDeltaTime);
|
|
|
|
|
|
|
|
|
|
const FString CurrentCommentTitle = GetNodeComment();
|
2015-02-17 12:27:10 -05:00
|
|
|
if (CurrentCommentTitle != CachedCommentTitle)
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
|
|
|
|
CachedCommentTitle = CurrentCommentTitle;
|
2015-02-17 12:27:10 -05:00
|
|
|
}
|
2014-03-14 14:13:41 -04:00
|
|
|
|
2015-02-17 12:27:10 -05:00
|
|
|
const int32 CurrentWidth = static_cast<int32>(UserSize.X);
|
|
|
|
|
if (CurrentWidth != CachedWidth)
|
|
|
|
|
{
|
|
|
|
|
CachedWidth = CurrentWidth;
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FReply SGraphNodeComment::OnDrop( const FGeometry& MyGeometry, const FDragDropEvent& DragDropEvent )
|
|
|
|
|
{
|
|
|
|
|
return FReply::Unhandled();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SGraphNodeComment::OnDragEnter( const FGeometry& MyGeometry, const FDragDropEvent& DragDropEvent )
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
float SGraphNodeComment::GetWrapAt() const
|
|
|
|
|
{
|
|
|
|
|
return (float)(CachedWidth - 16);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool SGraphNodeComment::IsNameReadOnly() const
|
|
|
|
|
{
|
|
|
|
|
return !IsEditable.Get() || SGraphNode::IsNameReadOnly();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SGraphNodeComment::UpdateGraphNode()
|
|
|
|
|
{
|
|
|
|
|
// No pins in a comment box
|
|
|
|
|
InputPins.Empty();
|
|
|
|
|
OutputPins.Empty();
|
|
|
|
|
|
|
|
|
|
// Avoid standard box model too
|
|
|
|
|
RightNodeBox.Reset();
|
|
|
|
|
LeftNodeBox.Reset();
|
2014-08-13 03:41:45 -04:00
|
|
|
|
|
|
|
|
// Setup a tag for this node
|
|
|
|
|
FString TagName;
|
|
|
|
|
if (GraphNode != nullptr)
|
|
|
|
|
{
|
2014-08-28 09:38:24 -04:00
|
|
|
// We want the name of the blueprint as our name - we can find the node from the GUID
|
|
|
|
|
UObject* Package = GraphNode->GetOutermost();
|
|
|
|
|
UObject* LastOuter = GraphNode->GetOuter();
|
|
|
|
|
while (LastOuter->GetOuter() != Package)
|
|
|
|
|
{
|
|
|
|
|
LastOuter = LastOuter->GetOuter();
|
|
|
|
|
}
|
|
|
|
|
TagName = FString::Printf(TEXT("GraphNode,%s,%s"), *LastOuter->GetFullName(), *GraphNode->NodeGuid.ToString());
|
2014-08-13 03:41:45 -04:00
|
|
|
}
|
2014-03-14 14:13:41 -04:00
|
|
|
|
2015-01-15 15:57:51 -05:00
|
|
|
SetupErrorReporting();
|
2014-03-14 14:13:41 -04:00
|
|
|
|
2014-09-05 07:39:52 -04:00
|
|
|
// Setup a meta tag for this node
|
|
|
|
|
FGraphNodeMetaData TagMeta(TEXT("Graphnode"));
|
|
|
|
|
PopulateMetaTag(&TagMeta);
|
|
|
|
|
|
2014-03-14 14:13:41 -04:00
|
|
|
bool bIsSet = GraphNode->IsA(UEdGraphNode_Comment::StaticClass());
|
|
|
|
|
this->ContentScale.Bind( this, &SGraphNode::GetContentScale );
|
2014-11-03 10:40:57 -05:00
|
|
|
this->GetOrAddSlot( ENodeZone::Center )
|
2014-03-14 14:13:41 -04:00
|
|
|
.HAlign(HAlign_Fill)
|
|
|
|
|
.VAlign(VAlign_Fill)
|
|
|
|
|
[
|
|
|
|
|
SNew(SBorder)
|
|
|
|
|
.BorderImage( FEditorStyle::GetBrush("Kismet.Comment.Background") )
|
|
|
|
|
.ColorAndOpacity( FLinearColor::White )
|
|
|
|
|
.BorderBackgroundColor( this, &SGraphNodeComment::GetCommentBodyColor )
|
|
|
|
|
.Padding( FMargin(3.0f) )
|
2014-09-05 07:39:52 -04:00
|
|
|
.AddMetaData<FGraphNodeMetaData>(TagMeta)
|
2014-03-14 14:13:41 -04:00
|
|
|
[
|
|
|
|
|
SNew(SVerticalBox)
|
|
|
|
|
.ToolTipText( this, &SGraphNode::GetNodeTooltip )
|
|
|
|
|
+SVerticalBox::Slot()
|
|
|
|
|
.AutoHeight()
|
|
|
|
|
.HAlign(HAlign_Fill)
|
|
|
|
|
.VAlign(VAlign_Top)
|
|
|
|
|
[
|
|
|
|
|
SAssignNew(TitleBar, SBorder)
|
|
|
|
|
.BorderImage( FEditorStyle::GetBrush("Graph.Node.TitleBackground") )
|
|
|
|
|
.BorderBackgroundColor( this, &SGraphNodeComment::GetCommentTitleBarColor )
|
|
|
|
|
.Padding( FMargin(10,5,5,3) )
|
|
|
|
|
.HAlign(HAlign_Left)
|
|
|
|
|
.VAlign(VAlign_Center)
|
|
|
|
|
[
|
|
|
|
|
SNew(SHorizontalBox)
|
|
|
|
|
+SHorizontalBox::Slot()
|
|
|
|
|
.AutoWidth()
|
|
|
|
|
[
|
|
|
|
|
SAssignNew(InlineEditableText, SInlineEditableTextBlock)
|
|
|
|
|
.Style( FEditorStyle::Get(), "Graph.CommentBlock.TitleInlineEditableText" )
|
|
|
|
|
.Text( this, &SGraphNodeComment::GetEditableNodeTitleAsText )
|
|
|
|
|
.OnVerifyTextChanged(this, &SGraphNodeComment::OnVerifyNameTextChanged)
|
|
|
|
|
.OnTextCommitted(this, &SGraphNodeComment::OnNameTextCommited)
|
|
|
|
|
.IsReadOnly( this, &SGraphNodeComment::IsNameReadOnly )
|
|
|
|
|
.IsSelected( this, &SGraphNodeComment::IsSelectedExclusively )
|
|
|
|
|
.WrapTextAt( this, &SGraphNodeComment::GetWrapAt )
|
2015-05-12 06:09:01 -04:00
|
|
|
.MultiLine(true)
|
|
|
|
|
.ModiferKeyForNewLine(EModifierKey::Shift)
|
2014-03-14 14:13:41 -04:00
|
|
|
]
|
|
|
|
|
]
|
|
|
|
|
]
|
|
|
|
|
+SVerticalBox::Slot()
|
|
|
|
|
.AutoHeight()
|
|
|
|
|
.Padding(1.0f)
|
|
|
|
|
[
|
2015-01-15 15:57:51 -05:00
|
|
|
ErrorReporting->AsWidget()
|
2014-03-14 14:13:41 -04:00
|
|
|
]
|
|
|
|
|
+SVerticalBox::Slot()
|
|
|
|
|
.AutoHeight()
|
|
|
|
|
.HAlign(HAlign_Fill)
|
|
|
|
|
.VAlign(VAlign_Fill)
|
|
|
|
|
[
|
|
|
|
|
// NODE CONTENT AREA
|
|
|
|
|
SNew(SBorder)
|
|
|
|
|
.BorderImage( FEditorStyle::GetBrush("NoBorder") )
|
|
|
|
|
]
|
|
|
|
|
]
|
|
|
|
|
];
|
2014-11-03 10:40:57 -05:00
|
|
|
// Create comment bubble
|
|
|
|
|
TSharedPtr<SCommentBubble> CommentBubble;
|
|
|
|
|
|
2015-04-28 04:58:34 -04:00
|
|
|
SAssignNew(CommentBubble, SCommentBubble)
|
|
|
|
|
.GraphNode(GraphNode)
|
|
|
|
|
.Text(this, &SGraphNodeComment::GetNodeComment)
|
|
|
|
|
.OnTextCommitted(this, &SGraphNodeComment::OnNameTextCommited)
|
|
|
|
|
.ColorAndOpacity(this, &SGraphNodeComment::GetCommentBubbleColor )
|
|
|
|
|
.AllowPinning(true)
|
|
|
|
|
.EnableTitleBarBubble(false)
|
|
|
|
|
.EnableBubbleCtrls(false)
|
|
|
|
|
.GraphLOD(this, &SGraphNode::GetCurrentLOD)
|
|
|
|
|
.InvertLODCulling(true)
|
|
|
|
|
.IsGraphNodeHovered(this, &SGraphNode::IsHovered);
|
2014-11-03 10:40:57 -05:00
|
|
|
|
2015-04-28 04:58:34 -04:00
|
|
|
GetOrAddSlot(ENodeZone::TopCenter)
|
|
|
|
|
.SlotOffset(TAttribute<FVector2D>(CommentBubble.Get(), &SCommentBubble::GetOffset))
|
|
|
|
|
.SlotSize(TAttribute<FVector2D>(CommentBubble.Get(), &SCommentBubble::GetSize))
|
|
|
|
|
.AllowScaling(TAttribute<bool>(CommentBubble.Get(), &SCommentBubble::IsScalingAllowed))
|
|
|
|
|
.VAlign(VAlign_Top)
|
2014-11-03 10:40:57 -05:00
|
|
|
[
|
|
|
|
|
CommentBubble.ToSharedRef()
|
|
|
|
|
];
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
|
|
|
|
|
2015-01-14 19:04:45 -05:00
|
|
|
FVector2D SGraphNodeComment::ComputeDesiredSize( float ) const
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
|
|
|
|
return UserSize;
|
|
|
|
|
}
|
|
|
|
|
|
2015-04-28 04:58:34 -04:00
|
|
|
FString SGraphNodeComment::GetNodeComment() const
|
|
|
|
|
{
|
|
|
|
|
const FString Title = GetEditableNodeTitle();;
|
|
|
|
|
return Title;
|
|
|
|
|
}
|
|
|
|
|
|
2014-03-14 14:13:41 -04:00
|
|
|
FReply SGraphNodeComment::OnMouseButtonDoubleClick( const FGeometry& InMyGeometry, const FPointerEvent& InMouseEvent )
|
|
|
|
|
{
|
|
|
|
|
// If user double-clicked in the title bar area
|
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
|
|
|
if(FindMouseZone(InMyGeometry.AbsoluteToLocal(InMouseEvent.GetScreenSpacePosition())) == CRWZ_TitleBar && IsEditable.Get())
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
|
|
|
|
// Request a rename
|
|
|
|
|
RequestRename();
|
|
|
|
|
|
|
|
|
|
// Set the keyboard focus
|
|
|
|
|
if(!HasKeyboardFocus())
|
|
|
|
|
{
|
2014-10-30 12:29:36 -04:00
|
|
|
FSlateApplication::Get().SetKeyboardFocus(SharedThis(this), EFocusCause::SetDirectly);
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return FReply::Handled();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2015-05-08 17:44:46 -04:00
|
|
|
// Otherwise let the graph handle it, to allow spline interactions to work when they overlap with a comment node
|
|
|
|
|
return FReply::Unhandled();
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-05 05:33:22 -05:00
|
|
|
FReply SGraphNodeComment::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();
|
|
|
|
|
|
|
|
|
|
// Update contained child Nodes
|
|
|
|
|
HandleSelection( bIsSelected, true );
|
|
|
|
|
|
|
|
|
|
return FReply::Handled().ReleaseMouseCapture();
|
|
|
|
|
}
|
|
|
|
|
return FReply::Unhandled();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int32 SGraphNodeComment::GetSortDepth() const
|
|
|
|
|
{
|
|
|
|
|
UEdGraphNode_Comment* CommentNode = Cast<UEdGraphNode_Comment>( GraphNode );
|
|
|
|
|
return CommentNode ? CommentNode->CommentDepth : -1;
|
|
|
|
|
}
|
|
|
|
|
|
2014-03-14 14:13:41 -04:00
|
|
|
void SGraphNodeComment::HandleSelection(bool bSelected, bool bUpdateNodesUnderComment) const
|
|
|
|
|
{
|
2014-11-06 15:27:28 -05:00
|
|
|
const FVector2D NodeSize = GetDesiredSize();
|
|
|
|
|
// we only want to do this after the comment has a valid desired size
|
|
|
|
|
if( !NodeSize.IsZero() )
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
2014-11-06 15:27:28 -05:00
|
|
|
if ((!this->bIsSelected && bSelected) || bUpdateNodesUnderComment)
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
2014-11-06 15:27:28 -05:00
|
|
|
SGraphNodeComment* Comment = const_cast<SGraphNodeComment*> (this);
|
|
|
|
|
UEdGraphNode_Comment* CommentNode = Cast<UEdGraphNode_Comment>(GraphNode);
|
2014-03-14 14:13:41 -04:00
|
|
|
|
2014-11-06 15:27:28 -05:00
|
|
|
if (CommentNode)
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
2014-11-06 15:27:28 -05:00
|
|
|
// Get our geo
|
|
|
|
|
const FVector2D NodePosition = GetPosition();
|
|
|
|
|
const FSlateRect CommentRect( NodePosition.X, NodePosition.Y, NodePosition.X + NodeSize.X, NodePosition.Y + NodeSize.Y );
|
2014-03-14 14:13:41 -04:00
|
|
|
|
2014-12-05 05:33:22 -05:00
|
|
|
TSharedPtr<SGraphPanel> Panel = Comment->GetOwnerPanel();
|
2014-11-17 14:04:07 -05:00
|
|
|
FChildren* PanelChildren = Panel->GetAllChildren();
|
2014-11-06 15:27:28 -05:00
|
|
|
int32 NumChildren = PanelChildren->Num();
|
|
|
|
|
CommentNode->ClearNodesUnderComment();
|
2014-03-14 14:13:41 -04:00
|
|
|
|
2014-11-06 15:27:28 -05:00
|
|
|
for ( int32 NodeIndex=0; NodeIndex < NumChildren; ++NodeIndex )
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
2014-11-06 15:27:28 -05:00
|
|
|
const TSharedRef<SGraphNode> SomeNodeWidget = StaticCastSharedRef<SGraphNode>(PanelChildren->GetChildAt(NodeIndex));
|
|
|
|
|
|
|
|
|
|
UObject* GraphObject = SomeNodeWidget->GetObjectBeingDisplayed();
|
|
|
|
|
|
2014-12-05 05:33:22 -05:00
|
|
|
if( GraphObject != CommentNode )
|
2014-11-06 15:27:28 -05:00
|
|
|
{
|
2014-12-05 05:33:22 -05:00
|
|
|
const FVector2D SomeNodePosition = SomeNodeWidget->GetPosition();
|
|
|
|
|
const FVector2D SomeNodeSize = SomeNodeWidget->GetDesiredSize();
|
|
|
|
|
|
|
|
|
|
const FSlateRect NodeGeometryGraphSpace( SomeNodePosition.X, SomeNodePosition.Y, SomeNodePosition.X + SomeNodeSize.X, SomeNodePosition.Y + SomeNodeSize.Y );
|
2015-01-05 08:54:17 -05:00
|
|
|
if( FSlateRect::IsRectangleContained( CommentRect, NodeGeometryGraphSpace ) )
|
2014-12-05 05:33:22 -05:00
|
|
|
{
|
2015-01-05 08:54:17 -05:00
|
|
|
CommentNode->AddNodeUnderComment(GraphObject);
|
2014-12-05 05:33:22 -05:00
|
|
|
}
|
2014-11-06 15:27:28 -05:00
|
|
|
}
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2014-11-06 15:27:28 -05:00
|
|
|
bIsSelected = bSelected;
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const FSlateBrush* SGraphNodeComment::GetShadowBrush(bool bSelected) const
|
|
|
|
|
{
|
|
|
|
|
HandleSelection(bSelected);
|
|
|
|
|
return SGraphNode::GetShadowBrush(bSelected);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SGraphNodeComment::GetOverlayBrushes(bool bSelected, const FVector2D WidgetSize, TArray<FOverlayBrushInfo>& Brushes) const
|
|
|
|
|
{
|
|
|
|
|
const float Fudge = 3.0f;
|
|
|
|
|
|
|
|
|
|
HandleSelection(bSelected);
|
|
|
|
|
|
|
|
|
|
FOverlayBrushInfo HandleBrush = FEditorStyle::GetBrush( TEXT("Kismet.Comment.Handle") );
|
|
|
|
|
|
|
|
|
|
HandleBrush.OverlayOffset.X = WidgetSize.X - HandleBrush.Brush->ImageSize.X - Fudge;
|
|
|
|
|
HandleBrush.OverlayOffset.Y = WidgetSize.Y - HandleBrush.Brush->ImageSize.Y - Fudge;
|
|
|
|
|
|
|
|
|
|
Brushes.Add(HandleBrush);
|
|
|
|
|
return SGraphNode::GetOverlayBrushes(bSelected, WidgetSize, Brushes);
|
|
|
|
|
}
|
|
|
|
|
|
2014-05-06 04:45:44 -04:00
|
|
|
void SGraphNodeComment::MoveTo( const FVector2D& NewPosition, FNodeSet& NodeFilter )
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
|
|
|
|
FVector2D PositionDelta = NewPosition - GetPosition();
|
2014-05-06 04:45:44 -04:00
|
|
|
SGraphNode::MoveTo(NewPosition, NodeFilter);
|
2014-03-14 14:13:41 -04:00
|
|
|
// Don't drag note content if either of the shift keys are down.
|
|
|
|
|
FModifierKeysState KeysState = FSlateApplication::Get().GetModifierKeys();
|
|
|
|
|
if(!KeysState.IsShiftDown())
|
|
|
|
|
{
|
|
|
|
|
UEdGraphNode_Comment* CommentNode = Cast<UEdGraphNode_Comment>(GraphNode);
|
|
|
|
|
if (CommentNode && CommentNode->MoveMode == ECommentBoxMode::GroupMovement)
|
|
|
|
|
{
|
|
|
|
|
// Now update any nodes which are touching the comment but *not* selected
|
|
|
|
|
// Selected nodes will be moved as part of the normal selection code
|
|
|
|
|
TSharedPtr< SGraphPanel > Panel = GetOwnerPanel();
|
|
|
|
|
|
|
|
|
|
for (FCommentNodeSet::TConstIterator NodeIt( CommentNode->GetNodesUnderComment() ); NodeIt; ++NodeIt)
|
|
|
|
|
{
|
|
|
|
|
if (UEdGraphNode* Node = Cast<UEdGraphNode>(*NodeIt))
|
|
|
|
|
{
|
2014-05-06 04:45:44 -04:00
|
|
|
if ( !Panel->SelectionManager.IsNodeSelected(Node) && !NodeFilter.Find( Node->NodeWidget.Pin() ))
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
2014-05-29 17:14:05 -04:00
|
|
|
NodeFilter.Add(Node->NodeWidget.Pin());
|
|
|
|
|
Node->Modify();
|
2014-03-14 14:13:41 -04:00
|
|
|
Node->NodePosX += PositionDelta.X;
|
|
|
|
|
Node->NodePosY += PositionDelta.Y;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-01-05 08:54:17 -05:00
|
|
|
void SGraphNodeComment::EndUserInteraction() const
|
|
|
|
|
{
|
|
|
|
|
// Find any parent comments and their list of child nodes
|
|
|
|
|
const FVector2D NodeSize = GetDesiredSize();
|
|
|
|
|
if( !NodeSize.IsZero() )
|
|
|
|
|
{
|
|
|
|
|
const FVector2D NodePosition = GetPosition();
|
|
|
|
|
const FSlateRect CommentRect( NodePosition.X, NodePosition.Y, NodePosition.X + NodeSize.X, NodePosition.Y + NodeSize.Y );
|
|
|
|
|
|
|
|
|
|
TSharedPtr<SGraphPanel> Panel = GetOwnerPanel();
|
|
|
|
|
FChildren* PanelChildren = Panel->GetAllChildren();
|
|
|
|
|
int32 NumChildren = PanelChildren->Num();
|
|
|
|
|
|
|
|
|
|
for ( int32 NodeIndex=0; NodeIndex < NumChildren; ++NodeIndex )
|
|
|
|
|
{
|
|
|
|
|
TSharedPtr<SGraphNodeComment> CommentWidget = StaticCastSharedRef<SGraphNodeComment>(PanelChildren->GetChildAt(NodeIndex));
|
|
|
|
|
|
|
|
|
|
if( CommentWidget.IsValid() )
|
|
|
|
|
{
|
|
|
|
|
const FVector2D SomeNodePosition = CommentWidget->GetPosition();
|
|
|
|
|
const FVector2D SomeNodeSize = CommentWidget->GetDesiredSize();
|
|
|
|
|
|
|
|
|
|
const FSlateRect NodeGeometryGraphSpace( SomeNodePosition.X, SomeNodePosition.Y, SomeNodePosition.X + SomeNodeSize.X, SomeNodePosition.Y + SomeNodeSize.Y );
|
|
|
|
|
if( FSlateRect::DoRectanglesIntersect( CommentRect, NodeGeometryGraphSpace ) )
|
|
|
|
|
{
|
|
|
|
|
CommentWidget->HandleSelection( CommentWidget->bIsSelected, true );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
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
|
|
|
float SGraphNodeComment::GetTitleBarHeight() const
|
|
|
|
|
{
|
|
|
|
|
return TitleBar.IsValid() ? TitleBar->GetDesiredSize().Y : 0.0f;
|
|
|
|
|
}
|
|
|
|
|
|
2015-05-12 06:09:01 -04:00
|
|
|
FSlateRect SGraphNodeComment::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
|
|
|
{
|
2015-05-12 06:09:01 -04:00
|
|
|
return SCommentNodeDefs::HitResultBorderSize;
|
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
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FVector2D SGraphNodeComment::GetNodeMaximumSize() const
|
|
|
|
|
{
|
|
|
|
|
return FVector2D( UserSize.X + 100, UserSize.Y + 100 );
|
|
|
|
|
}
|
|
|
|
|
|
2014-03-14 14:13:41 -04:00
|
|
|
FSlateColor SGraphNodeComment::GetCommentBodyColor() const
|
|
|
|
|
{
|
|
|
|
|
UEdGraphNode_Comment* CommentNode = Cast<UEdGraphNode_Comment>(GraphNode);
|
|
|
|
|
|
2015-04-27 06:45:26 -04:00
|
|
|
if (CommentNode)
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
|
|
|
|
return CommentNode->CommentColor;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return FLinearColor::White;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FSlateColor SGraphNodeComment::GetCommentTitleBarColor() const
|
2015-04-27 06:45:26 -04:00
|
|
|
{
|
|
|
|
|
UEdGraphNode_Comment* CommentNode = Cast<UEdGraphNode_Comment>(GraphNode);
|
|
|
|
|
if (CommentNode)
|
|
|
|
|
{
|
|
|
|
|
const FLinearColor Color = CommentNode->CommentColor * SCommentNodeDefs::TitleBarColorMultiplier;
|
|
|
|
|
return FLinearColor(Color.R, Color.G, Color.B);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
const FLinearColor Color = FLinearColor::White * SCommentNodeDefs::TitleBarColorMultiplier;
|
|
|
|
|
return FLinearColor(Color.R, Color.G, Color.B);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FSlateColor SGraphNodeComment::GetCommentBubbleColor() const
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
|
|
|
|
UEdGraphNode_Comment* CommentNode = Cast<UEdGraphNode_Comment>(GraphNode);
|
2015-04-28 04:58:34 -04:00
|
|
|
if (CommentNode)
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
2015-04-28 04:58:34 -04:00
|
|
|
const FLinearColor Color = CommentNode->bColorCommentBubble ? (CommentNode->CommentColor * SCommentNodeDefs::TitleBarColorMultiplier) :
|
|
|
|
|
GetDefault<UGraphEditorSettings>()->DefaultCommentNodeTitleColor;
|
2014-03-14 14:13:41 -04:00
|
|
|
return FLinearColor(Color.R, Color.G, Color.B);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
const FLinearColor Color = FLinearColor::White * SCommentNodeDefs::TitleBarColorMultiplier;
|
|
|
|
|
return FLinearColor(Color.R, Color.G, Color.B);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool SGraphNodeComment::CanBeSelected(const FVector2D& MousePositionInNode) 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
|
|
|
const EResizableWindowZone InMouseZone = FindMouseZone(MousePositionInNode);
|
2014-12-05 05:33:22 -05:00
|
|
|
return CRWZ_TitleBar == InMouseZone;
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FVector2D SGraphNodeComment::GetDesiredSizeForMarquee() const
|
|
|
|
|
{
|
|
|
|
|
const float TitleBarHeight = TitleBar.IsValid() ? TitleBar->GetDesiredSize().Y : 0.0f;
|
|
|
|
|
return FVector2D(UserSize.X, TitleBarHeight);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FSlateRect SGraphNodeComment::GetTitleRect() const
|
|
|
|
|
{
|
|
|
|
|
const FVector2D NodePosition = GetPosition();
|
|
|
|
|
FVector2D NodeSize = TitleBar.IsValid() ? TitleBar->GetDesiredSize() : GetDesiredSize();
|
|
|
|
|
return FSlateRect( NodePosition.X, NodePosition.Y, NodePosition.X + NodeSize.X, NodePosition.Y + NodeSize.Y ) + SCommentNodeDefs::TitleBarOffset;
|
|
|
|
|
}
|
2014-09-05 07:39:52 -04:00
|
|
|
|
|
|
|
|
void SGraphNodeComment::PopulateMetaTag(FGraphNodeMetaData* TagMeta) const
|
|
|
|
|
{
|
|
|
|
|
if (GraphNode != nullptr)
|
|
|
|
|
{
|
|
|
|
|
// We want the name of the blueprint as our name - we can find the node from the GUID
|
|
|
|
|
UObject* Package = GraphNode->GetOutermost();
|
|
|
|
|
UObject* LastOuter = GraphNode->GetOuter();
|
|
|
|
|
while (LastOuter->GetOuter() != Package)
|
|
|
|
|
{
|
|
|
|
|
LastOuter = LastOuter->GetOuter();
|
|
|
|
|
}
|
|
|
|
|
TagMeta->Tag = FName(*FString::Printf(TEXT("GraphNode_%s_%s"), *LastOuter->GetFullName(), *GraphNode->NodeGuid.ToString()));
|
|
|
|
|
TagMeta->OuterName = LastOuter->GetFullName();
|
|
|
|
|
TagMeta->GUID = GraphNode->NodeGuid;
|
|
|
|
|
TagMeta->FriendlyName = FString::Printf(TEXT("%s in %s"), *GraphNode->GetNodeTitle(ENodeTitleType::FullTitle).ToString(), *TagMeta->OuterName);
|
|
|
|
|
}
|
|
|
|
|
}
|