bevy/crates/bevy_ecs/src
Noah 72fc63e594
implement insert and remove reflected entity commands (#8895)
# Objective

To enable non exclusive system usage of reflected components and make
reflection more ergonomic to use by making it more in line with standard
entity commands.

## Solution

- Implements a new `EntityCommands` extension trait for reflection
related functions in the reflect module of bevy_ecs.
- Implements 4 new commands, `insert_reflect`,
`insert_reflect_with_registry`, `remove_reflect`, and
`remove_reflect_with_registry`. Both insert commands take a `Box<dyn
Reflect>` component while the remove commands take the component type
name.

- Made `EntityCommands` fields pub(crate) to allow access in the reflect
module. (Might be worth making these just public to enable user end
custom entity commands in a different pr)
- Added basic tests to ensure the commands are actually working.
- Documentation of functions.

---

## Changelog

Added:
-  Implements 4 new commands on the new entity commands extension.
- `insert_reflect`
- `remove_reflect`
- `insert_reflect_with_registry`
- `remove_reflect_with_registry`

The commands operate the same except the with_registry commands take a
generic parameter for a resource that implements `AsRef<TypeRegistry>`.
Otherwise the default commands use the `AppTypeRegistry` for reflection
data.

Changed:

- Made `EntityCommands` fields pub(crate) to allow access in the reflect
module.

> Hopefully this time it works. Please don't make me rebase again ☹
2023-08-28 18:21:20 +00:00
..
entity Replaced EntityMap with HashMap (#9461) 2023-08-28 17:18:16 +00:00
query Improve various Debug implementations (#9588) 2023-08-26 21:27:41 +00:00
reflect implement insert and remove reflected entity commands (#8895) 2023-08-28 18:21:20 +00:00
schedule clean up configure_set(s) erroring (#9577) 2023-08-28 17:44:52 +00:00
storage Fix typos throughout the project (#9090) 2023-07-10 00:11:51 +00:00
system implement insert and remove reflected entity commands (#8895) 2023-08-28 18:21:20 +00:00
world Fix CI for Rust 1.72 (#9562) 2023-08-25 12:34:24 +00:00
archetype.rs Fix typo in Archetypes documentation (#8990) 2023-06-28 19:33:18 +00:00
bundle.rs Document every public item in bevy_ecs (#8731) 2023-06-10 23:23:48 +00:00
change_detection.rs Fix incorrect documentation link in DetectChangesMut (#9431) 2023-08-15 21:48:12 +00:00
component.rs Derive Eq, PartialEq for Tick (#9020) 2023-07-04 19:08:51 +00:00
event.rs Rename ManualEventIterator (#9592) 2023-08-28 17:49:25 +00:00
lib.rs Add system.map(...) for transforming the output of a system (#8526) 2023-08-28 16:36:46 +00:00
removal_detection.rs Rename ManualEventIterator (#9592) 2023-08-28 17:49:25 +00:00