mirror of
https://github.com/bevyengine/bevy
synced 2025-02-16 22:18:33 +00:00
update doc comment for new_archetype in query-state (#7241)
# Objective I was reading through the bevy_ecs code, trying to understand how everything works. I was getting a bit confused when reading the doc comment for the `new_archetype` function; it looks like it doesn't create a new archetype but instead updates some internal state in the SystemParam to facility QueryIteration. (I still couldn't find where a new archetype was actually created) ## Solution - Adding a doc comment with a more correct explanation. If it's deemed correct, I can also update the doc-comment for the other `new_archetype` calls
This commit is contained in:
parent
88b353c4b1
commit
d6bfd44f8f
1 changed files with 3 additions and 2 deletions
|
@ -140,7 +140,7 @@ impl<Q: WorldQuery, F: ReadOnlyWorldQuery> QueryState<Q, F> {
|
|||
}
|
||||
|
||||
/// Takes a query for the given [`World`], checks if the given world is the same as the query, and
|
||||
/// generates new archetypes for the given world.
|
||||
/// updates the [`QueryState`]'s view of the [`World`] with any newly-added archetypes.
|
||||
///
|
||||
/// # Panics
|
||||
///
|
||||
|
@ -166,7 +166,8 @@ impl<Q: WorldQuery, F: ReadOnlyWorldQuery> QueryState<Q, F> {
|
|||
);
|
||||
}
|
||||
|
||||
/// Creates a new [`Archetype`].
|
||||
/// Update the current [`QueryState`] with information from the provided [`Archetype`]
|
||||
/// (if applicable, i.e. if the archetype has any intersecting [`ComponentId`] with the current [`QueryState`]).
|
||||
pub fn new_archetype(&mut self, archetype: &Archetype) {
|
||||
if Q::matches_component_set(&self.fetch_state, &|id| archetype.contains(id))
|
||||
&& F::matches_component_set(&self.filter_state, &|id| archetype.contains(id))
|
||||
|
|
Loading…
Add table
Reference in a new issue