refactor(animation): renamed instancexxx to scenexxx (ie InstanceAnimations & InstancePlayerLinks)
This commit is contained in:
parent
cf4673c1e3
commit
8683a6482f
|
@ -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<String, Handle<AnimationClip>>,
|
||||
}
|
||||
|
||||
|
@ -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>,
|
||||
|
|
|
@ -120,7 +120,7 @@ impl Plugin for BlueprintsPlugin {
|
|||
.register_type::<MaterialInfo>()
|
||||
.register_type::<SpawnHere>()
|
||||
.register_type::<BlueprintAnimations>()
|
||||
.register_type::<InstanceAnimations>()
|
||||
.register_type::<SceneAnimations>()
|
||||
.register_type::<AnimationInfo>()
|
||||
.register_type::<AnimationInfos>()
|
||||
.register_type::<Vec<AnimationInfo>>()
|
||||
|
|
|
@ -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"
|
||||
},
|
||||
|
|
|
@ -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<AnimationInfos>, With<Marker1>),
|
||||
>,
|
||||
animated_marker2: Query<
|
||||
(&InstanceAnimationPlayerLink, &InstanceAnimations),
|
||||
(&SceneAnimationPlayerLink, &SceneAnimations),
|
||||
(With<AnimationInfos>, With<Marker2>),
|
||||
>,
|
||||
animated_marker3: Query<
|
||||
(
|
||||
&InstanceAnimationPlayerLink,
|
||||
&InstanceAnimations,
|
||||
&SceneAnimationPlayerLink,
|
||||
&SceneAnimations,
|
||||
&BlueprintAnimationPlayerLink,
|
||||
&BlueprintAnimations,
|
||||
),
|
||||
|
|
Loading…
Reference in New Issue