Skip to content

ComputedStackIndex component#23878

Merged
alice-i-cecile merged 14 commits intobevyengine:mainfrom
ickshonpe:uistackindex-component
Apr 19, 2026
Merged

ComputedStackIndex component#23878
alice-i-cecile merged 14 commits intobevyengine:mainfrom
ickshonpe:uistackindex-component

Conversation

@ickshonpe
Copy link
Copy Markdown
Contributor

@ickshonpe ickshonpe commented Apr 18, 2026

Objective

Split off the stack index field from ComputedNode into its own specialized component.

  • Makes for a cleaner UI schedule and a clearer division of responsibilities.
  • More fine-grained change detection, might allow for some new optimisations.

Fixes #23862

Solution

  • Remove the stack_index field and its accessor from ComputedNode.
  • New component ComputedStackIndex, newtyping a u32.
  • Require ComputedStackIndex on ComputedNode.
  • In ui_stack_system, query for and update ComputedStackIndex instead of ComputedNode.
  • In rendering add queries for ComputedStackIndex.
  • Removed the ambiguity supression for ui_stack_system, as no longer needed.

Notes

  • ui_stack_system should probably replace its With<Node> query filters with With<ComputedStackIndex>. It uses the ghost hierarchy navigation params though, which complicates things, so I left them alone here.
  • In the future it might make sense to make the value optional, with None indicating the UI node was removed from the layout via Display::None.

@ickshonpe ickshonpe added A-Rendering Drawing game state to the screen A-UI Graphical user interfaces, styles, layouts, and widgets A-Picking Pointing at and selecting objects of all sorts labels Apr 18, 2026
@github-project-automation github-project-automation Bot moved this to Needs SME Triage in Rendering Apr 18, 2026
@github-project-automation github-project-automation Bot moved this to Needs SME Triage in UI Apr 18, 2026
@ickshonpe ickshonpe added C-Code-Quality A section of code that is hard to understand or change D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Needs-Review Needs reviewer attention (from anyone!) to move forward M-Migration-Guide A breaking change to Bevy's public API that needs to be noted in a migration guide labels Apr 18, 2026
Copy link
Copy Markdown
Contributor

@andriyDev andriyDev left a comment

Choose a reason for hiding this comment

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

Should we also revert the changes in #23854?

@ickshonpe
Copy link
Copy Markdown
Contributor Author

Should we also revert the changes in #23854?

Just gonna check if it's no longer needed with the ambiguity detector.

@ickshonpe
Copy link
Copy Markdown
Contributor Author

Should we also revert the changes in #23854?

Even better, we can nuke all the ambiguity supression around ui_stack_system now.

@alice-i-cecile alice-i-cecile added the X-Uncontroversial This work is generally agreed upon label Apr 18, 2026
Copy link
Copy Markdown
Contributor

@andriyDev andriyDev left a comment

Choose a reason for hiding this comment

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

Nice! I also verified this satisfies the strict ambiguities too (which I'm guessing you also ran yourself haha).

@github-actions

This comment was marked as resolved.

Copy link
Copy Markdown
Contributor

@kfc35 kfc35 left a comment

Choose a reason for hiding this comment

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

lgtm for correctness, and happy to be rid of some ambiguities

@kfc35 kfc35 added S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it and removed S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Apr 19, 2026
@alice-i-cecile alice-i-cecile added this pull request to the merge queue Apr 19, 2026
Merged via the queue into bevyengine:main with commit 42aeb76 Apr 19, 2026
38 checks passed
@github-project-automation github-project-automation Bot moved this from Needs SME Triage to Done in UI Apr 19, 2026
@github-project-automation github-project-automation Bot moved this from Needs SME Triage to Done in Rendering Apr 19, 2026
pull Bot pushed a commit to octoape/bevy that referenced this pull request Apr 22, 2026
…evyengine#23939)

# Objective

Use `set_if_neq` to update the `ComputedStackIndex`s in
`ui_stack_system` to enable change detection.

(Missed in bevyengine#23878)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Picking Pointing at and selecting objects of all sorts A-Rendering Drawing game state to the screen A-UI Graphical user interfaces, styles, layouts, and widgets C-Code-Quality A section of code that is hard to understand or change D-Straightforward Simple bug fixes and API improvements, docs, test and examples M-Migration-Guide A breaking change to Bevy's public API that needs to be noted in a migration guide S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it X-Uncontroversial This work is generally agreed upon

Projects

Status: Done
Status: Done

Development

Successfully merging this pull request may close these issues.

Stack index should be moved off of ComputedNode

5 participants