Files
UnrealEngineUWP/Engine/Source/Developer/FunctionalTesting/Public/TakeScreenshotAfterTimeLatentAction.h
andrew grant 0bf0d10404 - Fix for case where people try to take an automation screenshot during BeginPlay.
Now perform the pre-screenshot flush of loading on the first tick of the latent action and not in its constructor. This addresses cases where BP's attempt to take a screenshot in their BeginPlay event while the world is being created.

- Fix for crash that can happen when a window needs resized after a screenshot is captured.

Don't delete (which leads to restoring the viewport size) on response to the screenshot delegates. Instead queue it by one frame


#jira UE-91269
#rb na
#lockdown Cristina.Riveron

#ROBOMERGE-SOURCE: CL 12788643 in //UE4/Release-4.25/... via CL 12788645 via CL 12788646
#ROBOMERGE-BOT: RELEASE (Release-Engine-Staging -> Main) (v681-12776863)

[CL 12788647 by andrew grant in Main branch]
2020-04-14 20:37:48 -04:00

62 lines
1.6 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "UObject/WeakObjectPtr.h"
#include "AutomationScreenshotOptions.h"
#include "LatentActions.h"
struct FLatentActionInfo;
class FTakeScreenshotAfterTimeLatentAction : public FPendingLatentAction
{
public:
FTakeScreenshotAfterTimeLatentAction(const FLatentActionInfo& LatentInfo, const FString& InScreenshotName, const FString& InNotes, FAutomationScreenshotOptions InOptions);
virtual ~FTakeScreenshotAfterTimeLatentAction();
virtual void UpdateOperation(FLatentResponse& Response) override;
#if WITH_EDITOR
// Returns a human readable description of the latent operation's current state
virtual FString GetDescription() const override;
#endif
private:
void OnScreenshotTakenAndCompared();
private:
FName ExecutionFunction;
int32 OutputLink;
FWeakObjectPtr CallbackTarget;
FString ScreenshotName;
FString Notes;
float SecondsRemaining;
bool FinishedLoading;
bool IssuedScreenshotCapture;
bool TakenScreenshot;
FAutomationScreenshotOptions Options;
};
class FWaitForScreenshotComparisonLatentAction : public FPendingLatentAction
{
public:
FWaitForScreenshotComparisonLatentAction(const FLatentActionInfo& LatentInfo);
virtual ~FWaitForScreenshotComparisonLatentAction();
virtual void UpdateOperation(FLatentResponse& Response) override;
#if WITH_EDITOR
// Returns a human readable description of the latent operation's current state
virtual FString GetDescription() const override;
#endif
private:
void OnScreenshotTakenAndCompared();
private:
FName ExecutionFunction;
int32 OutputLink;
FWeakObjectPtr CallbackTarget;
bool TakenScreenshot;
};