Docking: Fixed not saving .ini file correct if DockingEnable flag is cleared. (#2109)

This commit is contained in:
omar 2018-10-24 12:25:58 +02:00
parent 745fda081e
commit 56ba60ee68

View File

@ -12359,9 +12359,13 @@ static void DockSettingsHandler_DockNodeToSettings(ImGuiDockContext* dc, ImGuiDo
static void ImGui::DockSettingsHandler_WriteAll(ImGuiContext* ctx, ImGuiSettingsHandler* handler, ImGuiTextBuffer* buf) static void ImGui::DockSettingsHandler_WriteAll(ImGuiContext* ctx, ImGuiSettingsHandler* handler, ImGuiTextBuffer* buf)
{ {
ImGuiContext& g = *ctx;
ImGuiDockContext* dc = g.DockContext;
if (!(g.IO.ConfigFlags & ImGuiConfigFlags_DockingEnable))
return;
// Gather settings data // Gather settings data
// (unlike our windows settings, because nodes are always built we can do a full rewrite of the SettingsNode buffer) // (unlike our windows settings, because nodes are always built we can do a full rewrite of the SettingsNode buffer)
ImGuiDockContext* dc = ctx->DockContext;
dc->SettingsNodes.resize(0); dc->SettingsNodes.resize(0);
dc->SettingsNodes.reserve(dc->Nodes.Data.Size); dc->SettingsNodes.reserve(dc->Nodes.Data.Size);
for (int n = 0; n < dc->Nodes.Data.Size; n++) for (int n = 0; n < dc->Nodes.Data.Size; n++)
@ -12774,8 +12778,6 @@ static void SettingsHandlerWindow_WriteAll(ImGuiContext* imgui_ctx, ImGuiSetting
// Gather data from windows that were active during this session // Gather data from windows that were active during this session
// (if a window wasn't opened in this session we preserve its settings) // (if a window wasn't opened in this session we preserve its settings)
ImGuiContext& g = *imgui_ctx; ImGuiContext& g = *imgui_ctx;
if (!(g.IO.ConfigFlags & ImGuiConfigFlags_DockingEnable))
return;
for (int i = 0; i != g.Windows.Size; i++) for (int i = 0; i != g.Windows.Size; i++)
{ {
ImGuiWindow* window = g.Windows[i]; ImGuiWindow* window = g.Windows[i];