Skip to content

Commit

Permalink
Revert "Make Commands and World apis consistent (bevyengine#1703)"
Browse files Browse the repository at this point in the history
This reverts commit 81b53d1.
  • Loading branch information
siler committed Mar 23, 2021
1 parent 7c1a2f4 commit 8860534
Show file tree
Hide file tree
Showing 55 changed files with 1,159 additions and 1,107 deletions.
277 changes: 123 additions & 154 deletions crates/bevy_ecs/src/system/commands.rs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion crates/bevy_ecs/src/system/exclusive_system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ mod tests {
) {
for entity in query.iter() {
*counter += 1;
commands.entity(entity).remove::<f32>();
commands.remove::<f32>(entity);
}
}

Expand Down
16 changes: 8 additions & 8 deletions crates/bevy_gltf/src/loader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -296,18 +296,18 @@ fn load_node(
) -> Result<(), GltfError> {
let transform = gltf_node.transform();
let mut gltf_error = None;
let mut node = world_builder.spawn_bundle((
let node = world_builder.spawn((
Transform::from_matrix(Mat4::from_cols_array_2d(&transform.matrix())),
GlobalTransform::identity(),
));

if let Some(name) = gltf_node.name() {
node.insert(Name::new(name.to_string()));
node.with(Name::new(name.to_string()));
}

// create camera node
if let Some(camera) = gltf_node.camera() {
node.insert(VisibleEntities {
node.with(VisibleEntities {
..Default::default()
});

Expand All @@ -325,12 +325,12 @@ fn load_node(
..Default::default()
};

node.insert(Camera {
node.with(Camera {
name: Some(base::camera::CAMERA_2D.to_owned()),
projection_matrix: orthographic_projection.get_projection_matrix(),
..Default::default()
});
node.insert(orthographic_projection);
node.with(orthographic_projection);
}
gltf::camera::Projection::Perspective(perspective) => {
let mut perspective_projection: PerspectiveProjection = PerspectiveProjection {
Expand All @@ -344,12 +344,12 @@ fn load_node(
if let Some(aspect_ratio) = perspective.aspect_ratio() {
perspective_projection.aspect_ratio = aspect_ratio;
}
node.insert(Camera {
node.with(Camera {
name: Some(base::camera::CAMERA_3D.to_owned()),
projection_matrix: perspective_projection.get_projection_matrix(),
..Default::default()
});
node.insert(perspective_projection);
node.with(perspective_projection);
}
}
}
Expand All @@ -374,7 +374,7 @@ fn load_node(
let material_asset_path =
AssetPath::new_ref(load_context.path(), Some(&material_label));

parent.spawn_bundle(PbrBundle {
parent.spawn(PbrBundle {
mesh: load_context.get_handle(mesh_asset_path),
material: load_context.get_handle(material_asset_path),
..Default::default()
Expand Down
6 changes: 3 additions & 3 deletions crates/bevy_scene/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ impl Command for SpawnScene {
}

pub trait SpawnSceneCommands {
fn spawn_scene(&mut self, scene: Handle<Scene>);
fn spawn_scene(&mut self, scene: Handle<Scene>) -> &mut Self;
}

impl<'a> SpawnSceneCommands for Commands<'a> {
fn spawn_scene(&mut self, scene_handle: Handle<Scene>) {
self.add(SpawnScene { scene_handle });
fn spawn_scene(&mut self, scene_handle: Handle<Scene>) -> &mut Self {
self.add_command(SpawnScene { scene_handle })
}
}

Expand Down
Loading

0 comments on commit 8860534

Please sign in to comment.