From 95059d4fc31d33c338d35c5522848ba7e235cf20 Mon Sep 17 00:00:00 2001 From: Stanislav Denisov Date: Thu, 26 Feb 2026 15:35:05 +0100 Subject: [PATCH] Implement persistence for the profiler window's size (#1568) --- Editor/ProfilerWindow.cpp | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/Editor/ProfilerWindow.cpp b/Editor/ProfilerWindow.cpp index 86b8a8495..e094736d9 100644 --- a/Editor/ProfilerWindow.cpp +++ b/Editor/ProfilerWindow.cpp @@ -33,8 +33,27 @@ void ProfilerWindow::Create(EditorComponent* _editor) profilerWidget.SetSize(XMFLOAT2(200, 1000)); AddWidget(&profilerWidget); - SetSize(XMFLOAT2(300, 400)); - SetPos(XMFLOAT2(5, 100)); + auto size = XMFLOAT2(300, 400); + if (editor->main->config.GetSection("layout").Has("profiler.width")) + { + size.x = editor->main->config.GetSection("layout").GetFloat("profiler.width"); + } + if (editor->main->config.GetSection("layout").Has("profiler.height")) + { + size.y = editor->main->config.GetSection("layout").GetFloat("profiler.height"); + } + SetSize(size); + + auto pos = XMFLOAT2(5, 100); + if (editor->main->config.GetSection("layout").Has("profiler.x")) + { + pos.x = editor->main->config.GetSection("layout").GetFloat("profiler.x"); + } + if (editor->main->config.GetSection("layout").Has("profiler.y")) + { + pos.y = editor->main->config.GetSection("layout").GetFloat("profiler.y"); + } + SetPos(pos); SetVisible(false); SetShadowRadius(2); } @@ -64,5 +83,10 @@ void ProfilerWindow::ResizeLayout() { wi::gui::Window::ResizeLayout(); + editor->main->config.GetSection("layout").Set("profiler.width", GetSize().x); + editor->main->config.GetSection("layout").Set("profiler.height", GetSize().y); + editor->main->config.GetSection("layout").Set("profiler.x", translation.x); + editor->main->config.GetSection("layout").Set("profiler.y", translation.y); + profilerWidget.SetSize(XMFLOAT2(GetWidgetAreaSize().x - control_size, profilerWidget.GetSize().y)); }