Files
UnrealEngineUWP/Engine/Source/Editor/GraphEditor/Private/SGraphPreviewer.cpp
Marcus Wassmer cbfcbbb93b Merging //UE4/Dev-Main@4662404 to Dev-Rendering (//UE4/Dev-Rendering)
#rb none
Should be just copyright updates

[CL 4680440 by Marcus Wassmer in Dev-Rendering branch]
2019-01-03 19:16:26 -05:00

72 lines
1.6 KiB
C++

// Copyright 1998-2019 Epic Games, Inc. All Rights Reserved.
#include "SGraphPreviewer.h"
#include "Widgets/SOverlay.h"
#include "Widgets/Text/STextBlock.h"
#include "EditorStyleSet.h"
#include "SGraphPanel.h"
EActiveTimerReturnType SGraphPreviewer::RefreshGraphTimer(const double InCurrentTime, const float InDeltaTime)
{
if (NeedsRefreshCounter > 0)
{
GraphPanel->ZoomToFit(false);
NeedsRefreshCounter--;
return EActiveTimerReturnType::Continue;
}
else
{
return EActiveTimerReturnType::Stop;
}
}
void SGraphPreviewer::Construct( const FArguments& InArgs, UEdGraph* InGraphObj )
{
EdGraphObj = InGraphObj;
NeedsRefreshCounter = 2;
TSharedPtr<SOverlay> DisplayStack;
this->ChildSlot
[
SAssignNew(DisplayStack, SOverlay)
// The graph panel
+SOverlay::Slot()
[
SAssignNew(GraphPanel, SGraphPanel)
.GraphObj( EdGraphObj )
.IsEditable( false )
.ShowGraphStateOverlay(InArgs._ShowGraphStateOverlay)
.InitialZoomToFit( true )
]
// Bottom-right corner text indicating the type of tool
+SOverlay::Slot()
.Padding(4)
.VAlign(VAlign_Bottom)
.HAlign(HAlign_Right)
[
SNew(STextBlock)
.Visibility( EVisibility::HitTestInvisible )
.TextStyle( FEditorStyle::Get(), "GraphPreview.CornerText" )
.Text( InArgs._CornerOverlayText )
]
];
GraphPanel->Update();
// Add the title bar if specified
if (InArgs._TitleBar.IsValid())
{
DisplayStack->AddSlot()
.VAlign(VAlign_Top)
[
InArgs._TitleBar.ToSharedRef()
];
}
RegisterActiveTimer(0.0f, FWidgetActiveTimerDelegate::CreateSP(this, &SGraphPreviewer::RefreshGraphTimer));
}