bevy/examples/3d
Tim eb51b4c28e
Migrate scenes to required components (#15579)
# Objective

A step in the migration to required components: scenes!

## Solution

As per the [selected
proposal](https://hackmd.io/@bevy/required_components/%2FPJtNGVMMQhyM0zIvCJSkbA):
- Deprecate `SceneBundle` and `DynamicSceneBundle`.
- Add `SceneRoot` and `DynamicSceneRoot` components, which wrap a
`Handle<Scene>` and `Handle<DynamicScene>` respectively.

## Migration Guide
Asset handles for scenes and dynamic scenes must now be wrapped in the
`SceneRoot` and `DynamicSceneRoot` components. Raw handles as components
no longer spawn scenes.

Additionally, `SceneBundle` and `DynamicSceneBundle` have been
deprecated. Instead, use the scene components directly.

Previously:
```rust
let model_scene = asset_server.load(GltfAssetLabel::Scene(0).from_asset("model.gltf"));

commands.spawn(SceneBundle {
    scene: model_scene,
    transform: Transform::from_xyz(-4.0, 0.0, -3.0),
    ..default()
});
```
Now:
```rust
let model_scene = asset_server.load(GltfAssetLabel::Scene(0).from_asset("model.gltf"));

commands.spawn((
    SceneRoot(model_scene),
    Transform::from_xyz(-4.0, 0.0, -3.0),
));
```
2024-10-01 22:42:11 +00:00
..
3d_scene.rs Migrate meshes and materials to required components (#15524) 2024-10-01 21:33:17 +00:00
3d_shapes.rs Migrate meshes and materials to required components (#15524) 2024-10-01 21:33:17 +00:00
3d_viewport_to_world.rs Migrate meshes and materials to required components (#15524) 2024-10-01 21:33:17 +00:00
animated_material.rs Migrate meshes and materials to required components (#15524) 2024-10-01 21:33:17 +00:00
anisotropy.rs Migrate scenes to required components (#15579) 2024-10-01 22:42:11 +00:00
anti_aliasing.rs Migrate scenes to required components (#15579) 2024-10-01 22:42:11 +00:00
atmospheric_fog.rs Migrate scenes to required components (#15579) 2024-10-01 22:42:11 +00:00
auto_exposure.rs Migrate meshes and materials to required components (#15524) 2024-10-01 21:33:17 +00:00
blend_modes.rs Migrate meshes and materials to required components (#15524) 2024-10-01 21:33:17 +00:00
bloom_3d.rs Migrate meshes and materials to required components (#15524) 2024-10-01 21:33:17 +00:00
camera_sub_view.rs Migrate meshes and materials to required components (#15524) 2024-10-01 21:33:17 +00:00
clearcoat.rs Migrate scenes to required components (#15579) 2024-10-01 22:42:11 +00:00
color_grading.rs Migrate scenes to required components (#15579) 2024-10-01 22:42:11 +00:00
deferred_rendering.rs Migrate scenes to required components (#15579) 2024-10-01 22:42:11 +00:00
depth_of_field.rs Migrate scenes to required components (#15579) 2024-10-01 22:42:11 +00:00
fog.rs Migrate meshes and materials to required components (#15524) 2024-10-01 21:33:17 +00:00
fog_volumes.rs Migrate lights to required components (#15554) 2024-10-01 03:20:43 +00:00
generate_custom_mesh.rs Migrate meshes and materials to required components (#15524) 2024-10-01 21:33:17 +00:00
irradiance_volumes.rs Migrate scenes to required components (#15579) 2024-10-01 22:42:11 +00:00
lighting.rs Migrate meshes and materials to required components (#15524) 2024-10-01 21:33:17 +00:00
lightmaps.rs Migrate scenes to required components (#15579) 2024-10-01 22:42:11 +00:00
lines.rs Migrate meshes and materials to required components (#15524) 2024-10-01 21:33:17 +00:00
load_gltf.rs Migrate scenes to required components (#15579) 2024-10-01 22:42:11 +00:00
load_gltf_extras.rs Migrate scenes to required components (#15579) 2024-10-01 22:42:11 +00:00
meshlet.rs Migrate meshes and materials to required components (#15524) 2024-10-01 21:33:17 +00:00
motion_blur.rs Migrate meshes and materials to required components (#15524) 2024-10-01 21:33:17 +00:00
orthographic.rs Migrate meshes and materials to required components (#15524) 2024-10-01 21:33:17 +00:00
parallax_mapping.rs Migrate meshes and materials to required components (#15524) 2024-10-01 21:33:17 +00:00
parenting.rs Migrate meshes and materials to required components (#15524) 2024-10-01 21:33:17 +00:00
pbr.rs Migrate meshes and materials to required components (#15524) 2024-10-01 21:33:17 +00:00
pcss.rs Migrate scenes to required components (#15579) 2024-10-01 22:42:11 +00:00
post_processing.rs Migrate scenes to required components (#15579) 2024-10-01 22:42:11 +00:00
query_gltf_primitives.rs Migrate scenes to required components (#15579) 2024-10-01 22:42:11 +00:00
reflection_probes.rs Migrate scenes to required components (#15579) 2024-10-01 22:42:11 +00:00
render_to_texture.rs Migrate meshes and materials to required components (#15524) 2024-10-01 21:33:17 +00:00
rotate_environment_map.rs Migrate meshes and materials to required components (#15524) 2024-10-01 21:33:17 +00:00
scrolling_fog.rs Migrate meshes and materials to required components (#15524) 2024-10-01 21:33:17 +00:00
shadow_biases.rs Migrate meshes and materials to required components (#15524) 2024-10-01 21:33:17 +00:00
shadow_caster_receiver.rs Migrate meshes and materials to required components (#15524) 2024-10-01 21:33:17 +00:00
skybox.rs Migrate lights to required components (#15554) 2024-10-01 03:20:43 +00:00
spherical_area_lights.rs Migrate meshes and materials to required components (#15524) 2024-10-01 21:33:17 +00:00
split_screen.rs Migrate scenes to required components (#15579) 2024-10-01 22:42:11 +00:00
spotlight.rs Migrate meshes and materials to required components (#15524) 2024-10-01 21:33:17 +00:00
ssao.rs Migrate meshes and materials to required components (#15524) 2024-10-01 21:33:17 +00:00
ssr.rs Migrate scenes to required components (#15579) 2024-10-01 22:42:11 +00:00
texture.rs Migrate meshes and materials to required components (#15524) 2024-10-01 21:33:17 +00:00
tonemapping.rs Migrate scenes to required components (#15579) 2024-10-01 22:42:11 +00:00
transmission.rs Migrate meshes and materials to required components (#15524) 2024-10-01 21:33:17 +00:00
transparency_3d.rs Migrate meshes and materials to required components (#15524) 2024-10-01 21:33:17 +00:00
two_passes.rs Migrate meshes and materials to required components (#15524) 2024-10-01 21:33:17 +00:00
update_gltf_scene.rs Migrate scenes to required components (#15579) 2024-10-01 22:42:11 +00:00
vertex_colors.rs Migrate meshes and materials to required components (#15524) 2024-10-01 21:33:17 +00:00
visibility_range.rs Migrate scenes to required components (#15579) 2024-10-01 22:42:11 +00:00
volumetric_fog.rs Migrate scenes to required components (#15579) 2024-10-01 22:42:11 +00:00
wireframe.rs Migrate meshes and materials to required components (#15524) 2024-10-01 21:33:17 +00:00