bevy/crates
ickshonpe 9098973fb9
Draw the UI debug overlay using the UI renderer (#16693)
# Objective

Draw the UI debug overlay using the UI renderer.

Significantly simpler and easier to use than
`bevy_dev_tools::ui_debug_overlay` which uses `bevy_gizmos`.
* Supports multiple windows and UI rendered to texture.
* Draws rounded debug rects for rounded UI nodes. 

Fixes #16666

## Solution

Removed the `ui_debug_overlay` module from `bevy_dev_tools`.

Added a `bevy_ui_debug` feature gate.

Draw the UI debug overlay using the UI renderer.
Adds a new module `bevy_ui::render::debug_overlay`. 

The debug overlay extraction function queries for the existing UI layout
and then adds a border around each UI node with `u32::MAX / 2` added to
each stack index so it's drawn on top.

There is a `UiDebugOptions` resource that can be used to enable or
disable the debug overlay and set the line width.

## Testing

The `testbed_ui` example has been changed to use the new debug overlay:

```
cargo run --example testbed_ui --features bevy_ui_debug
```

Press Space to toggle the debug overlay on and off.

---

## Showcase

<img width="961" alt="testbed-ui-new-debug"
src="https://github.com/user-attachments/assets/e9523d18-39ae-46a8-adbe-7d3f3ab8e951">

## Migration Guide

The `ui_debug_overlay` module has been removed from `bevy_dev_tools`.
There is a new debug overlay implemented using the `bevy_ui` renderer.
To use it, enable the `bevy_ui_debug` feature and set the `enable` field
of the `UiDebugOptions` resource to `true`.
2024-12-11 00:49:47 +00:00
..
bevy_a11y Remove accesskit re-export from bevy_a11y (#16257) 2024-11-08 21:01:16 +00:00
bevy_animation Update hashbrown to 0.15 (#15801) 2024-12-10 19:45:50 +00:00
bevy_app Update hashbrown to 0.15 (#15801) 2024-12-10 19:45:50 +00:00
bevy_asset Update hashbrown to 0.15 (#15801) 2024-12-10 19:45:50 +00:00
bevy_audio Update rodio requirement from 0.19 to 0.20 (#16359) 2024-12-03 17:55:42 +00:00
bevy_color Deny derive_more error feature and replace it with thiserror (#16684) 2024-12-06 17:03:55 +00:00
bevy_core Update hashbrown to 0.15 (#15801) 2024-12-10 19:45:50 +00:00
bevy_core_pipeline Update hashbrown to 0.15 (#15801) 2024-12-10 19:45:50 +00:00
bevy_derive move ANDROID_APP to bevy_window (#15585) 2024-10-02 03:01:06 +00:00
bevy_dev_tools Draw the UI debug overlay using the UI renderer (#16693) 2024-12-11 00:49:47 +00:00
bevy_diagnostic Update hashbrown to 0.15 (#15801) 2024-12-10 19:45:50 +00:00
bevy_dylib Generate links to definition in source code pages on docs.rs and dev-docs.bevyengine.org (#12965) 2024-07-29 23:10:16 +00:00
bevy_ecs Update hashbrown to 0.15 (#15801) 2024-12-10 19:45:50 +00:00
bevy_encase_derive Update `glam to 0.29, encase` to 0.10. (#15249) 2024-09-23 19:44:02 +00:00
bevy_gilrs Deny derive_more error feature and replace it with thiserror (#16684) 2024-12-06 17:03:55 +00:00
bevy_gizmos ✏️ Fix typos across bevy (#16702) 2024-12-08 01:18:39 +00:00
bevy_gltf Update hashbrown to 0.15 (#15801) 2024-12-10 19:45:50 +00:00
bevy_hierarchy Rename EntityCommands::clone to clone_and_spawn (#16696) 2024-12-10 03:26:15 +00:00
bevy_image ✏️ Fix typos across bevy (#16702) 2024-12-08 01:18:39 +00:00
bevy_input Deny derive_more error feature and replace it with thiserror (#16684) 2024-12-06 17:03:55 +00:00
bevy_input_focus bevy_input_focus improvements (follow-up PR) (#16665) 2024-12-06 01:16:52 +00:00
bevy_internal Draw the UI debug overlay using the UI renderer (#16693) 2024-12-11 00:49:47 +00:00
bevy_log Use en-us locale for typos (#16037) 2024-10-20 18:55:17 +00:00
bevy_macro_utils Modify derive_label to support no_std environments (#15465) 2024-09-27 20:23:26 +00:00
bevy_math Derivative access patterns for curves (#16503) 2024-12-10 20:27:37 +00:00
bevy_mesh Update hashbrown to 0.15 (#15801) 2024-12-10 19:45:50 +00:00
bevy_mikktspace Use en-us locale for typos (#16037) 2024-10-20 18:55:17 +00:00
bevy_pbr Update hashbrown to 0.15 (#15801) 2024-12-10 19:45:50 +00:00
bevy_picking Update hashbrown to 0.15 (#15801) 2024-12-10 19:45:50 +00:00
bevy_ptr Fix MSRVs for standalone crates (#16333) 2024-11-17 09:38:13 +00:00
bevy_reflect Update hashbrown to 0.15 (#15801) 2024-12-10 19:45:50 +00:00
bevy_remote Update hashbrown to 0.15 (#15801) 2024-12-10 19:45:50 +00:00
bevy_render Update hashbrown to 0.15 (#15801) 2024-12-10 19:45:50 +00:00
bevy_scene Update hashbrown to 0.15 (#15801) 2024-12-10 19:45:50 +00:00
bevy_sprite Update hashbrown to 0.15 (#15801) 2024-12-10 19:45:50 +00:00
bevy_state Make StateTransitionSteps public (#16612) 2024-12-03 19:48:00 +00:00
bevy_tasks Add no_std support to bevy_tasks (#15464) 2024-12-06 02:14:54 +00:00
bevy_text fix tiny copy-paste mistake in bevy_text::font_atlas_set (#16667) 2024-12-10 03:17:09 +00:00
bevy_time Use en-us locale for typos (#16037) 2024-10-20 18:55:17 +00:00
bevy_transform Deny derive_more error feature and replace it with thiserror (#16684) 2024-12-06 17:03:55 +00:00
bevy_ui Draw the UI debug overlay using the UI renderer (#16693) 2024-12-11 00:49:47 +00:00
bevy_utils Update hashbrown to 0.15 (#15801) 2024-12-10 19:45:50 +00:00
bevy_window add missing type registration for Monitor (#16685) 2024-12-06 15:20:10 +00:00
bevy_winit Rename trigger.entity() to trigger.target() (#16716) 2024-12-08 21:55:09 +00:00