Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions crates/bevy_ecs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ bevy_debug_stepping = []
## This will often provide more detailed error messages.
track_location = []

## Makes queries become uncached by default.
## Mostly useful for unit tests.
query_uncached_default = []

# Executor Backend

## Uses `async-executor` as a task execution backend.
Expand Down
10 changes: 1 addition & 9 deletions crates/bevy_ecs/src/entity_disabling.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
//! [`Query` performance]: crate::prelude::Query#performance

use crate::{
component::{ComponentId, Components, StorageType},
component::ComponentId,
query::FilteredAccess,
world::{FromWorld, World},
};
Expand Down Expand Up @@ -248,14 +248,6 @@ impl DefaultQueryFilters {
}
}
}

pub(super) fn is_dense(&self, components: &Components) -> bool {
self.disabling_ids().all(|component_id| {
components
.get_info(component_id)
.is_some_and(|info| info.storage_type() == StorageType::Table)
})
}
}

#[cfg(test)]
Expand Down
15 changes: 11 additions & 4 deletions crates/bevy_ecs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,10 @@ pub mod prelude {
message::{Message, MessageMutator, MessageReader, MessageWriter, Messages},
name::{Name, NameOrEntity},
observer::{Observer, On, Trigger},
query::{Added, Allow, AnyOf, Changed, Has, Or, QueryBuilder, QueryState, With, Without},
query::{
Added, Allow, AnyOf, Changed, Has, Or, QueryBuilder, QueryState, UncachedQueryState,
With, Without,
},
related,
relationship::RelationshipTarget,
resource::Resource,
Expand All @@ -101,7 +104,7 @@ pub mod prelude {
Command, Commands, Deferred, EntityCommand, EntityCommands, If, In, InMut, InRef,
IntoSystem, Local, NonSend, NonSendMut, ParamSet, Populated, Query, ReadOnlySystem,
Res, ResMut, Single, System, SystemIn, SystemInput, SystemParamBuilder,
SystemParamFunction,
SystemParamFunction, UncachedQuery,
},
world::{
EntityMut, EntityRef, EntityWorldMut, FilteredResources, FilteredResourcesMut,
Expand Down Expand Up @@ -475,8 +478,12 @@ mod tests {
assert_eq!(ents, &[(e, A(123))]);

let f = world.spawn((TableStored("def"), A(456), B(1))).id();
let ents = query.iter(&world).map(|(e, &i)| (e, i)).collect::<Vec<_>>();
assert_eq!(ents, &[(e, A(123)), (f, A(456))]);
let ents = query
.iter(&world)
.map(|(e, &i)| (e, i))
.collect::<HashSet<_>>();
assert!(ents.contains(&(e, A(123))));
assert!(ents.contains(&(f, A(456))));
}

#[test]
Expand Down
Loading