Increase type safety and clarity for change detection#7905
Merged
alice-i-cecile merged 22 commits intobevyengine:mainfrom Mar 9, 2023
Merged
Increase type safety and clarity for change detection#7905alice-i-cecile merged 22 commits intobevyengine:mainfrom
alice-i-cecile merged 22 commits intobevyengine:mainfrom
Conversation
alice-i-cecile
approved these changes
Mar 5, 2023
Member
alice-i-cecile
left a comment
There was a problem hiding this comment.
Rename and refactor appears to be done correctly. I'm strongly in favoring of improving type safety here.
I have some suggestions for how we can further improve encapsulation here now, but they're non-blocking.
Member
Author
|
I've encapsulated the field on |
chrisjuchem
reviewed
Mar 5, 2023
Carter0
approved these changes
Mar 7, 2023
Contributor
Carter0
left a comment
There was a problem hiding this comment.
Thanks for doing this! I like the new names. I recall looking over this stuff earlier and being fairly confused so much appreciated.
Member
Author
|
I have no idea why CI is failing now. |
Member
|
CI failure looks like #8002. |
ProfLander
pushed a commit
to Lander-Rust/bevy
that referenced
this pull request
Mar 19, 2023
ProfLander
pushed a commit
to Lander-Rust/bevy
that referenced
this pull request
Mar 19, 2023
james7132
pushed a commit
that referenced
this pull request
Apr 3, 2023
# Objective While migrating the engine to use the `Tick` type in #7905, I forgot to update `UnsafeWorldCell::increment_change_tick`. ## Solution Update the function. --- ## Changelog - The function `UnsafeWorldCell::increment_change_tick` is now strongly-typed, returning a value of type `Tick` instead of a raw `u32`. ## Migration Guide The function `UnsafeWorldCell::increment_change_tick` is now strongly-typed, returning a value of type `Tick` instead of a raw `u32`.
2 tasks
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
Tickfor dealing with change ticks, but most of the engine still just usesu32.last_change_tickandchange_tickoften appear together, however the meaning of these names is unclear.Solution
Ticktype throughout the engine.last_change_tickandchange_ticktolast_runandthis_run, respectively.Changelog
Tickinstead ofu32.Migration Guide
The engine now uses the type
Tickfor dealing with change ticks, instead ofu32. Any code that interfaced with engine internals will need to be updated, including:SystemParam,WorldQuery,DetectChanges, andDetectChangesMut.World::change_tickandread_change_tick.System::set_last_change_tickandget_last_change_tick. Also, these methods have been renamed toset_last_runandget_last_run, respectively.SystemChangeTick::change_tickandlast_change_tick. These methods have been renamed tothis_runandlast_run, respectively.Tick::set_changed, which has been renamed to justset.