Only use physical coords internally in bevy_ui#16375
Merged
alice-i-cecile merged 31 commits intobevyengine:mainfrom Nov 22, 2024
Merged
Only use physical coords internally in bevy_ui#16375alice-i-cecile merged 31 commits intobevyengine:mainfrom
bevy_ui#16375alice-i-cecile merged 31 commits intobevyengine:mainfrom
Conversation
doup
approved these changes
Nov 16, 2024
BenjaminBrienen
approved these changes
Nov 16, 2024
atlv24
approved these changes
Nov 19, 2024
Contributor
atlv24
left a comment
There was a problem hiding this comment.
This needs a migration guide. Its a particularly sneaky type of breaking change, because it causes almost no compile errors, but underlying semantics change. @BenjaminBrienen @doup have you tested these changes/run any examples? I haven't yet.
Contributor
Author
All of these should be fixed now I think. |
Contributor
|
I've checked the examples that had issues, I still see some:
thread 'Compute Task Pool (1)' panicked at /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14/library/core/src/num/f32.rs:1433:9:
min > max, or either was NaN. min = 0.0, max = NaN
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Encountered a panic in system `bevy_ui::layout::ui_layout_system`!
Encountered a panic in system `bevy_app::main_schedule::Main::run_main`! |
atlv24
approved these changes
Nov 21, 2024
Contributor
atlv24
left a comment
There was a problem hiding this comment.
ran the ui examples, all looks good, and migration guide is good!
cart
approved these changes
Nov 22, 2024
mockersf
pushed a commit
that referenced
this pull request
Nov 22, 2024
We switch back and forwards between logical and physical coordinates all over the place. Systems have to query for cameras and the UiScale when they shouldn't need to. It's confusing and fragile and new scale factor bugs get found constantly. * Use physical coordinates whereever possible in `bevy_ui`. * Store physical coords in `ComputedNode` and tear out all the unneeded scale factor calculations and queries. * Add an `inverse_scale_factor` field to `ComputedNode` and set nodes changed when their scale factor changes. `ComputedNode`'s fields and methods now use physical coordinates. `ComputedNode` has a new field `inverse_scale_factor`. Multiplying the physical coordinates by the `inverse_scale_factor` will give the logical values. --------- Co-authored-by: atlv <[email protected]>
ecoskey
pushed a commit
to ecoskey/bevy
that referenced
this pull request
Dec 2, 2024
# Objective We switch back and forwards between logical and physical coordinates all over the place. Systems have to query for cameras and the UiScale when they shouldn't need to. It's confusing and fragile and new scale factor bugs get found constantly. ## Solution * Use physical coordinates whereever possible in `bevy_ui`. * Store physical coords in `ComputedNode` and tear out all the unneeded scale factor calculations and queries. * Add an `inverse_scale_factor` field to `ComputedNode` and set nodes changed when their scale factor changes. ## Migration Guide `ComputedNode`'s fields and methods now use physical coordinates. `ComputedNode` has a new field `inverse_scale_factor`. Multiplying the physical coordinates by the `inverse_scale_factor` will give the logical values. --------- Co-authored-by: atlv <[email protected]>
ecoskey
pushed a commit
to ecoskey/bevy
that referenced
this pull request
Jan 6, 2025
# Objective We switch back and forwards between logical and physical coordinates all over the place. Systems have to query for cameras and the UiScale when they shouldn't need to. It's confusing and fragile and new scale factor bugs get found constantly. ## Solution * Use physical coordinates whereever possible in `bevy_ui`. * Store physical coords in `ComputedNode` and tear out all the unneeded scale factor calculations and queries. * Add an `inverse_scale_factor` field to `ComputedNode` and set nodes changed when their scale factor changes. ## Migration Guide `ComputedNode`'s fields and methods now use physical coordinates. `ComputedNode` has a new field `inverse_scale_factor`. Multiplying the physical coordinates by the `inverse_scale_factor` will give the logical values. --------- Co-authored-by: atlv <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Objective
We switch back and forwards between logical and physical coordinates all over the place. Systems have to query for cameras and the UiScale when they shouldn't need to. It's confusing and fragile and new scale factor bugs get found constantly.
Solution
bevy_ui.ComputedNodeand tear out all the unneeded scale factor calculations and queries.inverse_scale_factorfield toComputedNodeand set nodes changed when their scale factor changes.Migration Guide
ComputedNode's fields and methods now use physical coordinates.ComputedNodehas a new fieldinverse_scale_factor. Multiplying the physical coordinates by theinverse_scale_factorwill give the logical values.