mirror of
https://github.com/bevyengine/bevy
synced 2024-11-22 12:43:34 +00:00
f86ee32576
# Objective - Fixes #14826 - For context, see #15238 ## Solution Add a `GhostNode` component to `bevy_ui` and update all the relevant systems to use it to traverse for UI children. - [x] `ghost_hierarchy` module - [x] Add `GhostNode` - [x] Add `UiRootNodes` system param for iterating (ghost-aware) UI root nodes - [x] Add `UiChildren` system param for iterating (ghost-aware) UI children - [x] Update `layout::ui_layout_system` - [x] Use ghost-aware root nodes for camera updates - [x] Update and remove children in taffy - [x] Initial spawn - [x] Detect changes on nested UI children - [x] Use ghost-aware children traversal in `update_uinode_geometry_recursive` - [x] Update the rest of the UI systems to use the ghost hierarchy - [x] `stack::ui_stack_system` - [x] `update::` - [x] `update_clipping_system` - [x] `update_target_camera_system` - [x] `accessibility::calc_name` ## Testing - [x] Added a new example `ghost_nodes` that can be used as a testbed. - [x] Added unit tests for _some_ of the traversal utilities in `ghost_hierarchy` - [x] Ensure this fulfills the needs for currently known use cases - [x] Reactivity libraries (test with `bevy_reactor`) - [ ] Text spans (mentioned by koe [on discord](https://discord.com/channels/691052431525675048/1285371432460881991/1285377442998915246)) --- ## Performance [See comment below](https://github.com/bevyengine/bevy/pull/15341#issuecomment-2385456820) ## Migration guide Any code that previously relied on `Parent`/`Children` to iterate UI children may now want to use `bevy_ui::UiChildren` to ensure ghost nodes are skipped, and their first descendant Nodes included. UI root nodes may now be children of ghost nodes, which means `Without<Parent>` might not query all root nodes. Use `bevy_ui::UiRootNodes` where needed to iterate root nodes instead. ## Potential future work - Benchmarking/optimizations of hierarchies containing lots of ghost nodes - Further exploration of UI hierarchies and markers for root nodes/leaf nodes to create better ergonomics for things like `UiLayer` (world-space ui) --------- Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com> Co-authored-by: UkoeHB <37489173+UkoeHB@users.noreply.github.com> |
||
---|---|---|
.. | ||
borders.rs | ||
button.rs | ||
display_and_visibility.rs | ||
flex_layout.rs | ||
font_atlas_debug.rs | ||
ghost_nodes.rs | ||
grid.rs | ||
overflow.rs | ||
overflow_debug.rs | ||
relative_cursor_position.rs | ||
render_ui_to_texture.rs | ||
scroll.rs | ||
size_constraints.rs | ||
text.rs | ||
text_debug.rs | ||
text_wrap_debug.rs | ||
transparency_ui.rs | ||
ui.rs | ||
ui_material.rs | ||
ui_scaling.rs | ||
ui_texture_atlas.rs | ||
ui_texture_atlas_slice.rs | ||
ui_texture_slice.rs | ||
ui_texture_slice_flip_and_tile.rs | ||
viewport_debug.rs | ||
window_fallthrough.rs | ||
z_index.rs |