Skip to content

Add a dock tree data model to bevy_ui_widgets - #26034

Open
jbuehler23 wants to merge 3 commits into
bevyengine:mainfrom
jbuehler23:jackdaw/dock-tree
Open

jbuehler23 wants to merge 3 commits into
bevyengine:mainfrom
jbuehler23:jackdaw/dock-tree

Conversation

@jbuehler23

@jbuehler23 jbuehler23 commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Objective

Part of #25958.

Dockable panel layouts need a model of which panels sit in which tab groups and how the space is split, separate from the UI that shows them, so layouts can be edited, saved and restored.

Solution

A dock module in bevy_ui_widgets with the dock tree as plain data. Leaves are tab groups and splits hold weighted children, with weights that match the split pane so the next PR can turn the tree straight into split panes and tab lists.

  • DockTree component, so an app can have more than one dock
  • tabs point at content through a DockPanelKey the app maps to what it builds
  • add, split at an edge, move, move to an edge, remove, set active and set sizes, all returning an error for invalid ids
  • simplify removes empty groups and collapses single child splits
  • serialization behind the serialize feature

There's no UI here yet, building it from the tree comes next.

AI disclosure

This is ported from the dock tree in Jackdaw. I had AI move it into bevy_ui_widgets, strip the editor specific parts and change splits to weighted children so they line up with the split pane, then port and extend the tests. I reviewed the model and the changes from the original.

@alice-i-cecile alice-i-cecile added C-Feature A new feature, making something new possible A-UI Graphical user interfaces, styles, layouts, and widgets M-Release-Note Work that should be called out in the blog due to impact S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Oct 5, 2026
@alice-i-cecile

Copy link
Copy Markdown
Member

Why a distinct crate rather than a module in bevy_ui_widgets? Are we expecting that much complexity? It's not technically a widget, maybe, but it really operates at a similar level. My preference here is to stick it in the existing crate unless there's a really strong reason to spin it off.

We can always feature flag this too to reduce compile times etc if it ever matters.

@alice-i-cecile alice-i-cecile added S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged and removed S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Oct 5, 2026
Comment thread crates/bevy_ui_dock/src/tree.rs Outdated
Comment thread crates/bevy_ui_dock/src/tree.rs Outdated
Comment thread crates/bevy_ui_dock/src/tree.rs Outdated
Comment thread crates/bevy_ui_dock/src/tree.rs Outdated
@jbuehler23 jbuehler23 changed the title Add bevy_ui_dock with a dock tree data model Add a dock tree data model to bevy_ui_widgets Oct 6, 2026
@jbuehler23

Copy link
Copy Markdown
Contributor Author

Fair, moved it into bevy_ui_widgets as a dock module, no feature flag since it's plain data.

@alice-i-cecile alice-i-cecile added the A-Editor Graphical tools to make Bevy games label Oct 6, 2026
@alice-i-cecile
alice-i-cecile requested a review from viridia October 6, 2026 18:49
@alice-i-cecile alice-i-cecile added X-Contentious There are nontrivial implications that should be thought through D-Modest A "normal" level of difficulty; suitable for simple features or challenging fixes S-Needs-Review Needs reviewer attention (from anyone!) to move forward and removed S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged labels Oct 6, 2026

@viridia viridia left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very interesting. Just some preliminary questions at this point.

@@ -0,0 +1,44 @@
//! Dock layouts for Bevy UI, described as plain data.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this meant to be a representational source of truth, or a wire format derived from the scene?

Reading further down, I see that it is a component. What entity owns it?

I'm a little fuzzy on the lifecycle - if this is derived from the scene, it makes sense, since extracting this would make it easier to serialize. If OTOH the scene is derived from this, I'm not as clear why the scene isn't the source of truth (I'm sure there's a reason, I just don't know it yet.)

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Editor Graphical tools to make Bevy games A-UI Graphical user interfaces, styles, layouts, and widgets C-Feature A new feature, making something new possible D-Modest A "normal" level of difficulty; suitable for simple features or challenging fixes M-Release-Note Work that should be called out in the blog due to impact S-Needs-Review Needs reviewer attention (from anyone!) to move forward X-Contentious There are nontrivial implications that should be thought through

Projects

Status: Needs SME Triage

Development

Successfully merging this pull request may close these issues.

3 participants