-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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] Make fields private in UiSurface #13359
base: main
Are you sure you want to change the base?
[bevy_ui/layout] Make fields private in UiSurface #13359
Conversation
@@ -270,4 +424,553 @@ with UI components as a child of an entity without UI components, results may be | |||
Err(LayoutError::InvalidHierarchy) | |||
} | |||
} | |||
|
|||
/// Returns a debug representation of the computed layout of the UI layout tree for each camera. | |||
pub fn ui_layout_tree_debug_string(&self) -> Result<String, fmt::Error> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This feels weird, as noted in the PR description. Open to alternatives. Maybe the pub(super)
get accessors to become available outside of #[cfg(test)]
, and then layout/debug
defines a trait that the user can manually import?
#[deprecated( | ||
since = "0.13.3", | ||
note = "use `ui_surface.ui_layout_tree_debug_string()` instead" | ||
)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see: #13359 (comment)
If we leave ui_layout_tree_debug_string
in UiSurface
then this function should retain the deprecation notice so it can be removed later.
- Either Remove the notice or update the version to match whatever version this is slated to land in.
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
368e1bd
to
8b3f47c
Compare
Blocked on:
Objective
UiSurface
Solution
Since the fields were originally
pub(super)
and not used outside of testing, replacing direct access withpub(super)
get accessors for#[cfg(test)]
seemed like the path of least resistance.Testing
layout/mod
and how they've been updated to use the accessors.ui_layout_tree_debug_string()
. Or if the function is an appropriate level of responsibility for theUiSurface
struct in the first place. A trait that you have to import might be interesting.Changelog
UiSurface
fields private and replaced directpub(super)
access withpub(super)
get accessors forlayout/mod
.layout/debug
)