Skip to content

Commit 156a097

Browse files
committed
Look over some old FIXMEs
1 parent 36386dd commit 156a097

File tree

7 files changed

+8
-25
lines changed

7 files changed

+8
-25
lines changed

crates/bevy_ecs/src/query/fetch.rs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -705,9 +705,6 @@ impl<'w, 's, T: Component> Iterator for RelationAccess<'w, 's, T> {
705705
},
706706
Either::U(target_iter) => {
707707
let target = target_iter.next()?;
708-
// FIXME(Relationships) do we want `T None` to be yielded from a `Relation<T>` query
709-
// honestly there are a lot of places we need to think about this, for example the
710-
// add_relation_filter method takes `Entity` not `Option<Entity>` lol
711708
match columns.1.get(target) {
712709
Some(col) => unsafe {
713710
let ptr = col.get_unchecked(*current_idx) as *mut T;
@@ -723,9 +720,6 @@ impl<'w, 's, T: Component> Iterator for RelationAccess<'w, 's, T> {
723720
iter,
724721
..
725722
} => {
726-
// FIXME(Relationships) do we want `T None` to be yielded from a `Relation<T>` query
727-
// honestly there are a lot of places we need to think about this, for example the
728-
// add_relation_filter method takes `Entity` not `Option<Entity>` lol
729723
let target = match iter {
730724
Either::T(target_iter) => target_iter.next()?,
731725
Either::U(target_iter) => Some(*target_iter.next()?),
@@ -993,9 +987,6 @@ impl<'w, 's, T: Component> Iterator for RelationAccessMut<'w, 's, T> {
993987
},
994988
Either::U(target_iter) => {
995989
let target = target_iter.next()?;
996-
// FIXME(Relationships) do we want `T None` to be yielded from a `Relation<T>` query
997-
// honestly there are a lot of places we need to think about this, for example the
998-
// add_relation_filter method takes `Entity` not `Option<Entity>` lol
999990
match columns.1.get(target) {
1000991
Some(col) => unsafe {
1001992
let ptr = col.get_unchecked(*current_idx) as *mut T;
@@ -1023,9 +1014,6 @@ impl<'w, 's, T: Component> Iterator for RelationAccessMut<'w, 's, T> {
10231014
change_tick,
10241015
..
10251016
} => {
1026-
// FIXME(Relationships) do we want `T None` to be yielded from a `Relation<T>` query
1027-
// honestly there are a lot of places we need to think about this, for example the
1028-
// add_relation_filter method takes `Entity` not `Option<Entity>` lol
10291017
let target = match iter {
10301018
Either::T(target_iter) => target_iter.next()?,
10311019
Either::U(target_iter) => Some(*target_iter.next()?),

crates/bevy_ecs/src/query/relation_filter.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,12 @@ impl<Q: WorldQuery, F: WorldQuery> QueryRelationFilter<Q, F> {
5959
Self::default()
6060
}
6161

62-
// FIXME(Relationships) should the behaviour for this be target AND other_target AND other_other_target
63-
// or should it be target OR other_target OR other_other_target
62+
// FIXME(Relationships) currently we cant set a target filter of `None`- rather than allowing this
63+
// we should stop storing `target` as an `Option<Entity>` and instead have a statically knowable
64+
// ID represent the `None` case
65+
// FIXME(Relationships) implement ability to say `target1` OR `target2`, currently it works like
66+
// `target1` AND `target2`. This mirrors how queries normally work `Query<(&T, &U)>`- `T` AND `U`
67+
// but we need to also be able to mirror `Or<(T, U)>`
6468
pub fn add_target_filter<T: Component, Path>(mut self, target: Entity) -> Self
6569
where
6670
Self: SpecifiesRelation<T, Path, RelationFilter = Self>,

crates/bevy_ecs/src/system/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,6 @@ mod tests {
393393
.get_id(std::any::TypeId::of::<(i32, bool)>())
394394
.expect("Bundle used to spawn entity should exist");
395395
let bundle_info = bundles.get(bundle_id).unwrap();
396-
// FIXME(Relationships) make sure this is using `(RelationKindId, Option<Entity>)`
397396
let mut bundle_components = bundle_info.components().to_vec();
398397
bundle_components.sort();
399398
assert_eq!(

crates/bevy_ecs/src/system/query.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ where
228228
.get_unchecked_manual(self.world, entity, self.last_change_tick, self.change_tick)
229229
}
230230

231-
// FIXME(Relationships) we likely want get_relation methods for both `T *` and `T some_entity`
231+
// FIXME(Relationships) implement get_relation methods for both `T *` and `T some_entity`
232232

233233
/// Gets a reference to the [`Entity`]'s [`Component`] of the given type. This will fail if the
234234
/// entity does not have the given component type or if the given component type does not match

crates/bevy_ecs/src/system/system_param.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,6 @@ where
110110
}
111111

112112
fn new_archetype(&mut self, archetype: &Archetype, system_state: &mut SystemState) {
113-
// FIXME(Relationships) investigate this function
114113
for (relation_filter, cache) in self.relation_filter_accesses.iter_mut() {
115114
Self::new_archetype(
116115
&self.fetch_state,

crates/bevy_ecs/src/world/mod.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,6 @@ impl World {
481481
QueryState::new(self)
482482
}
483483

484-
// FIXME(Relationships) add a method for doing this for `T *`
485484
/// Returns an iterator of entities that had components of type `T` removed
486485
/// since the last call to [World::clear_trackers].
487486
pub fn removed<T: Component>(&self) -> std::iter::Cloned<std::slice::Iter<'_, Entity>> {
@@ -492,6 +491,7 @@ impl World {
492491
}
493492
}
494493

494+
// FIXME(Relationships) implement a way to set `*` for the target
495495
/// Returns an iterator of entities that had components with the given `component_id` removed
496496
/// since the last call to [World::clear_trackers].
497497
///
@@ -831,9 +831,6 @@ impl World {
831831
resource_archetype_components.insert(
832832
component_id,
833833
(
834-
// FIXME(Relationships) I'm not sure if we should really be overwriting the entry in
835-
// resource_archetype_components, this *is* for resources so we should never really
836-
// be inserting anything into the hashmap so this is probably fine /shrug
837834
Some(ArchetypeComponentInfo {
838835
archetype_component_id: ArchetypeComponentId::new(
839836
*archetype_component_count,

crates/bevy_ecs/src/world/tests.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,6 @@ fn relation_access_raw(storage_type: StorageType) {
144144
assert_eq!(
145145
accessor.next().unwrap(),
146146
(
147-
// FIXME(Relationships) honestly having Option<Entity> is really annoying
148-
// i should just make a statically knowable entity to represent None...
149147
Some(parent1),
150148
&ChildOf {
151149
despawn_recursive: true
@@ -165,8 +163,6 @@ fn relation_access_raw(storage_type: StorageType) {
165163
assert_eq!(
166164
accessor.next().unwrap(),
167165
(
168-
// FIXME(Relationships) honestly having Option<Entity> is really annoying
169-
// i should just make a statically knowable entity to represent None...
170166
Some(parent2),
171167
&ChildOf {
172168
despawn_recursive: false

0 commit comments

Comments
 (0)