Skip to content

Commit

Permalink
Cleanup warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
the10thWiz committed Sep 14, 2022
1 parent eb467ea commit 47a5aa3
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 54 deletions.
11 changes: 3 additions & 8 deletions crates/bevy_animation/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,16 @@

#![warn(missing_docs)]

use std::ops::Deref;

use bevy_app::{App, CoreStage, Plugin};
use bevy_asset::{AddAsset, Assets, Handle};
use bevy_core::{EntityPath, Name, NameLookup};
use bevy_ecs::{
change_detection::DetectChanges,
entity::Entity,
prelude::Component,
query::QueryEntityError,
reflect::ReflectComponent,
schedule::ParallelSystemDescriptorCoercion,
system::{Query, Res, SystemParam},
system::{Query, Res},
};
use bevy_hierarchy::Children;
use bevy_math::{Quat, Vec3};
use bevy_reflect::{Reflect, TypeUuid};
use bevy_time::Time;
Expand Down Expand Up @@ -170,10 +165,10 @@ impl AnimationPlayer {
pub fn animation_player(
time: Res<Time>,
animations: Res<Assets<AnimationClip>>,
mut animation_players: Query<(Entity, &mut AnimationPlayer)>,
mut animation_players: Query<&mut AnimationPlayer>,
mut transforms: Query<&mut Transform>,
) {
for (entity, mut player) in &mut animation_players {
for mut player in &mut animation_players {
if let Some(animation_clip) = animations.get(&player.animation_clip) {
// Continue if paused unless the `AnimationPlayer` was changed
// This allow the animation to still be updated if the player.elapsed field was manually updated in pause
Expand Down
1 change: 0 additions & 1 deletion crates/bevy_core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ bevy_math = { path = "../bevy_math", version = "0.9.0-dev" }
bevy_reflect = { path = "../bevy_reflect", version = "0.9.0-dev", features = ["bevy"] }
bevy_tasks = { path = "../bevy_tasks", version = "0.9.0-dev" }
bevy_utils = { path = "../bevy_utils", version = "0.9.0-dev" }
bevy_hierarchy = { path = "../bevy_hierarchy", version = "0.9.0-dev" }

# other
bytemuck = "1.5"
9 changes: 1 addition & 8 deletions crates/bevy_core/src/name.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
use bevy_ecs::{
component::Component,
entity::Entity,
query::QueryEntityError,
reflect::ReflectComponent,
system::{Query, SystemParam},
};
use bevy_hierarchy::Children;
use bevy_ecs::{component::Component, reflect::ReflectComponent};
use bevy_reflect::std_traits::ReflectDefault;
use bevy_reflect::Reflect;
use bevy_utils::AHasher;
Expand Down
58 changes: 21 additions & 37 deletions crates/bevy_gltf/src/loader.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use anyhow::Result;
use bevy_animation::AnimationPlayer;
use bevy_asset::{
AssetIoError, AssetLoader, AssetPath, BoxedFuture, Handle, LoadContext, LoadedAsset,
};
Expand Down Expand Up @@ -375,7 +374,7 @@ async fn load_gltf<'a, 'b>(
.insert_bundle(SpatialBundle::VISIBLE_IDENTITY)
.with_children(|parent| {
for node in scene.nodes() {
match load_node(
let result = load_node(
&node,
parent,
load_context,
Expand All @@ -384,12 +383,10 @@ async fn load_gltf<'a, 'b>(
&mut entity_to_skin_index_map,
&mut active_camera_found,
Some(&gltf),
) {
Err(e) => {
err = Some(Err(e) as Result<(), _>);
return;
}
Ok(e) => (),
);
if result.is_err() {
err = Some(result);
return;
}
}
});
Expand Down Expand Up @@ -433,7 +430,7 @@ async fn load_gltf<'a, 'b>(
// };

#[cfg(feature = "bevy_animation")]
let (animations, named_animations, animation_roots) = {
let (animations, named_animations) = {
let mut animations = vec![];
let mut named_animations = HashMap::default();
for animation in gltf.animations() {
Expand Down Expand Up @@ -504,22 +501,9 @@ async fn load_gltf<'a, 'b>(
}
animations.push(handle);
}
(animations, named_animations, ())
(animations, named_animations)
};

// #[cfg(feature = "bevy_animation")]
// {
// // for each node root in a scene, check if it's the root of an animation
// // if it is, add the AnimationPlayer component
// for node in gltf.scenes().flat_map(|s| s.nodes()) {
// if animation_roots.contains(&node.index()) {
// world
// .entity_mut(*node_index_to_entity_map.get(&node.index()).unwrap())
// .insert(bevy_animation::AnimationPlayer::default());
// }
// }
// }

load_context.set_default_asset(LoadedAsset::new(Gltf {
default_scene: gltf
.default_scene()
Expand Down Expand Up @@ -557,20 +541,20 @@ fn node_name(node: &Node) -> Name {
Name::new(name)
}

#[cfg(feature = "bevy_animation")]
fn paths_recur(
node: Node,
current_path: &[Name],
paths: &mut HashMap<usize, (usize, Vec<Name>)>,
root_index: usize,
) {
let mut path = current_path.to_owned();
path.push(node_name(&node));
for child in node.children() {
paths_recur(child, &path, paths, root_index);
}
paths.insert(node.index(), (root_index, path));
}
// #[cfg(feature = "bevy_animation")]
// fn paths_recur(
// node: Node,
// current_path: &[Name],
// paths: &mut HashMap<usize, (usize, Vec<Name>)>,
// root_index: usize,
// ) {
// let mut path = current_path.to_owned();
// path.push(node_name(&node));
// for child in node.children() {
// paths_recur(child, &path, paths, root_index);
// }
// paths.insert(node.index(), (root_index, path));
// }

/// Loads a glTF texture as a bevy [`Image`] and returns it together with its label.
async fn load_texture<'a>(
Expand Down

0 comments on commit 47a5aa3

Please sign in to comment.