Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to set ImGuiDockNodeFlags on nodes created with DockBuilderSplitNode #8099

Open
sodamouse opened this issue Oct 25, 2024 · 1 comment
Open
Labels

Comments

@sodamouse
Copy link

sodamouse commented Oct 25, 2024

Version/Branch of Dear ImGui:

Version 1.91.4, Branch: docking

Back-ends:

imgui_impl_opengl3.cpp + imgui_impl_glfw.cpp

Compiler, OS:

Windows 11 + MSVS 2022

Full config/build information:

No response

Details:

My Issue/Question:

Hello, I am wondering how I can set flags on nodes created via DockBuilderSplitNode. I added node flags to the parent node, but the child doesn't seem to inherit the flags. Also I tried using AddNode on ImGuiIDs belonging to (future) child nodes created by the split function, but this doesn't help me either, so I guess the Split function sets the ID values to something else.

Screenshots/Video:

No response

Minimal, Complete and Verifiable Example code:

static ImGuiID mainDockId;
static ImGuiID dockIdResourcesAndControls;

constexpr ImGuiDockNodeFlags DOCK_NODE_FLAGS =
    ImGuiDockNodeFlags_NoTabBar           |
    ImGuiDockNodeFlags_NoResizeX          |
    ImGuiDockNodeFlags_NoResizeY;

void init_dockspaces(GameMode mode)
{
    switch (mode) {
        case GameMode_Management:
        case GameMode_Report:
        {
            ImGui::DockBuilderRemoveNode(mainDockId);

            // This works fine.
            ImGui::DockBuilderAddNode(mainDockId, DOCK_NODE_FLAGS);

            ImGui::DockBuilderSetNodeSize(mainDockId, ImGui::GetMainViewport()->Size);
 
            // How to add flags here?
            ImGui::DockBuilderSplitNode(mainDockId, ImGuiDir_Right, 0.2f, &dockIdResourcesAndControls, &dockIdMainPort);

            ImGui::DockBuilderDockWindow("MainPort", dockIdMainPort);
            ImGui::DockBuilderDockWindow("ResourcesAndControls", dockIdResourcesAndControls);

            ImGui::DockBuilderFinish(mainDockId);
        }; break;
    }
@sodamouse
Copy link
Author

Since I am using DockSpaceOverViewport, I found that setting the flags there would have them be inherited by the child nodes. While this solves my immediate problem, I think more granular control over child node flags would be useful in many situations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants