diff --git a/.gitignore b/.gitignore index e4dd2df..e4dd654 100644 --- a/.gitignore +++ b/.gitignore @@ -72,3 +72,6 @@ desktop.ini # Temporary files *.tmp *.temp + +# ImGui layout (saved to %APPDATA%\UsdLayerManager at runtime) +imgui.ini diff --git a/imgui.ini b/imgui.ini deleted file mode 100644 index 0e0cff0..0000000 --- a/imgui.ini +++ /dev/null @@ -1,62 +0,0 @@ -[Window][WindowOverViewport_11111111] -Pos=0,22 -Size=1920,1093 -Collapsed=0 - -[Window][Debug##Default] -Pos=60,60 -Size=400,400 -Collapsed=0 - -[Window][Scene Hierarchy] -Pos=0,22 -Size=285,655 -Collapsed=0 -DockId=0x00000001,0 - -[Window][Layer Panel] -Pos=60,60 -Size=121,48 -Collapsed=0 - -[Window][Viewport] -Pos=287,22 -Size=1286,1003 -Collapsed=0 -DockId=0x00000007,0 - -[Window][Property Panel] -Pos=1575,22 -Size=345,1093 -Collapsed=0 -DockId=0x00000006,0 - -[Window][Stage Info] -Pos=0,22 -Size=285,655 -Collapsed=0 -DockId=0x00000001,1 - -[Window][Stage Editor] -Pos=0,679 -Size=285,436 -Collapsed=0 -DockId=0x00000002,0 - -[Window][Timeline] -Pos=287,1027 -Size=1286,88 -Collapsed=0 -DockId=0x00000008,0 - -[Docking][Data] -DockSpace ID=0x08BD597D Window=0x1BBC0F80 Pos=0,22 Size=1920,1093 Split=X - DockNode ID=0x00000005 Parent=0x08BD597D SizeRef=1573,637 Split=X - DockNode ID=0x00000003 Parent=0x00000005 SizeRef=285,637 Split=Y Selected=0xB8729153 - DockNode ID=0x00000001 Parent=0x00000003 SizeRef=289,381 Selected=0xB8729153 - DockNode ID=0x00000002 Parent=0x00000003 SizeRef=289,254 Selected=0xBE78FE5F - DockNode ID=0x00000004 Parent=0x00000005 SizeRef=1286,637 Split=Y Selected=0xC450F867 - DockNode ID=0x00000007 Parent=0x00000004 SizeRef=850,547 CentralNode=1 Selected=0xC450F867 - DockNode ID=0x00000008 Parent=0x00000004 SizeRef=850,88 Selected=0x4F89F0DC - DockNode ID=0x00000006 Parent=0x08BD597D SizeRef=345,637 Selected=0xFA2314A6 - diff --git a/src/ui/ImGuiContext.cpp b/src/ui/ImGuiContext.cpp index 8563b16..8836696 100644 --- a/src/ui/ImGuiContext.cpp +++ b/src/ui/ImGuiContext.cpp @@ -5,6 +5,7 @@ #include #include #include +#include // Forward declare message handler from imgui_impl_win32.cpp extern IMGUI_IMPL_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); @@ -94,6 +95,15 @@ bool ImGuiContext::Initialize(const std::string& windowTitle, int width, int hei // ImGui window is focused, which would block all viewport hotkeys (F, A, etc.). io.ConfigFlags |= ImGuiConfigFlags_DockingEnable; + // Store imgui.ini in %APPDATA%\UsdLayerManager\ so it doesn't litter the CWD. + if (const char* appData = getenv("APPDATA")) { + std::filesystem::path iniDir = + std::filesystem::path(appData) / "UsdLayerManager"; + std::filesystem::create_directories(iniDir); + m_iniFilePath = (iniDir / "imgui.ini").string(); + io.IniFilename = m_iniFilePath.c_str(); + } + // Load Inter font. // The build directory copies the font as Inter.ttc; the install step renames // it to Inter.ttf. Try .ttf first (install layout), fall back to .ttc (build). diff --git a/src/ui/ImGuiContext.h b/src/ui/ImGuiContext.h index 647137b..840d69b 100644 --- a/src/ui/ImGuiContext.h +++ b/src/ui/ImGuiContext.h @@ -36,6 +36,7 @@ private: bool m_shouldClose; int m_width; int m_height; + std::string m_iniFilePath; // persists for the lifetime of the ImGui context }; } // namespace UsdLayerManager