-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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] - Make change lifespan deterministic and update docs #3956
Closed
Closed
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
9b84ff1
increase change lifespan, make change lifespan consistent, improve do…
maniwani 4854437
forgot to carry the 1
maniwani 605692d
pick a nicer magic number, update using alice's feedback, bikeshed a …
maniwani 56448e4
fix typo
maniwani 4175600
fix another typo
maniwani 6a649f1
reword a comment
maniwani 7412a83
update check tick threshold back to larger value :(
maniwani bed24aa
fix my own misunderstanding, warnings are not spammed AFAIK
maniwani cdc6251
add some missing docs and one more bike in the shed
maniwani fc28b10
>= instead of > for the correctness
maniwani 5f022f6
word clarity
maniwani 78183b8
move test cases to bevy_ecs::change_detection and initialize systems …
maniwani 07e88fd
newline + rustfmt
maniwani a36782d
correction, new systems should detect everything as a change, not not…
maniwani 3f33680
rustfmt
maniwani 8515a1f
forgot about exclusive systems
maniwani 7a492c1
fix one last comment typo
maniwani e7bafd1
cargo fmt
maniwani 0beefc8
fix typos + consistency + update filter docs
maniwani e11a229
small nit
maniwani 6e66a61
fmt
maniwani 74f94cb
simpler grammar
maniwani a4151a5
Update component.rs
maniwani File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -650,17 +650,12 @@ macro_rules! impl_tick_filter { | |
} | ||
|
||
impl_tick_filter!( | ||
/// Filter that retrieves components of type `T` that have been added since the last execution | ||
/// of this system. | ||
/// A filter on a component that only retains results added after the system last ran. | ||
/// | ||
/// This filter is useful to do one-time post-processing on components. | ||
/// A common use for this filter is one-time initialization. | ||
/// | ||
/// Because the ordering of systems can change and this filter is only effective on changes | ||
/// before the query executes you need to use explicit dependency ordering or ordered stages to | ||
/// avoid frame delays. | ||
/// | ||
/// If instead behavior is meant to change on whether the component changed or not | ||
/// [`ChangeTrackers`](crate::query::ChangeTrackers) may be used. | ||
/// To retain all results without filtering but still check whether they were added after the | ||
/// system last ran, use [`ChangeTrackers<T>`](crate::query::ChangeTrackers). | ||
/// | ||
/// # Examples | ||
/// | ||
|
@@ -690,18 +685,15 @@ impl_tick_filter!( | |
); | ||
|
||
impl_tick_filter!( | ||
/// Filter that retrieves components of type `T` that have been changed since the last | ||
/// execution of this system. | ||
/// | ||
/// This filter is useful for synchronizing components, and as a performance optimization as it | ||
/// means that the query contains fewer items for a system to iterate over. | ||
/// A filter on a component that only retains results added or mutably dereferenced after the system last ran. | ||
/// | ||
/// A common use for this filter is avoiding redundant work when values have not changed. | ||
/// | ||
/// Because the ordering of systems can change and this filter is only effective on changes | ||
/// before the query executes you need to use explicit dependency ordering or ordered | ||
/// stages to avoid frame delays. | ||
/// **Note** that simply *mutably dereferencing* a component is considered a change ([`DerefMut`](std::ops::DerefMut)). | ||
/// Bevy does not compare components to their previous values. | ||
/// | ||
/// If instead behavior is meant to change on whether the component changed or not | ||
/// [`ChangeTrackers`](crate::query::ChangeTrackers) may be used. | ||
/// To retain all results without filtering but still check whether they were changed after the | ||
/// system last ran, use [`ChangeTrackers<T>`](crate::query::ChangeTrackers). | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Or use |
||
/// | ||
/// # Examples | ||
/// | ||
|
Oops, something went wrong.
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.
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.
Or use
Added<T>
in your query instead of in its filters and you will get a bool indicating whether that component was added or not since the last execution of the system.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.
Oh, thanks for pointing that out. Can you share a token example to add to the docs?
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.
Hmm. I having trouble coming up with self-contained and not completely artificial applications.
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.
#4180 The performance gains there are due to avoiding the additional lookup in the filtered query. If you just get the changed state directly in the query the same information is right there.