Files
UnrealEngineUWP/Engine/Source/Editor/GraphEditor/Private/SGraphPreviewer.cpp
thomas sarkanen 084d39f98c Fix flicker in graph preview in anim state machines
Stopped zooming every frame, and only update the graph when it is created.

#jira UE-64870 - Animation State Preview Window Jitters with certain states
#rb Jurre.deBaare

#ROBOMERGE-SOURCE: CL 4466680 in //UE4/Release-4.21/...
#ROBOMERGE-BOT: RELEASE (Release-4.21 -> Release-Staging-4.21)

[CL 4466681 by thomas sarkanen in Staging-4.21 branch]
2018-10-15 09:21:14 -04:00

72 lines
1.6 KiB
C++

// Copyright 1998-2018 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));
}