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

[bevy_ui/layout] UiSurface update internal mappings #12804

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

StrikeForceZero
Copy link
Contributor

@StrikeForceZero StrikeForceZero commented Mar 30, 2024

This is 4 of 5 iterative PR's that affect bevy_ui/layout

(Supersedes #12719)

The Demotion of a child UI node to root node might be out of scope and could be extracted into another PR. Extracted


Objective

Solution

  • Updated mappings:
    • use EntityHashSet to track relationships camera -> root nodes
    • adds tracking of camera_entity with Option<Entity> in RootNodeData (previously named RootNodePair)

Changelog

Migration Guide

TBD - even though it is passing the tests, it might introduce slightly different behavior and should probably be saved for 0.14 unless heavily scrutinized

@StrikeForceZero StrikeForceZero changed the title Dev/bevy UI/UI surface update mappings [bevy_ui/layout] UiSurface update internal mappings Mar 30, 2024
@NthTensor NthTensor added A-UI Graphical user interfaces, styles, layouts, and widgets C-Code-Quality A section of code that is hard to understand or change labels Mar 30, 2024
@StrikeForceZero StrikeForceZero force-pushed the dev/bevy_ui/ui_surface_update_mappings branch from b532dec to 64370bb Compare March 30, 2024 18:23
@StrikeForceZero StrikeForceZero force-pushed the dev/bevy_ui/ui_surface_update_mappings branch from f8f39ee to 59be93c Compare March 30, 2024 18:59
@StrikeForceZero StrikeForceZero force-pushed the dev/bevy_ui/ui_surface_update_mappings branch from 59be93c to bfc4364 Compare March 30, 2024 19:04
@StrikeForceZero StrikeForceZero force-pushed the dev/bevy_ui/ui_surface_update_mappings branch from bfc4364 to a0f6e73 Compare April 30, 2024 17:49
@StrikeForceZero StrikeForceZero force-pushed the dev/bevy_ui/ui_surface_update_mappings branch 2 times, most recently from f70fd92 to 107d1ca Compare May 13, 2024 03:19
@StrikeForceZero
Copy link
Contributor Author

removed Adds handling of UI nodes that are demoted and become a child of another root nodes tree from objective and extracting into its own PR

Apply rustfmt
Move test_initialization next to other tests
Add doc comment to is_root_node_pair_valid
Move helper methods into the single test case where they are used
Add tests for helper methods
Remove trait helpers to reduce complexity of tests
Mark specific test functions as unreachable
Move ui_surface test only methods into mod tests as trait
Fix tests after rebase
Add tests for bevy_ui/layout/ui_surface
Widen type for parameter children in UiSurface::update_children
Add missing asserts and Debug fields in UiSurface from bevyengine#12268 and bevyengine#12698
Move assertion above panic triggering line
Remove demotion logic to simplify scope
Remove potentially duplicated context update loop
Remove duplicated ContentSize removal handler
Restore assertion in ui tracking tests
Remove promotion test
Satisfy linter
Update test
Remove promotion helper
Apply rustfmt
Fix documentation
Add missing back ticks in doc comment
Underscore unused variables
Rebase fixes
Add regression test for recursive despawn on ui nodes
Apply rustfmt in bevy_ui/layout/debug
Remove message from unreachable!
Add/update documentation for UiSurface
Make missing root_node_data in compute_camera_layout an error
Fix promote_ui_node, add a test, and set to only be in cfg(test)
Update documentation
Use replace_camera_association to reduce redundant code
Use mark_root_node_as_orphaned
Add explicit taffy node counts to tests
Add test for promoting normal ui nodes into root nodes
Add support demoting root nodes into normal ui nodes
Expand tests to cover different methods of despawn
Remove user_root_node field in favor of using entity_to_taffy
Replace is_root_node_data_valid helper with has_valid_root_node_data
Implement updated map structure in UiSurface
Deprecate user_root_node in RootNodeData
Extract default viewport style into inline fn
Rename camera_id to camera_entity
@StrikeForceZero StrikeForceZero force-pushed the dev/bevy_ui/ui_surface_update_mappings branch from 34f6f3c to 791119a Compare May 19, 2024 17:37
StrikeForceZero added a commit to StrikeForceZero/bevy that referenced this pull request May 19, 2024
Move assertion above panic triggering line
Remove demotion logic to simplify scope
Remove potentially duplicated context update loop
Remove duplicated ContentSize removal handler
Restore assertion in ui tracking tests
Remove promotion test
Satisfy linter
Update test
Remove promotion helper
Apply rustfmt
Fix documentation
Add missing back ticks in doc comment
Underscore unused variables
Rebase fixes
Add regression test for recursive despawn on ui nodes
Apply rustfmt in bevy_ui/layout/debug
Remove message from unreachable!
Add/update documentation for UiSurface
Make missing root_node_data in compute_camera_layout an error
Fix promote_ui_node, add a test, and set to only be in cfg(test)
Update documentation
Use replace_camera_association to reduce redundant code
Use mark_root_node_as_orphaned
Add explicit taffy node counts to tests
Add test for promoting normal ui nodes into root nodes
Add support demoting root nodes into normal ui nodes
Expand tests to cover different methods of despawn
Remove user_root_node field in favor of using entity_to_taffy
Replace is_root_node_data_valid helper with has_valid_root_node_data
Implement updated map structure in UiSurface
Deprecate user_root_node in RootNodeData
Extract default viewport style into inline fn
Rename camera_id to camera_entity
@janhohenheim janhohenheim added the S-Needs-Review Needs reviewer attention (from anyone!) to move forward label Jul 17, 2024
@BenjaminBrienen BenjaminBrienen added S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged and removed S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Oct 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-UI Graphical user interfaces, styles, layouts, and widgets C-Code-Quality A section of code that is hard to understand or change S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants