bevy/crates
Pablo Reinhardt 1af9bc853b
Add a gizmo-based overlay to show UI node outlines (Adopted) (#11237)
# Objective

- This is an adopted version of #10420
- The objective is to help debugging the Ui layout tree with helpful
outlines, that can be easily enabled/disabled

## Solution

- Like #10420, the solution is using the bevy_gizmos in outlining the
nodes

---

## Changelog

### Added
- Added debug_overlay mod to `bevy_dev_tools`
- Added bevy_ui_debug feature to `bevy_dev_tools`

## How to use
- The user must use `bevy_dev_tools` feature in TOML
- The user must use the plugin UiDebugPlugin, that can be found on
`bevy::dev_tools::debug_overlay`
- Finally, to enable the function, the user must set
`UiDebugOptions::enabled` to true
Someone can easily toggle the function with something like:

```rust
fn toggle_overlay(input: Res<ButtonInput<KeyCode>>, options: ResMut<UiDebugOptions>) {
   if input.just_pressed(KeyCode::Space) {
      // The toggle method will enable if disabled and disable if enabled
      options.toggle();
   }
}
```

Note that this feature can be disabled from dev_tools, as its in fact
behind a default feature there, being the feature bevy_ui_debug.

# Limitations
Currently, due to limitations with gizmos itself, it's not possible to
support this feature to more the one window, so this tool is limited to
the primary window only.

# Showcase


![image](https://github.com/bevyengine/bevy/assets/126117294/ce9d70e6-0a57-4fa9-9753-ff5a9d82c009)
Ui example with debug_overlay enabled


![image](https://github.com/bevyengine/bevy/assets/126117294/e945015c-5bab-4d7f-9273-472aabaf25a9)
And disabled

---------

Co-authored-by: Nicola Papale <nico@nicopap.ch>
Co-authored-by: Pablo Reinhardt <pabloreinhardt@gmail.com>
Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
2024-03-18 18:11:06 +00:00
..
bevy_a11y Bump Version after Release (#12020) 2024-02-21 20:58:59 +00:00
bevy_animation Use async-fn in traits rather than BoxedFuture (#12550) 2024-03-18 17:56:57 +00:00
bevy_app Add "all-features = true" to docs.rs metadata for most crates (#12366) 2024-03-08 20:03:09 +00:00
bevy_asset Use async-fn in traits rather than BoxedFuture (#12550) 2024-03-18 17:56:57 +00:00
bevy_audio Use async-fn in traits rather than BoxedFuture (#12550) 2024-03-18 17:56:57 +00:00
bevy_color bevy_color: Add Tailwind palette (#12080) 2024-03-18 18:06:07 +00:00
bevy_core Add "all-features = true" to docs.rs metadata for most crates (#12366) 2024-03-08 20:03:09 +00:00
bevy_core_pipeline Explain Camera2dBundle.projection needs to be set carefully (#11115) 2024-03-18 17:35:33 +00:00
bevy_derive Bump Version after Release (#12020) 2024-02-21 20:58:59 +00:00
bevy_dev_tools Add a gizmo-based overlay to show UI node outlines (Adopted) (#11237) 2024-03-18 18:11:06 +00:00
bevy_diagnostic Add "all-features = true" to docs.rs metadata for most crates (#12366) 2024-03-08 20:03:09 +00:00
bevy_dylib Bump Version after Release (#12020) 2024-02-21 20:58:59 +00:00
bevy_dynamic_plugin Document all members of bevy_dynamic_plugin (#12029) 2024-02-22 13:28:52 +00:00
bevy_ecs Remove WorldCell (#12551) 2024-03-18 06:28:31 +00:00
bevy_ecs_compile_fail_tests Remove APIs deprecated in 0.13 (#11974) 2024-02-19 19:04:47 +00:00
bevy_encase_derive Bump Version after Release (#12020) 2024-02-21 20:58:59 +00:00
bevy_gilrs Send GamepadEvent for gamepads connected at startup (#12424) 2024-03-11 20:05:10 +00:00
bevy_gizmos Gizmo 3d grids (#12430) 2024-03-13 18:51:53 +00:00
bevy_gltf Use async-fn in traits rather than BoxedFuture (#12550) 2024-03-18 17:56:57 +00:00
bevy_hierarchy Add "all-features = true" to docs.rs metadata for most crates (#12366) 2024-03-08 20:03:09 +00:00
bevy_input Add table showing complexity of methods for Input (#10126) 2024-03-10 23:00:20 +00:00
bevy_internal Fix typo in bevy_internal/Cargo.toml (#12535) 2024-03-17 16:21:33 +00:00
bevy_log Add "all-features = true" to docs.rs metadata for most crates (#12366) 2024-03-08 20:03:09 +00:00
bevy_macro_utils fix deprecations from toml_edit (#12421) 2024-03-11 17:53:38 +00:00
bevy_macros_compile_fail_tests Standardize toml format with taplo (#10594) 2023-11-21 01:04:14 +00:00
bevy_math Add methods to return the inner value for direction types (#12516) 2024-03-18 17:49:58 +00:00
bevy_mikktspace fix some typos (#12038) 2024-02-22 18:55:22 +00:00
bevy_pbr Add setting to enable/disable shadows to MaterialPlugin (#12538) 2024-03-18 17:54:41 +00:00
bevy_ptr Add more comprehensive crate level docs for bevy_ptr (#12391) 2024-03-12 14:04:16 +00:00
bevy_reflect add reflect for BinaryHeap (#12503) 2024-03-17 22:24:04 +00:00
bevy_reflect_compile_fail_tests bevy_reflect: Recursive registration (#5781) 2024-03-04 19:04:10 +00:00
bevy_render Use async-fn in traits rather than BoxedFuture (#12550) 2024-03-18 17:56:57 +00:00
bevy_scene Use async-fn in traits rather than BoxedFuture (#12550) 2024-03-18 17:56:57 +00:00
bevy_sprite Update to fixedbitset 0.5 (#12512) 2024-03-17 18:43:05 +00:00
bevy_tasks Add "all-features = true" to docs.rs metadata for most crates (#12366) 2024-03-08 20:03:09 +00:00
bevy_text Use async-fn in traits rather than BoxedFuture (#12550) 2024-03-18 17:56:57 +00:00
bevy_time Add "all-features = true" to docs.rs metadata for most crates (#12366) 2024-03-08 20:03:09 +00:00
bevy_transform remove link to inexistent example (#12531) 2024-03-17 19:35:00 +00:00
bevy_ui feat: derive some common traits on some UI types (#12532) 2024-03-18 03:41:50 +00:00
bevy_utils Use async-fn in traits rather than BoxedFuture (#12550) 2024-03-18 17:56:57 +00:00
bevy_window Expose Winit's with_skip_taskbar on window creation (#12450) 2024-03-18 17:41:42 +00:00
bevy_winit Expose Winit's with_skip_taskbar on window creation (#12450) 2024-03-18 17:41:42 +00:00