Skip to content

Commit 49038d0

Browse files
committed
Remove with bundle filter (#2623)
# Objective Fixes #2620 ## Solution Remove WithBundle filter and temporarily remove example for query_bundle.
1 parent 336583a commit 49038d0

File tree

6 files changed

+1
-159
lines changed

6 files changed

+1
-159
lines changed

Cargo.toml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -318,10 +318,6 @@ path = "examples/ecs/system_sets.rs"
318318
name = "timers"
319319
path = "examples/ecs/timers.rs"
320320

321-
[[example]]
322-
name = "query_bundle"
323-
path = "examples/ecs/query_bundle.rs"
324-
325321
# Games
326322
[[example]]
327323
name = "alien_cake_addict"

crates/bevy_ecs/src/bundle.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ use std::{any::TypeId, collections::HashMap};
1212
/// An ordered collection of components, commonly used for spawning entities, and adding and
1313
/// removing components in bulk.
1414
///
15-
/// In order to query for components in a bundle use [crate::query::WithBundle].
16-
///
1715
/// Typically, you will simply use `#[derive(Bundle)]` when creating your own `Bundle`.
1816
/// The `Bundle` trait is automatically implemented for tuples of components:
1917
/// `(ComponentA, ComponentB)` is a very convenient shorthand when working with one-off collections

crates/bevy_ecs/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ pub mod prelude {
2222
change_detection::DetectChanges,
2323
entity::Entity,
2424
event::{EventReader, EventWriter},
25-
query::{Added, ChangeTrackers, Changed, Or, QueryState, With, WithBundle, Without},
25+
query::{Added, ChangeTrackers, Changed, Or, QueryState, With, Without},
2626
schedule::{
2727
AmbiguitySetLabel, ExclusiveSystemDescriptorCoercion, ParallelSystemDescriptorCoercion,
2828
RunCriteria, RunCriteriaDescriptorCoercion, RunCriteriaLabel, RunCriteriaPiping,

crates/bevy_ecs/src/query/filter.rs

Lines changed: 0 additions & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
use crate::{
22
archetype::{Archetype, ArchetypeComponentId},
3-
bundle::Bundle,
43
component::{Component, ComponentId, ComponentTicks, StorageType},
54
entity::Entity,
65
query::{Access, Fetch, FetchState, FilteredAccess, WorldQuery},
@@ -282,106 +281,6 @@ impl<'w, 's, T: Component> Fetch<'w, 's> for WithoutFetch<T> {
282281
}
283282
}
284283

285-
pub struct WithBundle<T: Bundle>(PhantomData<T>);
286-
287-
impl<T: Bundle> WorldQuery for WithBundle<T> {
288-
type Fetch = WithBundleFetch<T>;
289-
type State = WithBundleState<T>;
290-
}
291-
292-
pub struct WithBundleFetch<T: Bundle> {
293-
is_dense: bool,
294-
marker: PhantomData<T>,
295-
}
296-
297-
pub struct WithBundleState<T: Bundle> {
298-
component_ids: Vec<ComponentId>,
299-
is_dense: bool,
300-
marker: PhantomData<T>,
301-
}
302-
303-
// SAFETY: no component access or archetype component access
304-
unsafe impl<T: Bundle> FetchState for WithBundleState<T> {
305-
fn init(world: &mut World) -> Self {
306-
let bundle_info = world.bundles.init_info::<T>(&mut world.components);
307-
let components = &world.components;
308-
Self {
309-
component_ids: bundle_info.component_ids.clone(),
310-
is_dense: !bundle_info.component_ids.iter().any(|id| unsafe {
311-
components.get_info_unchecked(*id).storage_type() != StorageType::Table
312-
}),
313-
marker: PhantomData,
314-
}
315-
}
316-
317-
#[inline]
318-
fn update_component_access(&self, access: &mut FilteredAccess<ComponentId>) {
319-
for component_id in self.component_ids.iter().cloned() {
320-
access.add_with(component_id);
321-
}
322-
}
323-
324-
#[inline]
325-
fn update_archetype_component_access(
326-
&self,
327-
_archetype: &Archetype,
328-
_access: &mut Access<ArchetypeComponentId>,
329-
) {
330-
}
331-
332-
fn matches_archetype(&self, archetype: &Archetype) -> bool {
333-
self.component_ids.iter().all(|id| archetype.contains(*id))
334-
}
335-
336-
fn matches_table(&self, table: &Table) -> bool {
337-
self.component_ids.iter().all(|id| table.has_column(*id))
338-
}
339-
}
340-
341-
impl<'w, 's, T: Bundle> Fetch<'w, 's> for WithBundleFetch<T> {
342-
type Item = bool;
343-
type State = WithBundleState<T>;
344-
345-
unsafe fn init(
346-
_world: &World,
347-
state: &Self::State,
348-
_last_change_tick: u32,
349-
_change_tick: u32,
350-
) -> Self {
351-
Self {
352-
is_dense: state.is_dense,
353-
marker: PhantomData,
354-
}
355-
}
356-
357-
#[inline]
358-
fn is_dense(&self) -> bool {
359-
self.is_dense
360-
}
361-
362-
#[inline]
363-
unsafe fn set_table(&mut self, _state: &Self::State, _table: &Table) {}
364-
365-
#[inline]
366-
unsafe fn set_archetype(
367-
&mut self,
368-
_state: &Self::State,
369-
_archetype: &Archetype,
370-
_tables: &Tables,
371-
) {
372-
}
373-
374-
#[inline]
375-
unsafe fn archetype_fetch(&mut self, _archetype_index: usize) -> bool {
376-
true
377-
}
378-
379-
#[inline]
380-
unsafe fn table_fetch(&mut self, _table_row: usize) -> bool {
381-
true
382-
}
383-
}
384-
385284
/// A filter that tests if any of the given filters apply.
386285
///
387286
/// This is useful for example if a system with multiple components in a query only wants to run

examples/README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,6 @@ Example | File | Description
162162
`hierarchy` | [`ecs/hierarchy.rs`](./ecs/hierarchy.rs) | Creates a hierarchy of parents and children entities
163163
`iter_combinations` | [`ecs/iter_combinations.rs`](./ecs/iter_combinations.rs) | Shows how to iterate over combinations of query results.
164164
`parallel_query` | [`ecs/parallel_query.rs`](./ecs/parallel_query.rs) | Illustrates parallel queries with `ParallelIterator`
165-
`query_bundle` | [`ecs/query_bundle.rs`](./ecs/query_bundle.rs) | Shows how to query entities that contain components in a `Bundle`
166165
`removal_detection` | [`ecs/removal_detection.rs`](./ecs/removal_detection.rs) | Query for entities that had a specific component removed in a previous stage during the current frame.
167166
`startup_system` | [`ecs/startup_system.rs`](./ecs/startup_system.rs) | Demonstrates a startup system (one that runs once when the app starts up)
168167
`state` | [`ecs/state.rs`](./ecs/state.rs) | Illustrates how to use States to control transitioning from a Menu state to an InGame state

examples/ecs/query_bundle.rs

Lines changed: 0 additions & 50 deletions
This file was deleted.

0 commit comments

Comments
 (0)