Skip to content

Commit b411dac

Browse files
committed
rename existing ReflectMapEntities methods
1 parent fcddb54 commit b411dac

File tree

3 files changed

+14
-10
lines changed

3 files changed

+14
-10
lines changed

crates/bevy_ecs/src/reflect/map_entities.rs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ use bevy_reflect::FromType;
1313
/// See [`SceneEntityMapper`] and [`MapEntities`] for more information.
1414
#[derive(Clone)]
1515
pub struct ReflectMapEntities {
16-
map_all_entities: fn(&mut World, &mut SceneEntityMapper),
17-
map_entities: fn(&mut World, &mut SceneEntityMapper, &[Entity]),
16+
map_all_world_entities: fn(&mut World, &mut SceneEntityMapper),
17+
map_world_entities: fn(&mut World, &mut SceneEntityMapper, &[Entity]),
1818
}
1919

2020
impl ReflectMapEntities {
@@ -27,8 +27,12 @@ impl ReflectMapEntities {
2727
/// An example of this: A scene can be loaded with `Parent` components, but then a `Parent` component can be added
2828
/// to these entities after they have been loaded. If you reload the scene using [`map_all_entities`](Self::map_all_entities), those `Parent`
2929
/// components with already valid entity references could be updated to point at something else entirely.
30-
pub fn map_all_entities(&self, world: &mut World, entity_map: &mut EntityHashMap<Entity>) {
31-
SceneEntityMapper::world_scope(entity_map, world, self.map_all_entities);
30+
pub fn map_all_world_entities(
31+
&self,
32+
world: &mut World,
33+
entity_map: &mut EntityHashMap<Entity>,
34+
) {
35+
SceneEntityMapper::world_scope(entity_map, world, self.map_all_world_entities);
3236
}
3337

3438
/// A general method for applying [`MapEntities`] behavior to elements in an [`EntityHashMap<Entity>`]. Unlike
@@ -37,29 +41,29 @@ impl ReflectMapEntities {
3741
///
3842
/// This is useful mostly for when you need to be careful not to update components that already contain valid entity
3943
/// values. See [`map_all_entities`](Self::map_all_entities) for more details.
40-
pub fn map_entities(
44+
pub fn map_world_entities(
4145
&self,
4246
world: &mut World,
4347
entity_map: &mut EntityHashMap<Entity>,
4448
entities: &[Entity],
4549
) {
4650
SceneEntityMapper::world_scope(entity_map, world, |world, mapper| {
47-
(self.map_entities)(world, mapper, entities);
51+
(self.map_world_entities)(world, mapper, entities);
4852
});
4953
}
5054
}
5155

5256
impl<C: Component + MapEntities> FromType<C> for ReflectMapEntities {
5357
fn from_type() -> Self {
5458
ReflectMapEntities {
55-
map_entities: |world, entity_mapper, entities| {
59+
map_world_entities: |world, entity_mapper, entities| {
5660
for &entity in entities {
5761
if let Some(mut component) = world.get_mut::<C>(entity) {
5862
component.map_entities(entity_mapper);
5963
}
6064
}
6165
},
62-
map_all_entities: |world, entity_mapper| {
66+
map_all_world_entities: |world, entity_mapper| {
6367
let entities = entity_mapper
6468
.get_map()
6569
.values()

crates/bevy_scene/src/dynamic_scene.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ impl DynamicScene {
130130
"we should be getting TypeId from this TypeRegistration in the first place",
131131
);
132132
if let Some(map_entities_reflect) = registration.data::<ReflectMapEntities>() {
133-
map_entities_reflect.map_entities(world, entity_map, &entities);
133+
map_entities_reflect.map_world_entities(world, entity_map, &entities);
134134
}
135135
}
136136

crates/bevy_scene/src/scene.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ impl Scene {
127127

128128
for registration in type_registry.iter() {
129129
if let Some(map_entities_reflect) = registration.data::<ReflectMapEntities>() {
130-
map_entities_reflect.map_all_entities(world, entity_map);
130+
map_entities_reflect.map_all_world_entities(world, entity_map);
131131
}
132132
}
133133

0 commit comments

Comments
 (0)