bevyengine / bevyengine/bevy

Simplified `GhostNode`s implementation

Open
#25,150 0 comments 0 reactions 0 assignees View on GitHub
A-UI C-Code-Quality C-Performance C-Usability S-Ready-For-Implementation
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 16h
Merged PRs (30d)
171

Description

## What problem does this solve or what need does it fill?

`GhostNode`s force all code interacting with UI nodes to use the `UiChildren` and `UiRootNodes` system params, instead of regular queries that filter for `Children`/`ChildOf`. They add complexity, aren't performant, and are a constant and recurring source of bugs. In particular, incremental updates are significantly more difficult to implement because we have to consider `GhostNode` traversal.

## What solution would you like?

- Remove the `ghost_nodes` feature and all the feature gates.
- Remove the `UiChildren` and `UiRootNodes` systems params. Replace them with regular queries.
- Keep the `GhostNode` marker component. Have it require `Node` for the transitive requirements and propagation, but ignore `Node`s properties when the `GhostNode` marker is present.
- In `ui_layout_system` skip entities with `GhostNode` and replace them with their children during taffy layout updates.
- Update the `GhostNode` tests as needed.

## What alternative(s) have you considered?

Remove the `GhostNode` feature completely and reimplement the mechanism using BSN. I'm not sure what that would entail, but I assume it would be significantly more challenging to implement.

Contributor guide

Open the contributing guide

Research direction

Start by locating the ghost_nodes feature gates, the UiChildren and UiRootNodes system params, the ui_layout_system, and the GhostNode tests. Trace how GhostNode traversal currently affects layout and propagation, then verify that regular Children/ChildOf queries, transitive Node requirements, and the updated tests cover the requested behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
frontend
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.