bevy/examples/ui
Alice Cecile 76744bf58c
Mark ghost nodes as experimental and partially feature flag them (#15961)
# Objective

As discussed in #15341, ghost nodes are a contentious and experimental
feature. In the interest of enabling ecosystem experimentation, we've
decided to keep them in Bevy 0.15.

That said, we don't use them internally, and don't expect third-party
crates to support them. If the experimentation returns a negative result
(they aren't very useful, an alternative design is preferred etc) they
will be removed.

We should clearly communicate this status to users, and make sure that
users don't use ghost nodes in their projects without a very clear
understanding of what they're getting themselves into.

## Solution

To make life easy for users (and Bevy), `GhostNode` and all associated
helpers remain public and are always available.

However, actually constructing these requires enabling a feature flag
that's clearly marked as experimental. To do so, I've added a
meaningless private field.

When the feature flag is enabled, our constructs (`new` and `default`)
can be used. I've added a `new` constructor, which should be preferred
over `Default::default` as that can be readily deprecated, allowing us
to prompt users to swap over to the much nicer `GhostNode` syntax once
this is a unit struct again.

Full credit: this was mostly @cart's design: I'm just implementing it!

## Testing

I've run the ghost_nodes example and it fails to compile without the
feature flag. With the feature flag, it works fine :)

---------

Co-authored-by: Zachary Harrold <zac@harrold.com.au>
2024-10-16 22:20:48 +00:00
..
borders.rs split up TextStyle (#15857) 2024-10-13 17:06:22 +00:00
box_shadow.rs box shadow (#15204) 2024-10-08 16:26:17 +00:00
button.rs split up TextStyle (#15857) 2024-10-13 17:06:22 +00:00
display_and_visibility.rs split up TextStyle (#15857) 2024-10-13 17:06:22 +00:00
flex_layout.rs split up TextStyle (#15857) 2024-10-13 17:06:22 +00:00
font_atlas_debug.rs split up TextStyle (#15857) 2024-10-13 17:06:22 +00:00
ghost_nodes.rs Mark ghost nodes as experimental and partially feature flag them (#15961) 2024-10-16 22:20:48 +00:00
grid.rs split up TextStyle (#15857) 2024-10-13 17:06:22 +00:00
overflow.rs Clip to the UI node's content box (#15442) 2024-10-15 02:05:08 +00:00
overflow_clip_margin.rs Overflow clip margin (#15561) 2024-10-16 13:17:49 +00:00
overflow_debug.rs aligning public apis of Time,Timer and Stopwatch (#15962) 2024-10-16 21:09:32 +00:00
relative_cursor_position.rs Migrate from Query::single and friends to Single (#15872) 2024-10-13 20:32:06 +00:00
render_ui_to_texture.rs aligning public apis of Time,Timer and Stopwatch (#15962) 2024-10-16 21:09:32 +00:00
scroll.rs split up TextStyle (#15857) 2024-10-13 17:06:22 +00:00
size_constraints.rs Migrate from Query::single and friends to Single (#15872) 2024-10-13 20:32:06 +00:00
text.rs aligning public apis of Time,Timer and Stopwatch (#15962) 2024-10-16 21:09:32 +00:00
text_debug.rs aligning public apis of Time,Timer and Stopwatch (#15962) 2024-10-16 21:09:32 +00:00
text_wrap_debug.rs split up TextStyle (#15857) 2024-10-13 17:06:22 +00:00
transparency_ui.rs split up TextStyle (#15857) 2024-10-13 17:06:22 +00:00
ui.rs Add shadows to ui example (#15952) 2024-10-16 16:47:11 +00:00
ui_material.rs aligning public apis of Time,Timer and Stopwatch (#15962) 2024-10-16 21:09:32 +00:00
ui_scaling.rs split up TextStyle (#15857) 2024-10-13 17:06:22 +00:00
ui_texture_atlas.rs split up TextStyle (#15857) 2024-10-13 17:06:22 +00:00
ui_texture_atlas_slice.rs split up TextStyle (#15857) 2024-10-13 17:06:22 +00:00
ui_texture_slice.rs split up TextStyle (#15857) 2024-10-13 17:06:22 +00:00
ui_texture_slice_flip_and_tile.rs Migrate cameras to required components (#15641) 2024-10-05 01:59:52 +00:00
viewport_debug.rs aligning public apis of Time,Timer and Stopwatch (#15962) 2024-10-16 21:09:32 +00:00
window_fallthrough.rs Migrate from Query::single and friends to Single (#15872) 2024-10-13 20:32:06 +00:00
z_index.rs Migrate cameras to required components (#15641) 2024-10-05 01:59:52 +00:00