Skip to content

Commit efd233d

Browse files
committed
remove SpawnScene command
1 parent a54918c commit efd233d

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
@@ -116,15 +116,11 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>, mut game: ResMu
116116
(0..BOARD_SIZE_I)
117117
.map(|i| {
118118
let height = rand::thread_rng().gen_range(-0.1..0.1);
119-
commands
120-
.spawn_bundle(TransformBundle::from(Transform::from_xyz(
121-
i as f32,
122-
height - 0.2,
123-
j as f32,
124-
)))
125-
.with_children(|cell| {
126-
cell.spawn_scene(cell_scene.clone());
127-
});
119+
commands.spawn_bundle(SceneBundle {
120+
transform: Transform::from_xyz(i as f32, height - 0.2, j as f32),
121+
scene: cell_scene.clone(),
122+
..Default::default()
123+
});
128124
Cell { height }
129125
})
130126
.collect()
@@ -134,17 +130,18 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>, mut game: ResMu
134130
// spawn the game character
135131
game.player.entity = Some(
136132
commands
137-
.spawn_bundle(TransformBundle::from(Transform {
138-
translation: Vec3::new(
139-
game.player.i as f32,
140-
game.board[game.player.j][game.player.i].height,
141-
game.player.j as f32,
142-
),
143-
rotation: Quat::from_rotation_y(-std::f32::consts::FRAC_PI_2),
133+
.spawn_bundle(SceneBundle {
134+
transform: Transform {
135+
translation: Vec3::new(
136+
game.player.i as f32,
137+
game.board[game.player.j][game.player.i].height,
138+
game.player.j as f32,
139+
),
140+
rotation: Quat::from_rotation_y(-std::f32::consts::FRAC_PI_2),
141+
..Default::default()
142+
},
143+
scene: asset_server.load("models/AlienCake/alien.glb#Scene0"),
144144
..Default::default()
145-
}))
146-
.with_children(|cell| {
147-
cell.spawn_scene(asset_server.load("models/AlienCake/alien.glb#Scene0"));
148145
})
149146
.id(),
150147
);
@@ -322,11 +319,15 @@ fn spawn_bonus(
322319
}
323320
game.bonus.entity = Some(
324321
commands
325-
.spawn_bundle(TransformBundle::from(Transform::from_xyz(
326-
game.bonus.i as f32,
327-
game.board[game.bonus.j][game.bonus.i].height + 0.2,
328-
game.bonus.j as f32,
329-
)))
322+
.spawn_bundle(SceneBundle {
323+
transform: Transform::from_xyz(
324+
game.bonus.i as f32,
325+
game.board[game.bonus.j][game.bonus.i].height + 0.2,
326+
game.bonus.j as f32,
327+
),
328+
scene: game.bonus.handle.clone(),
329+
..Default::default()
330+
})
330331
.with_children(|children| {
331332
children.spawn_bundle(PointLightBundle {
332333
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)