Trouble creating a default docked layout


Hi everyone!

First up, huge thanks to ocornut for ImGui. It’s great!

I recently switched to the Docking branch of ImGui (currently running 09c9bf2edb1742941aeb2676a8198210b529059b, i.e. the latest commit), and now I’m trying to create a default layout where windows are docked into each other. The only documentation I could find for doing this was this post. But when I try to follow it I trigger assertions inside ImGui.

I’m essentially doing something like this:

bool dockSpaceCreated = ImGui::DockBuilderGetNode(mConsoleDockSpaceId) != nullptr;
if (!dockSpaceCreated) {
    mConsoleDockSpaceId = ImGui::GetID("ConsoleDockSpace");

    ImGuiDockNodeFlags dockSpaceFlags = 0;
    dockSpaceFlags |= ImGuiDockNodeFlags_PassthruDockspace;
    ImGui::DockBuilderAddNode(mConsoleDockSpaceId, dockSpaceFlags);

    ImGuiID dockMain = mConsoleDockSpaceId;
    ImGuiID dockLeft = ImGui::DockBuilderSplitNode(dockMain, ImGuiDir_Left, 0.40f, NULL, &dockMain);

    // ...

At the call to ImGui::DockBuilderSplitNode() I get the assertion IM_ASSERT(target_node->LastFrameAlive < g.FrameCount); inside ImGui::DockContextProcessDock(), row 10628.

So I guess my question is am I doing this correctly or is this a bug in the current version of ImGui? Also is there any documentation or examples I have missed for how to do this?


Could you post this (with the repro) in a new github isssue? Thank you.


Created the issue: