Test screenshots through ViewportCapture: sRGB instead of the dark linear HDR frame

This commit is contained in:
cthangover committed 2026-10-23 09:03:55 +02:00
1 parent 3b2c1ddb95
commit 6ca1fff35f
2 files changed
+4 -3

No files matched your search

@@ -10,6 +10,7 @@ using Cthangover.Mods.Dialog;
using Cthangover.Tools.Common; using Cthangover.Tools.Common;
using Cthangover.Tools.SceneEditor; using Cthangover.Tools.SceneEditor;
using Cthangover.Tools.Services; using Cthangover.Tools.Services;
using Cthangover.Mods.Interface.View;
using Godot; using Godot;
namespace Cthangover.Tools.Tests.NovelFlow namespace Cthangover.Tools.Tests.NovelFlow
@@ -341,7 +342,7 @@ namespace Cthangover.Tools.Tests.NovelFlow
if (string.IsNullOrEmpty(shotsDir) || DisplayServer.GetName() == "headless") if (string.IsNullOrEmpty(shotsDir) || DisplayServer.GetName() == "headless")
return; return;
DirAccess.MakeDirRecursiveAbsolute(shotsDir); DirAccess.MakeDirRecursiveAbsolute(shotsDir);
GetViewport().GetTexture().GetImage()?.SavePng(shotsDir.TrimEnd('/') + "/novel_flow_" + name + ".png"); ViewportCapture.SavePng(GetViewport(), shotsDir.TrimEnd('/') + "/novel_flow_" + name + ".png");
} }
private void Finish() private void Finish()
@@ -7,6 +7,7 @@ using Cthangover.Core.Utils;
using Cthangover.Mods.Interface.Menu; using Cthangover.Mods.Interface.Menu;
using Cthangover.Mods.Interface.Tool; using Cthangover.Mods.Interface.Tool;
using Cthangover.Tools.Hub; using Cthangover.Tools.Hub;
using Cthangover.Mods.Interface.View;
using Godot; using Godot;
namespace Cthangover.Tools.Tests.Windows namespace Cthangover.Tools.Tests.Windows
@@ -190,9 +191,8 @@ namespace Cthangover.Tools.Tests.Windows
var dir = ProjectSettings.GlobalizePath(_shotsDir); var dir = ProjectSettings.GlobalizePath(_shotsDir);
Directory.CreateDirectory(dir); Directory.CreateDirectory(dir);
var image = GetViewport().GetTexture().GetImage();
var path = Path.Combine(dir, id + ".png"); var path = Path.Combine(dir, id + ".png");
image.SavePng(path); ViewportCapture.SavePng(GetViewport(), path);
Log($"screenshot {path}"); Log($"screenshot {path}");
} }