Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplified ui_stack_system #9889

Merged
merged 43 commits into from
Sep 30, 2024
Merged
Show file tree
Hide file tree
Changes from 42 commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
4957851
Query for nodes with zindex global separately then walk the tree fil…
ickshonpe Sep 21, 2023
d03630b
fixed irrefutable pattern,
ickshonpe Sep 21, 2023
35db93a
Moved queries around to see if performance difference.
ickshonpe Sep 21, 2023
5c2e189
Made `Zindex::Local` and `ZIndex::Global` into separate components, `…
ickshonpe Sep 21, 2023
229ad8a
Fixed tests
ickshonpe Sep 21, 2023
805cafe
Added doc comments for GlobalZIndex
ickshonpe Sep 21, 2023
c909250
Fixed ZIndex in examples
ickshonpe Sep 21, 2023
549511b
Update crates/bevy_ui/src/ui_node.rs
ickshonpe Sep 22, 2023
6af7a3b
Update crates/bevy_ui/src/ui_node.rs
ickshonpe Sep 22, 2023
b9dd7ec
Fixed the type names in the test comments
ickshonpe Sep 23, 2023
0111471
Moved the `update_stack_recursively` function outside of `ui_stack_sy…
ickshonpe Sep 23, 2023
6d71e50
Added a test to validate ordering by `ZIndex` when `GlobalZIndex` is …
ickshonpe Sep 23, 2023
a769641
Merge branch 'main' into ui-stack-system-walk
ickshonpe Sep 8, 2024
a13c2a5
update stack indices
ickshonpe Sep 9, 2024
e93b479
use radixsort to sort the rootnodes
ickshonpe Sep 9, 2024
9cebb03
use radsort to sort children
ickshonpe Sep 9, 2024
ed8412b
update nodes during recursive tree traversal
ickshonpe Sep 9, 2024
e750769
Revert "update nodes during recursive tree traversal"
ickshonpe Sep 9, 2024
faddd31
Fixed zindex for fps_overlay
ickshonpe Sep 9, 2024
e99b0bc
fixed wrong syntax
ickshonpe Sep 9, 2024
d049dcf
Fixed imports
ickshonpe Sep 9, 2024
99a4dac
Fixed `shadow_biases` example
ickshonpe Sep 19, 2024
7e754d9
Walk the tree using a loop and stack.
ickshonpe Sep 20, 2024
8804004
clean up
ickshonpe Sep 20, 2024
eae57fe
Merge branch 'main' into ui-stack-system-walk
ickshonpe Sep 20, 2024
339eca5
Merge branch 'main' into ui-stack-system-walk
ickshonpe Sep 20, 2024
f25bf4a
updated `fps_overlay` comments
ickshonpe Sep 20, 2024
c1fba57
Simplified root list construction.
ickshonpe Sep 20, 2024
e1b052b
Improved comment
ickshonpe Sep 20, 2024
da66207
fixed doc test
ickshonpe Sep 20, 2024
8c96e19
Merge branch 'main' into ui-stack-system-walk
ickshonpe Sep 30, 2024
1623770
cache root nodes
ickshonpe Sep 30, 2024
9e9839a
Remove radix sort, cache `z_children`
ickshonpe Sep 30, 2024
3df9c3a
`z_children` vec, sort the traversal stack instead
ickshonpe Sep 30, 2024
3b57640
Removed unused radsort dependency
ickshonpe Sep 30, 2024
92dfd81
walk the stack recursively
ickshonpe Sep 30, 2024
1290d0c
removed unused
ickshonpe Sep 30, 2024
b0c27ac
try smallvec
ickshonpe Sep 30, 2024
158c9c4
removed traversal stack
ickshonpe Sep 30, 2024
99d9a28
Don't need to use `Reverse` for recursive version.
ickshonpe Sep 30, 2024
6a4734e
cache vecs used to contain the sorted children
ickshonpe Sep 30, 2024
36504a9
allow `too_many_arguments` for `ui_stack_system`
ickshonpe Sep 30, 2024
a5e01e4
Documentation fixes
alice-i-cecile Sep 30, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 12 additions & 10 deletions crates/bevy_dev_tools/src/fps_overlay.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ use bevy_render::view::Visibility;
use bevy_text::{Font, Text, TextSection, TextStyle};
use bevy_ui::{
node_bundles::{NodeBundle, TextBundle},
PositionType, Style, ZIndex,
GlobalZIndex, PositionType, Style,
};
use bevy_utils::default;

/// Global [`ZIndex`] used to render the fps overlay.
/// [`GlobalZIndex`] used to render the fps overlay.
///
/// We use a number slightly under `i32::MAX` so you can render on top of it if you really need to.
pub const FPS_OVERLAY_ZINDEX: i32 = i32::MAX - 32;
Expand Down Expand Up @@ -83,16 +83,18 @@ struct FpsText;

fn setup(mut commands: Commands, overlay_config: Res<FpsOverlayConfig>) {
commands
.spawn(NodeBundle {
style: Style {
// We need to make sure the overlay doesn't affect the position of other UI nodes
position_type: PositionType::Absolute,
.spawn((
NodeBundle {
style: Style {
// We need to make sure the overlay doesn't affect the position of other UI nodes
position_type: PositionType::Absolute,
..default()
},
// Render overlay on top of everything
..default()
},
// Render overlay on top of everything
z_index: ZIndex::Global(FPS_OVERLAY_ZINDEX),
..default()
})
GlobalZIndex(FPS_OVERLAY_ZINDEX),
))
.with_children(|c| {
c.spawn((
TextBundle::from_sections([
Expand Down
Loading