bevy/crates/bevy_scene/src
Giacomo Stevanato 309c3876bf
Replace FromWorld requirement on ReflectResource and reflect Resource for State<S> (#12136)
# Objective

- In #9623 I forgot to change the `FromWorld` requirement for
`ReflectResource`, fix that;
- Fix #12129

## Solution

- Use the same approach as in #9623 to try using `FromReflect` and
falling back to the `ReflectFromWorld` contained in the `TypeRegistry`
provided
- Just reflect `Resource` on `State<S>` since now that's possible
without introducing new bounds.

---

## Changelog

- `ReflectResource`'s `FromType<T>` implementation no longer requires
`T: FromWorld`, but instead now requires `FromReflect`.
- `ReflectResource::insert`, `ReflectResource::apply_or_insert` and
`ReflectResource::copy` now take an extra `&TypeRegistry` parameter.

## Migration Guide

- Users of `#[reflect(Resource)]` will need to also implement/derive
`FromReflect` (should already be the default).
- Users of `#[reflect(Resource)]` may now want to also add `FromWorld`
to the list of reflected traits in case their `FromReflect`
implementation may fail.
- Users of `ReflectResource` will now need to pass a `&TypeRegistry` to
its `insert`, `apply_or_insert` and `copy` methods.
2024-02-27 15:49:39 +00:00
..
bundle.rs Finish documenting bevy_scene (#9949) 2023-10-01 17:54:19 +00:00
dynamic_scene.rs Replace FromWorld requirement on ReflectResource and reflect Resource for State<S> (#12136) 2024-02-27 15:49:39 +00:00
dynamic_scene_builder.rs Make builder types take and return Self (#10001) 2023-10-09 19:46:17 +00:00
lib.rs Inverse missing_docs logic (#11676) 2024-02-03 21:40:55 +00:00
scene.rs Replace FromWorld requirement on ReflectResource and reflect Resource for State<S> (#12136) 2024-02-27 15:49:39 +00:00
scene_filter.rs Make builder types take and return Self (#10001) 2023-10-09 19:46:17 +00:00
scene_loader.rs Re-export ron in bevy_scene (#10529) 2023-11-15 14:45:54 +00:00
scene_spawner.rs Move EntityHash related types into bevy_ecs (#11498) 2024-02-12 15:02:24 +00:00
serde.rs Move EntityHash related types into bevy_ecs (#11498) 2024-02-12 15:02:24 +00:00