Skip to content

Commit

Permalink
remove SpawnScene command
Browse files Browse the repository at this point in the history
  • Loading branch information
mockersf committed Aug 18, 2021
1 parent 58e6789 commit 49fbd24
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 94 deletions.
56 changes: 0 additions & 56 deletions crates/bevy_scene/src/command.rs

This file was deleted.

7 changes: 1 addition & 6 deletions crates/bevy_scene/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,24 +1,19 @@
mod bundle;
mod command;
mod dynamic_scene;
mod scene;
mod scene_loader;
mod scene_spawner;
pub mod serde;

pub use bundle::*;
pub use command::*;
pub use dynamic_scene::*;
pub use scene::*;
pub use scene_loader::*;
pub use scene_spawner::*;

pub mod prelude {
#[doc(hidden)]
pub use crate::{
DynamicScene, DynamicSceneBundle, Scene, SceneBundle, SceneSpawner,
SpawnSceneAsChildCommands, SpawnSceneCommands,
};
pub use crate::{DynamicScene, DynamicSceneBundle, Scene, SceneBundle, SceneSpawner};
}

use bevy_app::prelude::*;
Expand Down
15 changes: 5 additions & 10 deletions examples/3d/update_gltf_scene.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,11 @@ fn setup(
..Default::default()
});

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

// Spawn a second scene, and keep its `instance_id`
let instance_id =
Expand Down
5 changes: 4 additions & 1 deletion examples/asset/hot_asset_reloading.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
// You should see the changes immediately show up in your app.

// mesh
commands.spawn_scene(scene_handle);
commands.spawn_bundle(SceneBundle {
scene: scene_handle,
..Default::default()
});
// light
commands.spawn_bundle(PointLightBundle {
transform: Transform::from_xyz(4.0, 5.0, 4.0),
Expand Down
33 changes: 13 additions & 20 deletions examples/game/alien_cake_addict.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,14 +113,11 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>, mut game: ResMu
(0..BOARD_SIZE_I)
.map(|i| {
let height = rand::thread_rng().gen_range(-0.1..0.1);
commands
.spawn_bundle((
Transform::from_xyz(i as f32, height - 0.2, j as f32),
GlobalTransform::identity(),
))
.with_children(|cell| {
cell.spawn_scene(cell_scene.clone());
});
commands.spawn_bundle(SceneBundle {
transform: Transform::from_xyz(i as f32, height - 0.2, j as f32),
scene: cell_scene.clone(),
..Default::default()
});
Cell { height }
})
.collect()
Expand All @@ -130,8 +127,8 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>, mut game: ResMu
// spawn the game character
game.player.entity = Some(
commands
.spawn_bundle((
Transform {
.spawn_bundle(SceneBundle {
transform: Transform {
translation: Vec3::new(
game.player.i as f32,
game.board[game.player.j][game.player.i].height,
Expand All @@ -140,10 +137,8 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>, mut game: ResMu
rotation: Quat::from_rotation_y(-std::f32::consts::FRAC_PI_2),
..Default::default()
},
GlobalTransform::identity(),
))
.with_children(|cell| {
cell.spawn_scene(asset_server.load("models/AlienCake/alien.glb#Scene0"));
scene: asset_server.load("models/AlienCake/alien.glb#Scene0"),
..Default::default()
})
.id(),
);
Expand Down Expand Up @@ -320,19 +315,17 @@ fn spawn_bonus(
}
game.bonus.entity = Some(
commands
.spawn_bundle((
Transform {
.spawn_bundle(SceneBundle {
transform: Transform {
translation: Vec3::new(
game.bonus.i as f32,
game.board[game.bonus.j][game.bonus.i].height + 0.2,
game.bonus.j as f32,
),
..Default::default()
},
GlobalTransform::identity(),
))
.with_children(|cell| {
cell.spawn_scene(game.bonus.handle.clone());
scene: game.bonus.handle.clone(),
..Default::default()
})
.id(),
);
Expand Down
5 changes: 4 additions & 1 deletion examples/window/multiple_windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,10 @@ fn setup_pipeline(
// SETUP SCENE

// add entities to the world
commands.spawn_scene(asset_server.load("models/monkey/Monkey.gltf#Scene0"));
commands.spawn_bundle(SceneBundle {
scene: asset_server.load("models/monkey/Monkey.gltf#Scene0"),
..Default::default()
});
// light
commands.spawn_bundle(PointLightBundle {
transform: Transform::from_xyz(4.0, 5.0, 4.0),
Expand Down

0 comments on commit 49fbd24

Please sign in to comment.