From 9d8f94d461664339309a5a4d0b3820ac2c8e0eb8 Mon Sep 17 00:00:00 2001 From: Ycy Date: Fri, 3 May 2024 21:00:18 +0800 Subject: [PATCH] fix `bevy_gltf` crate build (#13202) # Objective Fixing `bevy_gltf` crate build fail when `bevy_animation` feature is disabled ## Solution Add missing `bevy_animation` feature --- crates/bevy_gltf/Cargo.toml | 4 ++-- crates/bevy_gltf/src/loader.rs | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/crates/bevy_gltf/Cargo.toml b/crates/bevy_gltf/Cargo.toml index 3fc387902f..66bb01abe7 100644 --- a/crates/bevy_gltf/Cargo.toml +++ b/crates/bevy_gltf/Cargo.toml @@ -9,8 +9,8 @@ license = "MIT OR Apache-2.0" keywords = ["bevy"] [features] -dds = [] -pbr_transmission_textures = [] +dds = ["bevy_render/dds"] +pbr_transmission_textures = ["bevy_pbr/pbr_transmission_textures"] [dependencies] # bevy diff --git a/crates/bevy_gltf/src/loader.rs b/crates/bevy_gltf/src/loader.rs index 963b747488..171c09882f 100644 --- a/crates/bevy_gltf/src/loader.rs +++ b/crates/bevy_gltf/src/loader.rs @@ -605,7 +605,9 @@ async fn load_gltf<'a, 'b, 'c>( &mut entity_to_skin_index_map, &mut active_camera_found, &Transform::default(), + #[cfg(feature = "bevy_animation")] &animation_roots, + #[cfg(feature = "bevy_animation")] None, ); if result.is_err() { @@ -1011,8 +1013,8 @@ fn load_node( entity_to_skin_index_map: &mut EntityHashMap, active_camera_found: &mut bool, parent_transform: &Transform, - animation_roots: &HashSet, - mut animation_context: Option, + #[cfg(feature = "bevy_animation")] animation_roots: &HashSet, + #[cfg(feature = "bevy_animation")] mut animation_context: Option, ) -> Result<(), GltfError> { let mut gltf_error = None; let transform = node_transform(gltf_node); @@ -1261,7 +1263,9 @@ fn load_node( entity_to_skin_index_map, active_camera_found, &world_transform, + #[cfg(feature = "bevy_animation")] animation_roots, + #[cfg(feature = "bevy_animation")] animation_context.clone(), ) { gltf_error = Some(err); @@ -1632,10 +1636,6 @@ struct AnimationContext { path: SmallVec<[Name; 8]>, } -#[cfg(not(feature = "bevy_animation"))] -#[derive(Clone)] -struct AnimationContext; - #[cfg(test)] mod test { use std::path::PathBuf;