Remove bevy_camera dependency from bevy_world_serialization#24963
Remove bevy_camera dependency from bevy_world_serialization#24963Functionhx wants to merge 3 commits into
Conversation
The only usage was #[require(Visibility)] on WorldAssetRoot and DynamicWorldRoot. Per maintainer approval, removing these since Visibility does not belong in a serialization crate. Fixes bevyengine#24805 Signed-off-by: Yuchen Fan <functionhx@gmail.com>
Signed-off-by: Functionhx <2994114386@qq.com> Signed-off-by: Yuchen Fan <functionhx@gmail.com>
Per reviewer suggestion: mention that apps can use register_required_components to restore automatic Visibility insertion without pulling bevy_camera into bevy_world_serialization. Signed-off-by: Functionhx <2994114386@qq.com> Signed-off-by: Yuchen Fan <functionhx@gmail.com>
| )] | ||
| #[reflect(Component, Default, Debug, PartialEq, Clone)] | ||
| #[require(Transform)] | ||
| #[require(Visibility)] |
There was a problem hiding this comment.
Visibility and Transform are present on this because we currently use bevy_world_serialization (and these components specifically) when spawning scenes like glTF (bevy_world_serialization is the precursor to BSN). In that context, we need both Transform and Visibility for it to behave as expected. This is because the "serialized world" is spawned beneath the root entity.
A general purpose "world serialization" library definitely shouldn't be hard-coding these things. But it is currently still filling the role of a "scene system" until glTF is ported to BSN.
I think we shouldn't make these changes until glTF is ported to BSN (which would ideally happen this cycle).
There was a problem hiding this comment.
Additionally, once the glTF port happens, we should:
- Remove the required Transform too
- Look into "flat spawning" world serialization APIs that don't spawn things "under".
Objective
Fixes #24805. Removes the
bevy_cameradependency frombevy_world_serialization, which had no functional need for it — it was only used for#[require(Visibility)]annotations onWorldAssetRootandDynamicWorldRoot.Per #24805 (comment)
Solution
#[require(Visibility)]fromWorldAssetRootandDynamicWorldRootbevy_camerafromCargo.tomldependenciesuse bevy_camera::visibility::VisibilityimportTesting
cargo check -p bevy_world_serialization— zero references to bevy_camera remainWorldAssetRootorDynamicWorldRootauto-insertingVisibilityMigration Guide
Users who relied on
WorldAssetRootorDynamicWorldRootauto-insertingVisibilityshould now addVisibilityexplicitly when spawning these components.