Skip to content

Commit 49fbd24

Browse files
committed
remove SpawnScene command
1 parent 58e6789 commit 49fbd24

File tree

6 files changed

+27
-94
lines changed

6 files changed

+27
-94
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 & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,11 @@ fn setup(
3434
..Default::default()
3535
});
3636

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

4843
// Spawn a second scene, and keep its `instance_id`
4944
let instance_id =

examples/asset/hot_asset_reloading.rs

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

2323
// mesh
24-
commands.spawn_scene(scene_handle);
24+
commands.spawn_bundle(SceneBundle {
25+
scene: scene_handle,
26+
..Default::default()
27+
});
2528
// light
2629
commands.spawn_bundle(PointLightBundle {
2730
transform: Transform::from_xyz(4.0, 5.0, 4.0),

examples/game/alien_cake_addict.rs

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -113,14 +113,11 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>, mut game: ResMu
113113
(0..BOARD_SIZE_I)
114114
.map(|i| {
115115
let height = rand::thread_rng().gen_range(-0.1..0.1);
116-
commands
117-
.spawn_bundle((
118-
Transform::from_xyz(i as f32, height - 0.2, j as f32),
119-
GlobalTransform::identity(),
120-
))
121-
.with_children(|cell| {
122-
cell.spawn_scene(cell_scene.clone());
123-
});
116+
commands.spawn_bundle(SceneBundle {
117+
transform: Transform::from_xyz(i as f32, height - 0.2, j as f32),
118+
scene: cell_scene.clone(),
119+
..Default::default()
120+
});
124121
Cell { height }
125122
})
126123
.collect()
@@ -130,8 +127,8 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>, mut game: ResMu
130127
// spawn the game character
131128
game.player.entity = Some(
132129
commands
133-
.spawn_bundle((
134-
Transform {
130+
.spawn_bundle(SceneBundle {
131+
transform: Transform {
135132
translation: Vec3::new(
136133
game.player.i as f32,
137134
game.board[game.player.j][game.player.i].height,
@@ -140,10 +137,8 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>, mut game: ResMu
140137
rotation: Quat::from_rotation_y(-std::f32::consts::FRAC_PI_2),
141138
..Default::default()
142139
},
143-
GlobalTransform::identity(),
144-
))
145-
.with_children(|cell| {
146-
cell.spawn_scene(asset_server.load("models/AlienCake/alien.glb#Scene0"));
140+
scene: asset_server.load("models/AlienCake/alien.glb#Scene0"),
141+
..Default::default()
147142
})
148143
.id(),
149144
);
@@ -320,19 +315,17 @@ fn spawn_bonus(
320315
}
321316
game.bonus.entity = Some(
322317
commands
323-
.spawn_bundle((
324-
Transform {
318+
.spawn_bundle(SceneBundle {
319+
transform: Transform {
325320
translation: Vec3::new(
326321
game.bonus.i as f32,
327322
game.board[game.bonus.j][game.bonus.i].height + 0.2,
328323
game.bonus.j as f32,
329324
),
330325
..Default::default()
331326
},
332-
GlobalTransform::identity(),
333-
))
334-
.with_children(|cell| {
335-
cell.spawn_scene(game.bonus.handle.clone());
327+
scene: game.bonus.handle.clone(),
328+
..Default::default()
336329
})
337330
.id(),
338331
);

examples/window/multiple_windows.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,10 @@ fn setup_pipeline(
183183
// SETUP SCENE
184184

185185
// add entities to the world
186-
commands.spawn_scene(asset_server.load("models/monkey/Monkey.gltf#Scene0"));
186+
commands.spawn_bundle(SceneBundle {
187+
scene: asset_server.load("models/monkey/Monkey.gltf#Scene0"),
188+
..Default::default()
189+
});
187190
// light
188191
commands.spawn_bundle(PointLightBundle {
189192
transform: Transform::from_xyz(4.0, 5.0, 4.0),

0 commit comments

Comments
 (0)