Skip to content

Commit 9440629

Browse files
committed
remove SpawnScene command
1 parent ed0d169 commit 9440629

File tree

6 files changed

+39
-93
lines changed

6 files changed

+39
-93
lines changed

crates/bevy_scene/src/command.rs

Lines changed: 0 additions & 56 deletions
This file was deleted.

crates/bevy_scene/src/lib.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,19 @@
11
mod bundle;
2-
mod command;
32
mod dynamic_scene;
43
mod scene;
54
mod scene_loader;
65
mod scene_spawner;
76
pub mod serde;
87

98
pub use bundle::*;
10-
pub use command::*;
119
pub use dynamic_scene::*;
1210
pub use scene::*;
1311
pub use scene_loader::*;
1412
pub use scene_spawner::*;
1513

1614
pub mod prelude {
1715
#[doc(hidden)]
18-
pub use crate::{
19-
DynamicScene, DynamicSceneBundle, Scene, SceneBundle, SceneSpawner,
20-
SpawnSceneAsChildCommands, SpawnSceneCommands,
21-
};
16+
pub use crate::{DynamicScene, DynamicSceneBundle, Scene, SceneBundle, SceneSpawner};
2217
}
2318

2419
use bevy_app::prelude::*;

examples/3d/update_gltf_scene.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@ fn setup(
3737

3838
// Spawn the scene as a child of another entity. This first scene will be translated backward
3939
// with its parent
40-
commands
41-
.spawn_bundle(TransformBundle::from(Transform::from_xyz(0.0, 0.0, -1.0)))
42-
.with_children(|parent| {
43-
parent.spawn_scene(asset_server.load("models/FlightHelmet/FlightHelmet.gltf#Scene0"));
44-
});
40+
commands.spawn_bundle(SceneBundle {
41+
transform: Transform::from_xyz(0.0, 0.0, -1.0),
42+
scene: asset_server.load("models/FlightHelmet/FlightHelmet.gltf#Scene0"),
43+
..Default::default()
44+
});
4545

4646
// Spawn a second scene, and keep its `instance_id`
4747
let instance_id =

examples/asset/hot_asset_reloading.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
2323
// You should see the changes immediately show up in your app.
2424

2525
// mesh
26-
commands.spawn_scene(scene_handle);
26+
commands.spawn_bundle(SceneBundle {
27+
scene: scene_handle,
28+
..Default::default()
29+
});
2730
// light
2831
commands.spawn_bundle(PointLightBundle {
2932
transform: Transform::from_xyz(4.0, 5.0, 4.0),

examples/game/alien_cake_addict.rs

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -118,15 +118,11 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>, mut game: ResMu
118118
(0..BOARD_SIZE_I)
119119
.map(|i| {
120120
let height = rand::thread_rng().gen_range(-0.1..0.1);
121-
commands
122-
.spawn_bundle(TransformBundle::from(Transform::from_xyz(
123-
i as f32,
124-
height - 0.2,
125-
j as f32,
126-
)))
127-
.with_children(|cell| {
128-
cell.spawn_scene(cell_scene.clone());
129-
});
121+
commands.spawn_bundle(SceneBundle {
122+
transform: Transform::from_xyz(i as f32, height - 0.2, j as f32),
123+
scene: cell_scene.clone(),
124+
..Default::default()
125+
});
130126
Cell { height }
131127
})
132128
.collect()
@@ -136,17 +132,18 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>, mut game: ResMu
136132
// spawn the game character
137133
game.player.entity = Some(
138134
commands
139-
.spawn_bundle(TransformBundle::from(Transform {
140-
translation: Vec3::new(
141-
game.player.i as f32,
142-
game.board[game.player.j][game.player.i].height,
143-
game.player.j as f32,
144-
),
145-
rotation: Quat::from_rotation_y(-std::f32::consts::FRAC_PI_2),
135+
.spawn_bundle(SceneBundle {
136+
transform: Transform {
137+
translation: Vec3::new(
138+
game.player.i as f32,
139+
game.board[game.player.j][game.player.i].height,
140+
game.player.j as f32,
141+
),
142+
rotation: Quat::from_rotation_y(-std::f32::consts::FRAC_PI_2),
143+
..Default::default()
144+
},
145+
scene: asset_server.load("models/AlienCake/alien.glb#Scene0"),
146146
..Default::default()
147-
}))
148-
.with_children(|cell| {
149-
cell.spawn_scene(asset_server.load("models/AlienCake/alien.glb#Scene0"));
150147
})
151148
.id(),
152149
);
@@ -329,11 +326,15 @@ fn spawn_bonus(
329326
}
330327
game.bonus.entity = Some(
331328
commands
332-
.spawn_bundle(TransformBundle::from(Transform::from_xyz(
333-
game.bonus.i as f32,
334-
game.board[game.bonus.j][game.bonus.i].height + 0.2,
335-
game.bonus.j as f32,
336-
)))
329+
.spawn_bundle(SceneBundle {
330+
transform: Transform::from_xyz(
331+
game.bonus.i as f32,
332+
game.board[game.bonus.j][game.bonus.i].height + 0.2,
333+
game.bonus.j as f32,
334+
),
335+
scene: game.bonus.handle.clone(),
336+
..Default::default()
337+
})
337338
.with_children(|children| {
338339
children.spawn_bundle(PointLightBundle {
339340
point_light: PointLight {

examples/window/multiple_windows.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,10 @@ impl Node for SecondaryCameraDriver {
9797

9898
fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
9999
// add entities to the world
100-
commands.spawn_scene(asset_server.load("models/monkey/Monkey.gltf#Scene0"));
100+
commands.spawn_bundle(SceneBundle {
101+
scene: asset_server.load("models/monkey/Monkey.gltf#Scene0"),
102+
..Default::default()
103+
});
101104
// light
102105
commands.spawn_bundle(PointLightBundle {
103106
transform: Transform::from_xyz(4.0, 5.0, 4.0),

0 commit comments

Comments
 (0)