Docking: Fixed bad bug, dock node host wouldn't merge background. (#6753, #6716)

Fixes f422e78. Didn't crash because g.Windows[] is always larger than g.WindowsFocusOrder[].
This commit is contained in:
ocornut 2023-08-28 11:24:29 +02:00
parent 475453668d
commit 762ec445e6

View File

@ -5341,20 +5341,16 @@ void ImGui::Render()
CallContextHooks(&g, ImGuiContextHookType_RenderPre);
// Add background ImDrawList (for each active viewport)
for (int n = 0; n != g.Viewports.Size; n++)
for (ImGuiViewportP* viewport : g.Viewports)
{
ImGuiViewportP* viewport = g.Viewports[n];
InitViewportDrawData(viewport);
if (viewport->BgFgDrawLists[0] != NULL)
AddDrawListToDrawDataEx(&viewport->DrawDataP, viewport->DrawDataBuilder.Layers[0], GetBackgroundDrawList(viewport));
}
for (int n = 0; n != g.WindowsFocusOrder.Size; n++)
{
ImGuiWindow* window = g.Windows[n];
for (ImGuiWindow* window : g.WindowsFocusOrder)
if (window->Flags & ImGuiWindowFlags_DockNodeHost)
window->DrawList->ChannelsMerge();
}
// Draw modal/window whitening backgrounds
RenderDimmedBackgrounds();