Fix regression in bevy_gltf build (#15512)

# Objective

Fixes #15503

## Solution

Move the use

## Testing

Compiled with `cargo build --no-default-features --features bevy_gltf`
successfully.

## Showcase


![image](https://github.com/user-attachments/assets/b5637e0e-2af9-4b8e-bf24-b378775d3f10)
This commit is contained in:
Benjamin Brienen 2024-09-29 04:23:11 +02:00 committed by GitHub
parent c32e0b9ec2
commit bd20382a4a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -4,9 +4,6 @@ use crate::{
}; };
use alloc::collections::VecDeque; use alloc::collections::VecDeque;
use bevy_animation::prelude::{
Keyframes, MorphWeightsKeyframes, RotationKeyframes, ScaleKeyframes, TranslationKeyframes,
};
use bevy_asset::{ use bevy_asset::{
io::Reader, AssetLoadError, AssetLoader, Handle, LoadContext, ReadAssetBytesError, io::Reader, AssetLoadError, AssetLoader, Handle, LoadContext, ReadAssetBytesError,
}; };
@ -65,7 +62,7 @@ use std::{
use thiserror::Error; use thiserror::Error;
#[cfg(feature = "bevy_animation")] #[cfg(feature = "bevy_animation")]
use { use {
bevy_animation::{AnimationTarget, AnimationTargetId}, bevy_animation::{prelude::*, AnimationTarget, AnimationTargetId},
smallvec::SmallVec, smallvec::SmallVec,
}; };
@ -277,7 +274,7 @@ async fn load_gltf<'a, 'b, 'c>(
let mut named_animations = HashMap::default(); let mut named_animations = HashMap::default();
let mut animation_roots = HashSet::default(); let mut animation_roots = HashSet::default();
for animation in gltf.animations() { for animation in gltf.animations() {
let mut animation_clip = bevy_animation::AnimationClip::default(); let mut animation_clip = AnimationClip::default();
for channel in animation.channels() { for channel in animation.channels() {
let interpolation = match channel.sampler().interpolation() { let interpolation = match channel.sampler().interpolation() {
gltf::animation::Interpolation::Linear => Interpolation::Linear, gltf::animation::Interpolation::Linear => Interpolation::Linear,
@ -330,7 +327,7 @@ async fn load_gltf<'a, 'b, 'c>(
animation_roots.insert(*root_index); animation_roots.insert(*root_index);
animation_clip.add_curve_to_target( animation_clip.add_curve_to_target(
AnimationTargetId::from_names(path.iter()), AnimationTargetId::from_names(path.iter()),
bevy_animation::VariableCurve { VariableCurve {
keyframe_timestamps, keyframe_timestamps,
keyframes, keyframes,
interpolation, interpolation,
@ -738,7 +735,7 @@ async fn load_gltf<'a, 'b, 'c>(
if animation_roots.contains(&node.index()) { if animation_roots.contains(&node.index()) {
world world
.entity_mut(*node_index_to_entity_map.get(&node.index()).unwrap()) .entity_mut(*node_index_to_entity_map.get(&node.index()).unwrap())
.insert(bevy_animation::AnimationPlayer::default()); .insert(AnimationPlayer::default());
} }
} }
} }