new_editor: close startup screenshot ownership
This commit is contained in:
@@ -168,9 +168,9 @@ bool EditorWindowRuntimeController::Initialize(
|
||||
ResetFrameTiming();
|
||||
m_ready = true;
|
||||
|
||||
m_autoScreenshot.Initialize(captureRoot);
|
||||
if (autoCaptureOnStartup && IsAutoCaptureOnStartupEnabled()) {
|
||||
m_autoScreenshot.RequestCapture("startup");
|
||||
m_screenshotController.Initialize(captureRoot);
|
||||
if (autoCaptureOnStartup) {
|
||||
m_screenshotController.RequestCapture("startup");
|
||||
editorContext.SetStatus("Capture", "Startup capture requested.");
|
||||
}
|
||||
|
||||
@@ -182,8 +182,10 @@ void EditorWindowRuntimeController::Shutdown() {
|
||||
ResetFrameTiming();
|
||||
LogRuntimeTrace("window-close", "EditorWindowRuntimeController::Shutdown stage=WaitForGpuIdle");
|
||||
m_windowRenderer.WaitForGpuIdle();
|
||||
LogRuntimeTrace("window-close", "EditorWindowRuntimeController::Shutdown stage=AutoScreenshot");
|
||||
m_autoScreenshot.Shutdown();
|
||||
LogRuntimeTrace(
|
||||
"window-close",
|
||||
"EditorWindowRuntimeController::Shutdown stage=ScreenshotController");
|
||||
m_screenshotController.Shutdown();
|
||||
LogRuntimeTrace("window-close", "EditorWindowRuntimeController::Shutdown stage=ShellRuntime");
|
||||
m_shellRuntime.Shutdown();
|
||||
LogRuntimeTrace("window-close", "EditorWindowRuntimeController::Shutdown stage=RenderLoopDetach");
|
||||
@@ -232,7 +234,7 @@ Host::D3D12WindowRenderLoopFrameContext EditorWindowRuntimeController::BeginFram
|
||||
Host::D3D12WindowRenderLoopPresentResult EditorWindowRuntimeController::Present(
|
||||
const ::XCEngine::UI::UIDrawData& drawData) {
|
||||
std::filesystem::path capturePath = {};
|
||||
const bool captureRequested = m_autoScreenshot.TryBeginCapture(capturePath);
|
||||
const bool captureRequested = m_screenshotController.TryBeginCapture(capturePath);
|
||||
|
||||
Host::D3D12WindowRenderLoopPresentResult result =
|
||||
m_windowRenderLoop.Present(
|
||||
@@ -242,7 +244,7 @@ Host::D3D12WindowRenderLoopPresentResult EditorWindowRuntimeController::Present(
|
||||
if (captureRequested) {
|
||||
const bool captureSucceeded = result.framePresented && result.captureSucceeded;
|
||||
if (captureSucceeded) {
|
||||
m_autoScreenshot.CompleteCaptureSuccess(capturePath);
|
||||
m_screenshotController.CompleteCaptureSuccess(capturePath);
|
||||
LogRuntimeTrace("capture", "native d3d12 capture succeeded: " + capturePath.string());
|
||||
} else {
|
||||
std::string captureError = result.captureError;
|
||||
@@ -251,10 +253,10 @@ Host::D3D12WindowRenderLoopPresentResult EditorWindowRuntimeController::Present(
|
||||
? result.warning
|
||||
: "Screenshot capture did not complete.";
|
||||
}
|
||||
m_autoScreenshot.CompleteCaptureFailure(std::move(captureError));
|
||||
m_screenshotController.CompleteCaptureFailure(std::move(captureError));
|
||||
LogRuntimeTrace(
|
||||
"capture",
|
||||
"native d3d12 capture failed: " + m_autoScreenshot.GetLastCaptureError());
|
||||
"native d3d12 capture failed: " + m_screenshotController.GetLastCaptureError());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -262,20 +264,20 @@ Host::D3D12WindowRenderLoopPresentResult EditorWindowRuntimeController::Present(
|
||||
}
|
||||
|
||||
void EditorWindowRuntimeController::RequestManualScreenshot(std::string reason) {
|
||||
m_autoScreenshot.RequestCapture(std::move(reason));
|
||||
m_screenshotController.RequestCapture(std::move(reason));
|
||||
}
|
||||
|
||||
std::string EditorWindowRuntimeController::BuildCaptureStatusText() const {
|
||||
if (m_autoScreenshot.HasPendingCapture()) {
|
||||
if (m_screenshotController.HasPendingCapture()) {
|
||||
return "Shot pending...";
|
||||
}
|
||||
|
||||
if (!m_autoScreenshot.GetLastCaptureError().empty()) {
|
||||
return TruncateText(m_autoScreenshot.GetLastCaptureError(), 38u);
|
||||
if (!m_screenshotController.GetLastCaptureError().empty()) {
|
||||
return TruncateText(m_screenshotController.GetLastCaptureError(), 38u);
|
||||
}
|
||||
|
||||
if (!m_autoScreenshot.GetLastCaptureSummary().empty()) {
|
||||
return TruncateText(m_autoScreenshot.GetLastCaptureSummary(), 38u);
|
||||
if (!m_screenshotController.GetLastCaptureSummary().empty()) {
|
||||
return TruncateText(m_screenshotController.GetLastCaptureSummary(), 38u);
|
||||
}
|
||||
|
||||
return {};
|
||||
|
||||
Reference in New Issue
Block a user