Skip to content

Commit 47a5aa3

Browse files
committed
Cleanup warnings
1 parent eb467ea commit 47a5aa3

File tree

4 files changed

+25
-54
lines changed

4 files changed

+25
-54
lines changed

crates/bevy_animation/src/lib.rs

+3-8
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,16 @@
22
33
#![warn(missing_docs)]
44

5-
use std::ops::Deref;
6-
75
use bevy_app::{App, CoreStage, Plugin};
86
use bevy_asset::{AddAsset, Assets, Handle};
9-
use bevy_core::{EntityPath, Name, NameLookup};
107
use bevy_ecs::{
118
change_detection::DetectChanges,
129
entity::Entity,
1310
prelude::Component,
14-
query::QueryEntityError,
1511
reflect::ReflectComponent,
1612
schedule::ParallelSystemDescriptorCoercion,
17-
system::{Query, Res, SystemParam},
13+
system::{Query, Res},
1814
};
19-
use bevy_hierarchy::Children;
2015
use bevy_math::{Quat, Vec3};
2116
use bevy_reflect::{Reflect, TypeUuid};
2217
use bevy_time::Time;
@@ -170,10 +165,10 @@ impl AnimationPlayer {
170165
pub fn animation_player(
171166
time: Res<Time>,
172167
animations: Res<Assets<AnimationClip>>,
173-
mut animation_players: Query<(Entity, &mut AnimationPlayer)>,
168+
mut animation_players: Query<&mut AnimationPlayer>,
174169
mut transforms: Query<&mut Transform>,
175170
) {
176-
for (entity, mut player) in &mut animation_players {
171+
for mut player in &mut animation_players {
177172
if let Some(animation_clip) = animations.get(&player.animation_clip) {
178173
// Continue if paused unless the `AnimationPlayer` was changed
179174
// This allow the animation to still be updated if the player.elapsed field was manually updated in pause

crates/bevy_core/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ bevy_math = { path = "../bevy_math", version = "0.9.0-dev" }
1717
bevy_reflect = { path = "../bevy_reflect", version = "0.9.0-dev", features = ["bevy"] }
1818
bevy_tasks = { path = "../bevy_tasks", version = "0.9.0-dev" }
1919
bevy_utils = { path = "../bevy_utils", version = "0.9.0-dev" }
20-
bevy_hierarchy = { path = "../bevy_hierarchy", version = "0.9.0-dev" }
2120

2221
# other
2322
bytemuck = "1.5"

crates/bevy_core/src/name.rs

+1-8
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,4 @@
1-
use bevy_ecs::{
2-
component::Component,
3-
entity::Entity,
4-
query::QueryEntityError,
5-
reflect::ReflectComponent,
6-
system::{Query, SystemParam},
7-
};
8-
use bevy_hierarchy::Children;
1+
use bevy_ecs::{component::Component, reflect::ReflectComponent};
92
use bevy_reflect::std_traits::ReflectDefault;
103
use bevy_reflect::Reflect;
114
use bevy_utils::AHasher;

crates/bevy_gltf/src/loader.rs

+21-37
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
use anyhow::Result;
2-
use bevy_animation::AnimationPlayer;
32
use bevy_asset::{
43
AssetIoError, AssetLoader, AssetPath, BoxedFuture, Handle, LoadContext, LoadedAsset,
54
};
@@ -375,7 +374,7 @@ async fn load_gltf<'a, 'b>(
375374
.insert_bundle(SpatialBundle::VISIBLE_IDENTITY)
376375
.with_children(|parent| {
377376
for node in scene.nodes() {
378-
match load_node(
377+
let result = load_node(
379378
&node,
380379
parent,
381380
load_context,
@@ -384,12 +383,10 @@ async fn load_gltf<'a, 'b>(
384383
&mut entity_to_skin_index_map,
385384
&mut active_camera_found,
386385
Some(&gltf),
387-
) {
388-
Err(e) => {
389-
err = Some(Err(e) as Result<(), _>);
390-
return;
391-
}
392-
Ok(e) => (),
386+
);
387+
if result.is_err() {
388+
err = Some(result);
389+
return;
393390
}
394391
}
395392
});
@@ -433,7 +430,7 @@ async fn load_gltf<'a, 'b>(
433430
// };
434431

435432
#[cfg(feature = "bevy_animation")]
436-
let (animations, named_animations, animation_roots) = {
433+
let (animations, named_animations) = {
437434
let mut animations = vec![];
438435
let mut named_animations = HashMap::default();
439436
for animation in gltf.animations() {
@@ -504,22 +501,9 @@ async fn load_gltf<'a, 'b>(
504501
}
505502
animations.push(handle);
506503
}
507-
(animations, named_animations, ())
504+
(animations, named_animations)
508505
};
509506

510-
// #[cfg(feature = "bevy_animation")]
511-
// {
512-
// // for each node root in a scene, check if it's the root of an animation
513-
// // if it is, add the AnimationPlayer component
514-
// for node in gltf.scenes().flat_map(|s| s.nodes()) {
515-
// if animation_roots.contains(&node.index()) {
516-
// world
517-
// .entity_mut(*node_index_to_entity_map.get(&node.index()).unwrap())
518-
// .insert(bevy_animation::AnimationPlayer::default());
519-
// }
520-
// }
521-
// }
522-
523507
load_context.set_default_asset(LoadedAsset::new(Gltf {
524508
default_scene: gltf
525509
.default_scene()
@@ -557,20 +541,20 @@ fn node_name(node: &Node) -> Name {
557541
Name::new(name)
558542
}
559543

560-
#[cfg(feature = "bevy_animation")]
561-
fn paths_recur(
562-
node: Node,
563-
current_path: &[Name],
564-
paths: &mut HashMap<usize, (usize, Vec<Name>)>,
565-
root_index: usize,
566-
) {
567-
let mut path = current_path.to_owned();
568-
path.push(node_name(&node));
569-
for child in node.children() {
570-
paths_recur(child, &path, paths, root_index);
571-
}
572-
paths.insert(node.index(), (root_index, path));
573-
}
544+
// #[cfg(feature = "bevy_animation")]
545+
// fn paths_recur(
546+
// node: Node,
547+
// current_path: &[Name],
548+
// paths: &mut HashMap<usize, (usize, Vec<Name>)>,
549+
// root_index: usize,
550+
// ) {
551+
// let mut path = current_path.to_owned();
552+
// path.push(node_name(&node));
553+
// for child in node.children() {
554+
// paths_recur(child, &path, paths, root_index);
555+
// }
556+
// paths.insert(node.index(), (root_index, path));
557+
// }
574558

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

0 commit comments

Comments
 (0)