Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Merged by Bors] - [Fixes #6059] Entity's “ID” should be named “index” instead #6107

Closed
wants to merge 20 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
ba8279a
Renamed ``id`` in the ``Entity`` struct to ``index``
Edwox Sep 26, 2022
7f13187
Renamed ``Entity``'s member ``id`` to ``index`` and for all its insta…
Edwox Oct 3, 2022
b3e5184
Renamed ``Entity``'s member ``id`` to index in ``sparse_set.rs``.
Edwox Oct 3, 2022
6fc664e
Merge branch 'main' into bevy_entity_id_to_index
Edwox Oct 5, 2022
208d8a5
Updated variables named ``idx`` to ``index`` in ``sparse_set.rs``.
Edwox Oct 7, 2022
eefe35a
Merge branch 'main' into bevy_entity_id_to_index
Edwox Oct 9, 2022
ff31954
Merge branch 'main' into bevy_entity_id_to_index
Edwox Oct 12, 2022
79a1e88
Renamed ``id`` to ``index``
Edwox Oct 12, 2022
20dd979
Merge ``main`` into ``bevy_entity_id_to_index``
Edwox Oct 12, 2022
da3b791
Merge branch 'bevy_entity_id_to_index' of github.com:Edwox/bevy into …
Edwox Oct 12, 2022
c51b587
Renamed ``index`` to ``id`` for ``EntityMut``
Edwox Oct 12, 2022
cf4ee06
Renamed ``component_index`` back to ``component_id`` in ``dynamic_sce…
Edwox Oct 20, 2022
89474b6
Renamed ``index`` to ``id`` in ``dynamic_scene.rs``
Edwox Oct 20, 2022
e819f70
Merge branch 'bevyengine:main' into bevy_entity_id_to_index
Edwox Oct 20, 2022
66f3437
Merge branch 'main' into bevy_entity_id_to_index
Edwox Oct 20, 2022
5ae4a08
Merge branch 'bevy_entity_id_to_index' of github.com:Edwox/bevy into …
Edwox Oct 20, 2022
f0bd519
Merge branch 'main' into bevy_entity_id_to_index
Edwox Nov 2, 2022
f00552c
Resolved a merge issue
Edwox Nov 2, 2022
e03a071
Resolved merge issues ``dynamic_scene_builder``
Edwox Nov 2, 2022
8e95a72
``EntityMut`` should use ``.id()`` instead of ``.index()``
Edwox Nov 2, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 5 additions & 5 deletions crates/bevy_ecs/src/bundle.rs
Expand Up @@ -543,10 +543,10 @@ impl<'a, 'b> BundleInserter<'a, 'b> {
InsertBundleResult::NewArchetypeSameTable { new_archetype } => {
let result = self.archetype.swap_remove(location.index);
if let Some(swapped_entity) = result.swapped_entity {
self.entities.meta[swapped_entity.id as usize].location = location;
self.entities.meta[swapped_entity.index as usize].location = location;
}
let new_location = new_archetype.allocate(entity, result.table_row);
self.entities.meta[entity.id as usize].location = new_location;
self.entities.meta[entity.index as usize].location = new_location;

// PERF: this could be looked up during Inserter construction and stored (but borrowing makes this nasty)
let add_bundle = self
Expand All @@ -571,15 +571,15 @@ impl<'a, 'b> BundleInserter<'a, 'b> {
} => {
let result = self.archetype.swap_remove(location.index);
if let Some(swapped_entity) = result.swapped_entity {
self.entities.meta[swapped_entity.id as usize].location = location;
self.entities.meta[swapped_entity.index as usize].location = location;
}
// PERF: store "non bundle" components in edge, then just move those to avoid
// redundant copies
let move_result = self
.table
.move_to_superset_unchecked(result.table_row, new_table);
let new_location = new_archetype.allocate(entity, move_result.new_row);
self.entities.meta[entity.id as usize].location = new_location;
self.entities.meta[entity.index as usize].location = new_location;

// if an entity was moved into this entity's table spot, update its table row
if let Some(swapped_entity) = move_result.swapped_entity {
Expand Down Expand Up @@ -655,7 +655,7 @@ impl<'a, 'b> BundleSpawner<'a, 'b> {
self.change_tick,
bundle,
);
self.entities.meta[entity.id as usize].location = location;
self.entities.meta[entity.index as usize].location = location;

location
}
Expand Down