Support nested splits in the default dock layout #6
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
DockLayout(engine/include/sophia/ui/dock_layout.hpp) can only describe four fixed regions (left, right, bottom, center), and each region is a single tab group. There is no way to say "split the bottom region into Asset Browser and Console side by side", or to nest further splits inside any region.Users can already drag panels onto each other at runtime to tab or split them, and
imgui.inipersists the result. This issue is only about expressing nested splits in the default layout.Background
ImGuiRenderer::applyLayoutIfNeeded(engine/src/imgui_renderer.cpp) hard-codes threeDockBuilderSplitNodecalls (left, right, bottom) and docks each region's window list into the resulting node.panels().setDefaultLayout(...)in the application'sonCreate().Proposal
Replace the four fixed fields with a recursive tree, so a node is either a split or a tab group:
Left/Right/Up/Down), a ratio for the first child, and two children.Example: bottom = split
Rightat 0.5 of{Asset Browser}and{Console}.applyLayoutIfNeededthen walks the tree, callingDockBuilderSplitNodeat each split andDockBuilderDockWindowat each leaf.Acceptance criteria
reset_layout.DockLayoutfields are removed.Open questions
split(Dir::Right, 0.5f, a, b)andtabs({...})? Deep trees are awkward to write as nested braces.ImGui::DockSpace()inside a window and separate node ids, so it should be a separate issue if we want it.