1
1
use anyhow:: Result ;
2
- #[ cfg( feature = "bevy_animation" ) ]
3
- use bevy_animation:: { AnimationClip , AnimationPlayer , EntityPath , Keyframes , VariableCurve } ;
4
2
use bevy_asset:: {
5
3
AssetIoError , AssetLoader , AssetPath , BoxedFuture , Handle , LoadContext , LoadedAsset ,
6
4
} ;
7
5
use bevy_core:: Name ;
8
6
use bevy_ecs:: { entity:: Entity , prelude:: FromWorld , world:: World } ;
9
7
use bevy_hierarchy:: { BuildWorldChildren , WorldChildBuilder } ;
10
8
use bevy_log:: warn;
11
- use bevy_math:: { Mat4 , Quat , Vec3 } ;
9
+ use bevy_math:: { Mat4 , Vec3 } ;
12
10
use bevy_pbr:: {
13
11
AlphaMode , DirectionalLight , DirectionalLightBundle , PbrBundle , PointLight , PointLightBundle ,
14
12
StandardMaterial ,
@@ -150,7 +148,7 @@ async fn load_gltf<'a, 'b>(
150
148
let mut named_animations = HashMap :: default ( ) ;
151
149
let mut animation_roots = HashSet :: default ( ) ;
152
150
for animation in gltf. animations ( ) {
153
- let mut animation_clip = AnimationClip :: default ( ) ;
151
+ let mut animation_clip = bevy_animation :: AnimationClip :: default ( ) ;
154
152
for channel in animation. channels ( ) {
155
153
match channel. sampler ( ) . interpolation ( ) {
156
154
gltf:: animation:: Interpolation :: Linear => ( ) ,
@@ -177,13 +175,15 @@ async fn load_gltf<'a, 'b>(
177
175
let keyframes = if let Some ( outputs) = reader. read_outputs ( ) {
178
176
match outputs {
179
177
gltf:: animation:: util:: ReadOutputs :: Translations ( tr) => {
180
- Keyframes :: Translation ( tr. map ( Vec3 :: from) . collect ( ) )
178
+ bevy_animation :: Keyframes :: Translation ( tr. map ( Vec3 :: from) . collect ( ) )
181
179
}
182
180
gltf:: animation:: util:: ReadOutputs :: Rotations ( rots) => {
183
- Keyframes :: Rotation ( rots. into_f32 ( ) . map ( Quat :: from_array) . collect ( ) )
181
+ bevy_animation:: Keyframes :: Rotation (
182
+ rots. into_f32 ( ) . map ( bevy_math:: Quat :: from_array) . collect ( ) ,
183
+ )
184
184
}
185
185
gltf:: animation:: util:: ReadOutputs :: Scales ( scale) => {
186
- Keyframes :: Scale ( scale. map ( Vec3 :: from) . collect ( ) )
186
+ bevy_animation :: Keyframes :: Scale ( scale. map ( Vec3 :: from) . collect ( ) )
187
187
}
188
188
gltf:: animation:: util:: ReadOutputs :: MorphTargetWeights ( _) => {
189
189
warn ! ( "Morph animation property not yet supported" ) ;
@@ -198,10 +198,10 @@ async fn load_gltf<'a, 'b>(
198
198
if let Some ( ( root_index, path) ) = paths. get ( & node. index ( ) ) {
199
199
animation_roots. insert ( root_index) ;
200
200
animation_clip. add_curve_to_path (
201
- EntityPath {
201
+ bevy_animation :: EntityPath {
202
202
parts : path. clone ( ) ,
203
203
} ,
204
- VariableCurve {
204
+ bevy_animation :: VariableCurve {
205
205
keyframe_timestamps,
206
206
keyframes,
207
207
} ,
@@ -481,7 +481,7 @@ async fn load_gltf<'a, 'b>(
481
481
if animation_roots. contains ( & node. index ( ) ) {
482
482
world
483
483
. entity_mut ( * node_index_to_entity_map. get ( & node. index ( ) ) . unwrap ( ) )
484
- . insert ( AnimationPlayer :: default ( ) ) ;
484
+ . insert ( bevy_animation :: AnimationPlayer :: default ( ) ) ;
485
485
}
486
486
}
487
487
}
@@ -539,6 +539,7 @@ fn node_name(node: &Node) -> Name {
539
539
Name :: new ( name)
540
540
}
541
541
542
+ #[ cfg( feature = "bevy_animation" ) ]
542
543
fn paths_recur (
543
544
node : Node ,
544
545
current_path : & [ Name ] ,
0 commit comments