diff --git a/crates/bevy_gltf_blueprints/src/animation.rs b/crates/bevy_gltf_blueprints/src/animation.rs index 6473818..70fb5a8 100644 --- a/crates/bevy_gltf_blueprints/src/animation.rs +++ b/crates/bevy_gltf_blueprints/src/animation.rs @@ -17,8 +17,8 @@ pub struct BlueprintAnimationPlayerLink(pub Entity); #[derive(Component, Reflect, Default, Debug)] #[reflect(Component)] -/// storage for animations for a given entity (hierarchy), essentially a clone of gltf's `named_animations` -pub struct InstanceAnimations { +/// storage for scene level animations for a given entity (hierarchy), essentially a clone of gltf's `named_animations` +pub struct SceneAnimations { pub named_animations: HashMap>, } @@ -27,7 +27,7 @@ pub struct InstanceAnimations { /// so that the root entity knows which of its children contains an actualy `AnimationPlayer` component /// this is for convenience, because currently , Bevy's gltf parsing inserts `AnimationPlayers` "one level down" /// ie armature/root for animated models, which means more complex queries to trigger animations that we want to avoid -pub struct InstanceAnimationPlayerLink(pub Entity); +pub struct SceneAnimationPlayerLink(pub Entity); /// Stores Animation information: name, frame informations etc #[derive(Reflect, Default, Debug)] @@ -78,8 +78,8 @@ pub fn trigger_instance_animation_markers_events( animation_infos: Query<( Entity, &AnimationMarkers, - &InstanceAnimationPlayerLink, - &InstanceAnimations, + &SceneAnimationPlayerLink, + &SceneAnimations, &AnimationInfos, )>, animation_players: Query<&AnimationPlayer>, diff --git a/crates/bevy_gltf_blueprints/src/lib.rs b/crates/bevy_gltf_blueprints/src/lib.rs index 5960664..7fbe551 100644 --- a/crates/bevy_gltf_blueprints/src/lib.rs +++ b/crates/bevy_gltf_blueprints/src/lib.rs @@ -120,7 +120,7 @@ impl Plugin for BlueprintsPlugin { .register_type::() .register_type::() .register_type::() - .register_type::() + .register_type::() .register_type::() .register_type::() .register_type::>() diff --git a/testing/bevy_example/assets/registry.json b/testing/bevy_example/assets/registry.json index 3752489..d348baa 100644 --- a/testing/bevy_example/assets/registry.json +++ b/testing/bevy_example/assets/registry.json @@ -3676,7 +3676,7 @@ "type": "object", "typeInfo": "Struct" }, - "bevy_gltf_blueprints::animation::InstanceAnimations": { + "bevy_gltf_blueprints::animation::SceneAnimations": { "additionalProperties": false, "isComponent": true, "isResource": false, @@ -3690,8 +3690,8 @@ "required": [ "named_animations" ], - "short_name": "InstanceAnimations", - "title": "bevy_gltf_blueprints::animation::InstanceAnimations", + "short_name": "SceneAnimations", + "title": "bevy_gltf_blueprints::animation::SceneAnimations", "type": "object", "typeInfo": "Struct" }, diff --git a/testing/bevy_example/src/game/animation.rs b/testing/bevy_example/src/game/animation.rs index e6aae9e..0bdab6a 100644 --- a/testing/bevy_example/src/game/animation.rs +++ b/testing/bevy_example/src/game/animation.rs @@ -2,7 +2,7 @@ use std::time::Duration; use bevy_gltf_blueprints::{ AnimationInfos, AnimationMarkerReached, BlueprintAnimationPlayerLink, BlueprintAnimations, - InstanceAnimationPlayerLink, InstanceAnimations, + SceneAnimationPlayerLink, SceneAnimations, }; use bevy::{gltf::Gltf, prelude::*}; @@ -58,7 +58,7 @@ pub fn animations( name, entity ); println!("Found match {:?}", gltf.named_animations); - commands.entity(entity).insert(InstanceAnimations { + commands.entity(entity).insert(SceneAnimations { named_animations: gltf.named_animations.clone(), }); for ancestor in parents.iter_ancestors(entity) { @@ -66,7 +66,7 @@ pub fn animations( // println!("found match with animationPlayer !! {:?}",names.get(ancestor)); commands .entity(entity) - .insert(InstanceAnimationPlayerLink(ancestor)); + .insert(SceneAnimationPlayerLink(ancestor)); } // info!("{:?} is an ancestor of {:?}", ancestor, player); } @@ -77,17 +77,17 @@ pub fn animations( pub fn play_animations( animated_marker1: Query< - (&InstanceAnimationPlayerLink, &InstanceAnimations), + (&SceneAnimationPlayerLink, &SceneAnimations), (With, With), >, animated_marker2: Query< - (&InstanceAnimationPlayerLink, &InstanceAnimations), + (&SceneAnimationPlayerLink, &SceneAnimations), (With, With), >, animated_marker3: Query< ( - &InstanceAnimationPlayerLink, - &InstanceAnimations, + &SceneAnimationPlayerLink, + &SceneAnimations, &BlueprintAnimationPlayerLink, &BlueprintAnimations, ),