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

Allow Splitting dockId multiple times #8471

Closed
wants to merge 1,552 commits into from
Closed

Conversation

MegaMech
Copy link

@MegaMech MegaMech commented Mar 7, 2025

This allows splitting a dock node so that you can create a left/right/up/down docking location programmatically.

Without this, the programmer can only split one direction off of the main dockId which prevents docking multiple windows to the other sides of the main program window.

Example:

    const ImGuiID dockId = ImGui::GetID("main_dock");
    if (!ImGui::DockBuilderGetNode(dockId)) {
        ImGui::DockBuilderRemoveNode(dockId);
        ImGui::DockBuilderAddNode(dockId, ImGuiDockNodeFlags_NoTabBar);

        ImGui::DockBuilderDockWindow("Main Game", dockId);

        ImGuiID rightId = ImGui::DockBuilderSplitNode(dockId, ImGuiDir_Right, 0.25f, nullptr, nullptr);
        ImGuiID topId = ImGui::DockBuilderSplitNode(dockId, ImGuiDir_Up, 0.25f, nullptr, nullptr);
        ImGuiID bottomId = ImGui::DockBuilderSplitNode(dockId, ImGuiDir_Down, 0.25f, nullptr, nullptr);
        ImGui::DockBuilderSetNodeSize(rightId, ImVec2(viewport->Size.x * 0.2f, viewport->Size.y));
        ImGui::DockBuilderSetNodeSize(topId, ImVec2(viewport->Size.x, viewport->Size.y * 0.1f));
        ImGui::DockBuilderSetNodeSize(bottomId, ImVec2(viewport->Size.x, viewport->Size.y * 0.1f));
        
        ImGui::DockBuilderDockWindow("Scene Explorer", rightId);
        ImGui::DockBuilderDockWindow("Tools", topId);
        ImGui::DockBuilderDockWindow("Content Browser", bottomId);

        ImGui::DockBuilderFinish(dockId);
    }

    ImGui::DockSpace(dockId, ImVec2(0.0f, 0.0f), ImGuiDockNodeFlags_None | ImGuiDockNodeFlags_NoDockingInCentralNode);

ocornut added 30 commits July 20, 2023 23:18
# Conflicts:
#	backends/imgui_impl_dx10.cpp
#	backends/imgui_impl_dx11.cpp
#	backends/imgui_impl_dx12.cpp
#	backends/imgui_impl_dx9.cpp
#	backends/imgui_impl_glfw.cpp
#	backends/imgui_impl_opengl2.cpp
#	backends/imgui_impl_opengl3.cpp
#	backends/imgui_impl_osx.mm
#	backends/imgui_impl_sdl2.cpp
#	backends/imgui_impl_sdl3.cpp
#	backends/imgui_impl_vulkan.cpp
#	backends/imgui_impl_win32.cpp
# Conflicts:
#	imgui.cpp
#	imgui.h
#	imgui_internal.h
… match the sum of individual ImDrawList's buffer sizes. (ocornut#6716)

Amend dbeeeae
ac64b65 on master seemed incorrect.

# Conflicts:
#	docs/CHANGELOG.txt
#	imgui.cpp
#	imgui_internal.h
#	imgui_widgets.cpp
…e ItemInnerSpacing.x between title bar buttons. Amend for Docking. (ocornut#6749)
…ornut#6753, ocornut#6716)

Fixes f422e78. Didn't crash because g.Windows[] is always larger than g.WindowsFocusOrder[].
…d properly.

Fix f422e78. Fuller version of 08b3a1a pushed in master.
…y while moving a window displays an help tooltip to increase affordance. (ocornut#6709, ocornut#4643)

Hope this doesn't feel spammy?
# Conflicts:
#	imgui.cpp
#	imgui_demo.cpp
# Conflicts:
#	backends/imgui_impl_win32.cpp
#	imgui.cpp
…rnut#6823, ocornut#2999)

NoDocking not marked as saved (it never was). Removed unused ImGuiDockNodeFlags_LocalFlagsMask_.
# Conflicts:
#	imgui.cpp
#	imgui_internal.h
… -> ImGuiDockNodeFlags_NoDockingOverCentralNode, ImGuiDockNodeFlags_NoSplit -> ImGuiDockNodeFlags_NoDockingSplit.

Shuffled other internal flags and added comments.
…ch is required for claiming moue wheel ownership in (unenabled) ImGuiTabBarFlags_FittingPolicyScroll mode.

Amend 5f30191
…Var_TabBarBorderSize. (ocornut#6820, ocornut#4859, ocornut#5022, ocornut#5239)

Removed ImGuiTabItemFlags_Preview. Will need cherry-picking in master.
…tab in dock nodes that don't carry the currently focused window. (ocornut#2304)

In TestSuite: see "docking_tab_focus_restore".
Remove old code ~ ed3c015 8bac6d4 8cac70d
+ Fix potential crash in IMGUI_DEBUG_LOG_DOCKING() path when using amended buttons.
# Conflicts:
#	backends/imgui_impl_win32.cpp
#	imgui.cpp
# Conflicts:
#	imgui.cpp
#	imgui_internal.h
ocornut and others added 29 commits January 22, 2025 12:19
# Conflicts:
#	imgui.cpp
# Conflicts:
#	imgui.cpp
#	imgui_internal.h
#	imgui_widgets.cpp
# Conflicts:
#	imgui.cpp
#	imgui_internal.h
# Conflicts:
#	backends/imgui_impl_metal.mm
#	imgui.cpp
#	imgui_internal.h
# Conflicts:
#	backends/imgui_impl_glfw.cpp
#	backends/imgui_impl_glfw.h
#	examples/example_apple_metal/example_apple_metal.xcodeproj/project.pbxproj
#	imgui.cpp
# Conflicts:
#	backends/imgui_impl_sdl2.cpp
#	backends/imgui_impl_sdl3.cpp
#	imgui.cpp
#	imgui_internal.h
…cornut#8393, ocornut#8385)

Before the assert was introduced in d66f4e5 the viewport would be eventually clamped with ClampWindowPos using g.FallbackMonitor, but code would run temporarly with DpiScale=0.
# Conflicts:
#	backends/imgui_impl_sdl2.cpp
#	backends/imgui_impl_vulkan.cpp
…every frame, as the later may change regardless of monitor changes. (ocornut#8415)
# Conflicts:
#	backends/imgui_impl_glfw.cpp
#	backends/imgui_impl_glfw.h
#	backends/imgui_impl_opengl3.cpp
#	backends/imgui_impl_osx.h
#	backends/imgui_impl_osx.mm
#	backends/imgui_impl_sdl2.cpp
#	backends/imgui_impl_sdl3.cpp
#	backends/imgui_impl_win32.cpp
#	imgui.cpp
… used to store SDL's WindowID, not SDL_Window*. (ocornut#7853)

Amend 2d99052
…nds() fails or return a zero size. (ocornut#8415, ocornut#3457)

Analoguous to aa8e09d for GLFW.
# Conflicts:
#	backends/imgui_impl_dx12.cpp
#	backends/imgui_impl_sdl2.cpp
#	backends/imgui_impl_sdl3.cpp
#	imgui.cpp
# Conflicts:
#	imgui.cpp
#	imgui_internal.h
# Conflicts:
#	backends/imgui_impl_glfw.cpp
# Conflicts:
#	imgui.cpp
@MegaMech MegaMech closed this Mar 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.