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

[Merged by Bors] - Cleaning up NodeBundle, and some slight UI module re-organization #6473

Closed
wants to merge 2 commits into from

Conversation

bzm3r
Copy link
Contributor

@bzm3r bzm3r commented Nov 5, 2022

Objective

NodeBundle contains an image field, which can be misleading, because if you do supply an image there, nothing will be shown to screen. You need to use an ImageBundle instead.

Solution

  • image (UiImage) field is removed from NodeBundle,
  • extraction stage queries now make an optional query for UiImage, if one is not found, use the image handle that is used as a default by UiImage:
    Self(DEFAULT_IMAGE_HANDLE.typed())
  • touching up docs for NodeBundle to help guide what NodeBundle should be used for
  • renamed entity.rs to node_bundle.rs as that gives more of a hint regarding the module's purpose
  • separating camera_config stuff from the pre-made UI node bundles so that node_bundle.rs makes more sense as a module name.

…mera config stuff from the pre-made UI node bundles.
Copy link
Member

@alice-i-cecile alice-i-cecile left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed on all of these changes. This removes an important footgun, and the module organization is better.

@alice-i-cecile alice-i-cecile added A-UI Graphical user interfaces, styles, layouts, and widgets C-Usability A simple quality-of-life change that makes Bevy easier to use C-Bug An unexpected or incorrect behavior C-Breaking-Change A breaking change to Bevy's public API that needs to be noted in a migration guide labels Nov 5, 2022
@alice-i-cecile
Copy link
Member

This is technically a breaking change but I don't think it needs a migration guide.

Copy link
Contributor

@IceSentry IceSentry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I don't think this needs a migration guide either.

@alice-i-cecile alice-i-cecile added the S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it label Nov 5, 2022
Copy link
Contributor

@Weibye Weibye left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good change, agree on all changes!

@alice-i-cecile
Copy link
Member

@bzm3r those doc links are genuinely broken :)

@alice-i-cecile
Copy link
Member

bors r+

bors bot pushed a commit that referenced this pull request Nov 5, 2022
)

# Objective

`NodeBundle` contains an `image` field, which can be misleading, because if you do supply an image there, nothing will be shown to screen. You need to use an `ImageBundle` instead.

## Solution

* `image` (`UiImage`) field is removed from `NodeBundle`, 
* extraction stage queries now make an optional query for `UiImage`, if one is not found, use the image handle that is used as a default by `UiImage`: https://github.com/bevyengine/bevy/blob/c019a60b39c5683656025bc9d24a02744aa59dea/crates/bevy_ui/src/ui_node.rs#L464
* touching up docs for `NodeBundle` to help guide what `NodeBundle` should be used for
* renamed `entity.rs` to `node_bundle.rs` as that gives more of a hint regarding the module's purpose
* separating `camera_config` stuff from the pre-made UI node bundles so that `node_bundle.rs` makes more sense as a module name.
@bors bors bot changed the title Cleaning up NodeBundle, and some slight UI module re-organization [Merged by Bors] - Cleaning up NodeBundle, and some slight UI module re-organization Nov 5, 2022
@bors bors bot closed this Nov 5, 2022
ItsDoot pushed a commit to ItsDoot/bevy that referenced this pull request Feb 1, 2023
…vyengine#6473)

# Objective

`NodeBundle` contains an `image` field, which can be misleading, because if you do supply an image there, nothing will be shown to screen. You need to use an `ImageBundle` instead.

## Solution

* `image` (`UiImage`) field is removed from `NodeBundle`, 
* extraction stage queries now make an optional query for `UiImage`, if one is not found, use the image handle that is used as a default by `UiImage`: https://github.com/bevyengine/bevy/blob/c019a60b39c5683656025bc9d24a02744aa59dea/crates/bevy_ui/src/ui_node.rs#L464
* touching up docs for `NodeBundle` to help guide what `NodeBundle` should be used for
* renamed `entity.rs` to `node_bundle.rs` as that gives more of a hint regarding the module's purpose
* separating `camera_config` stuff from the pre-made UI node bundles so that `node_bundle.rs` makes more sense as a module name.
@bzm3r bzm3r deleted the ui-cleanup branch June 1, 2023 18:48
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-Breaking-Change A breaking change to Bevy's public API that needs to be noted in a migration guide C-Bug An unexpected or incorrect behavior C-Usability A simple quality-of-life change that makes Bevy easier to use S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants