bevy/crates/bevy_ecs/src
Peter Hayman 6882420c7f
Add some missing reflect attributes (#14259)
# Objective

- Some types are missing reflection attributes, which means we can't use
them in scene serialization etc.
- Effected types
   - `BorderRadius`
   - `AnimationTransitions`
   - `OnAdd`
   - `OnInsert`
   - `OnRemove`
- My use-case for `OnAdd` etc to derive reflect is 'Serializable
Observer Components'. Add the component, save the scene, then the
observer is re-added on scene load.

```rust
#[derive(Reflect)]
struct MySerializeableObserver<T: Event>(#[reflect(ignore)]PhantomData<T>);

impl<T: Event> Component for MySerializeableObserver<T> {
  const STORAGE_TYPE: StorageType  = StorageType::Table;
    fn register_component_hooks(hooks: &mut ComponentHooks) {
      hooks.on_add(|mut world, entity, _| {
        world
          .commands()
          .entity(entity)
          .observe(|_trigger: Trigger<T>| {
            println!("it triggered etc.");
          });
    });
  }
}
```

## Solution

- Add the missing traits

---
2024-08-02 19:20:44 +02:00
..
entity Don't show .to_bits in Display impl for Entity (#14011) 2024-06-26 00:16:22 +02:00
identifier feat: Reflection implementations on Identifier (#13648) 2024-06-03 16:33:14 +00:00
observer Make Observer::with_event (and other variants) unsafe (#13954) 2024-06-21 20:53:13 +02:00
query add missing mention of sort_unstable_by_key in QuerySortedIter docs (#14108) 2024-07-02 22:10:00 +02:00
reflect Map entities from a resource when written to the world. (#13650) 2024-06-03 16:33:24 +00:00
schedule Add on_unimplemented Diagnostics to Most Public Traits (#13347) (#13662) 2024-06-04 00:31:34 +00:00
storage Fix uses of "it's" vs "its". (#13033) 2024-04-19 18:17:31 +00:00
system Allow observer systems to have outputs (#14159) 2024-08-02 19:16:46 +02:00
world Add some missing reflect attributes (#14259) 2024-08-02 19:20:44 +02:00
archetype.rs Update observer archetype flags for sparse components (#13886) 2024-06-19 04:14:58 +02:00
batching.rs Parallel event reader (#12554) 2024-04-22 16:37:42 +00:00
bundle.rs Generalised ECS reactivity with Observers (#10839) (#13873) 2024-06-16 11:44:08 -04:00
change_detection.rs Implement WorldQuery and QueryData on Mut. (#13338) 2024-05-14 12:38:31 +00:00
component.rs Revert "constrain WorldQuery::init_state argument to ComponentInitial… (#13804) 2024-06-12 01:20:47 +02:00
event.rs Backport #14083 (deregister events) to 0.14 branch (#14114) 2024-07-02 16:01:57 -04:00
intern.rs Moves intern and label modules into bevy_ecs (#12772) 2024-04-08 15:34:11 +00:00
label.rs Use ptr::from_ref and ptr::addr_eq in macro (#13081) 2024-04-24 01:54:24 +00:00
lib.rs Generalised ECS reactivity with Observers (#10839) (#13873) 2024-06-16 11:44:08 -04:00
removal_detection.rs Remove extra call to clear_trackers (#13762) 2024-06-10 20:23:06 +02:00