Skip to content

Commit bb0dcae

Browse files
committed
Look over some old FIXMEs
1 parent a9b0fe7 commit bb0dcae

File tree

8 files changed

+8
-26
lines changed

8 files changed

+8
-26
lines changed

crates/bevy_ecs/src/query/fetch.rs

-12
Original file line numberDiff line numberDiff line change
@@ -704,9 +704,6 @@ impl<'w, 's, T: Component> Iterator for RelationAccess<'w, 's, T> {
704704
},
705705
Either::U(target_iter) => {
706706
let target = target_iter.next()?;
707-
// FIXME(Relationships) do we want `T None` to be yielded from a `Relation<T>` query
708-
// honestly there are a lot of places we need to think about this, for example the
709-
// add_relation_filter method takes `Entity` not `Option<Entity>` lol
710707
match columns.1.get(target) {
711708
Some(col) => unsafe {
712709
let ptr = col.get_unchecked(*current_idx) as *mut T;
@@ -722,9 +719,6 @@ impl<'w, 's, T: Component> Iterator for RelationAccess<'w, 's, T> {
722719
iter,
723720
..
724721
} => {
725-
// FIXME(Relationships) do we want `T None` to be yielded from a `Relation<T>` query
726-
// honestly there are a lot of places we need to think about this, for example the
727-
// add_relation_filter method takes `Entity` not `Option<Entity>` lol
728722
let target = match iter {
729723
Either::T(target_iter) => target_iter.next()?,
730724
Either::U(target_iter) => Some(*target_iter.next()?),
@@ -992,9 +986,6 @@ impl<'w, 's, T: Component> Iterator for RelationAccessMut<'w, 's, T> {
992986
},
993987
Either::U(target_iter) => {
994988
let target = target_iter.next()?;
995-
// FIXME(Relationships) do we want `T None` to be yielded from a `Relation<T>` query
996-
// honestly there are a lot of places we need to think about this, for example the
997-
// add_relation_filter method takes `Entity` not `Option<Entity>` lol
998989
match columns.1.get(target) {
999990
Some(col) => unsafe {
1000991
let ptr = col.get_unchecked(*current_idx) as *mut T;
@@ -1022,9 +1013,6 @@ impl<'w, 's, T: Component> Iterator for RelationAccessMut<'w, 's, T> {
10221013
change_tick,
10231014
..
10241015
} => {
1025-
// FIXME(Relationships) do we want `T None` to be yielded from a `Relation<T>` query
1026-
// honestly there are a lot of places we need to think about this, for example the
1027-
// add_relation_filter method takes `Entity` not `Option<Entity>` lol
10281016
let target = match iter {
10291017
Either::T(target_iter) => target_iter.next()?,
10301018
Either::U(target_iter) => Some(*target_iter.next()?),

crates/bevy_ecs/src/query/relation_filter.rs

+6-2
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

-1
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

+1-1
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ where
215215
.get_unchecked_manual(self.world, entity, self.last_change_tick, self.change_tick)
216216
}
217217

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

220220
/// Gets a reference to the entity's component of the given type. This will fail if the entity
221221
/// does not have the given component type or if the given component type does not match

crates/bevy_ecs/src/system/system.rs

-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ pub trait System: Send + Sync + 'static {
3434
fn name(&self) -> Cow<'static, str>;
3535
fn id(&self) -> SystemId;
3636
fn new_archetype(&mut self, archetype: &Archetype);
37-
// FIXME(Relationships) this is wrong, we need to be able to say we access either `ChildOf *` or `ChildOf parent`
3837
fn component_access(&self) -> &Access<RelationKindId>;
3938
fn archetype_component_access(&self) -> &Access<ArchetypeComponentId>;
4039
fn is_send(&self) -> bool;

crates/bevy_ecs/src/system/system_param.rs

-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@ where
103103
}
104104

105105
fn new_archetype(&mut self, archetype: &Archetype, system_state: &mut SystemState) {
106-
// FIXME(Relationships) investigate this function
107106
for (relation_filter, cache) in self.relation_filter_accesses.iter_mut() {
108107
Self::new_archetype(
109108
&self.fetch_state,

crates/bevy_ecs/src/world/mod.rs

+1-4
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

-4
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)