Fix window handle retrieval in frame capture system. (#1073)

Capturing screenshots via hydra should work now.
This commit is contained in:
hershey5045
2021-06-01 14:21:02 -07:00
committed by GitHub
parent b32507bd4b
commit 9e3b7b45d9
@@ -16,6 +16,7 @@
#include <Atom/RPI.Public/Pass/PassFilter.h>
#include <Atom/RPI.Public/Pass/RenderPass.h>
#include <Atom/RPI.Public/Pass/Specific/SwapChainPass.h>
#include <Atom/RPI.Public/ViewportContextManager.h>
#include <Atom/Utils/DdsFile.h>
#include <Atom/Utils/PpmFile.h>
@@ -289,11 +290,7 @@ namespace AZ
bool FrameCaptureSystemComponent::CaptureScreenshot(const AZStd::string& filePath)
{
AzFramework::NativeWindowHandle windowHandle = nullptr;
AzFramework::WindowSystemRequestBus::BroadcastResult(
windowHandle,
&AzFramework::WindowSystemRequestBus::Events::GetDefaultWindowHandle);
AzFramework::NativeWindowHandle windowHandle = AZ::RPI::ViewportContextRequests::Get()->GetDefaultViewportContext()->GetWindowHandle();
if (windowHandle)
{
return CaptureScreenshotForWindow(filePath, windowHandle);