Skip to content

Making so animation transition is able to handle multiple active animations! #18954

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 31 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
17f630c
Making so animation transition is non reliant on animation players
Sirmadeira Apr 26, 2025
0ff3543
Format
Sirmadeira Apr 26, 2025
debc131
Chore: Node transitions
Sirmadeira Apr 28, 2025
f450a3c
Structuring
Sirmadeira Apr 28, 2025
7631aff
Merge branch 'bevyengine:main' into main
Sirmadeira Apr 28, 2025
0e5f12a
Updating examples blind testing
Sirmadeira Apr 28, 2025
8825c4e
Fix very clunky logic for transitioning
Sirmadeira Apr 29, 2025
a52d954
Warn transition
Sirmadeira Apr 29, 2025
04ac9e0
Adjusting examples
Sirmadeira Apr 29, 2025
8d9af1f
Final commit
Sirmadeira Apr 29, 2025
e3a67ad
Fmt
Sirmadeira Apr 29, 2025
38d005c
Merge branch 'bevyengine:main' into main
Sirmadeira Apr 29, 2025
3822d58
Doc fix
Sirmadeira Apr 29, 2025
99bb73b
More docs
Sirmadeira Apr 29, 2025
cc996c5
Backtick
Sirmadeira Apr 29, 2025
1b700f7
Handling edge case first flow
Sirmadeira May 3, 2025
2e088ae
Add slight note doc for animation graph default values
Sirmadeira May 3, 2025
658bfc6
Merge branch 'main' into main
Sirmadeira May 3, 2025
e014103
Feat: Make it so animation transition is based on animation player, w…
Sirmadeira May 4, 2025
67413bd
Chore: Docs + Format
Sirmadeira May 4, 2025
70a1077
Chore: Fix docs
Sirmadeira May 4, 2025
f023cef
Chore: Doc fixes + shortening if statement
Sirmadeira May 4, 2025
6ec828b
Chore: Remove vscode file
Sirmadeira May 4, 2025
ca70f75
Merge branch 'main' into main
Sirmadeira May 4, 2025
ab60516
Fix: Conflicts
Sirmadeira Jun 11, 2025
d712ec7
Feat: Backward compatibility
Sirmadeira Jun 11, 2025
2ffb547
Testbed adjustment
Sirmadeira Jun 11, 2025
fadc07d
Cargo fmt
Sirmadeira Jun 11, 2025
c5dc465
Typos -w
Sirmadeira Jun 11, 2025
9a6186f
Doc fix
Sirmadeira Jun 12, 2025
d500cc5
Merge branch 'main' into main
Sirmadeira Jun 12, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions crates/bevy_animation/src/graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ use crate::{AnimationClip, AnimationTargetId};
/// mask corresponds to a *mask group*, which is a set of animation targets
/// (bones). An animation target can belong to any number of mask groups within
/// the context of an animation graph.
/// Note - Avoid using 0 as a *mask* as that is the default mask for non masked nodes.
///
/// When the appropriate bit is set in a node's mask, neither the node nor its
/// descendants will animate any animation targets belonging to that mask group.
Expand Down
90 changes: 45 additions & 45 deletions crates/bevy_animation/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use core::{
iter, slice,
};
use graph::AnimationNodeType;
use prelude::AnimationCurveEvaluator;
use prelude::{handle_node_transition, AnimationCurveEvaluator};

use crate::{
graph::{AnimationGraphHandle, ThreadedAnimationGraphs},
Expand Down Expand Up @@ -60,10 +60,53 @@ pub mod prelude {
use crate::{
animation_curves::AnimationCurve,
graph::{AnimationGraph, AnimationGraphAssetLoader, AnimationNodeIndex},
transition::{advance_transitions, expire_completed_transitions, AnimationTransitions},
transition::{expire_completed_transitions, AnimationTransitions},
};
use alloc::sync::Arc;

/// Adds animation support to an app
#[derive(Default)]
pub struct AnimationPlugin;

impl Plugin for AnimationPlugin {
fn build(&self, app: &mut App) {
app.init_asset::<AnimationClip>()
.init_asset::<AnimationGraph>()
.init_asset_loader::<AnimationGraphAssetLoader>()
.register_asset_reflect::<AnimationClip>()
.register_asset_reflect::<AnimationGraph>()
.register_type::<AnimationPlayer>()
.register_type::<AnimationTarget>()
.register_type::<AnimationTransitions>()
.register_type::<AnimationGraphHandle>()
.register_type::<NodeIndex>()
.register_type::<ThreadedAnimationGraphs>()
.init_resource::<ThreadedAnimationGraphs>()
.add_systems(
PostUpdate,
(
graph::thread_animation_graphs.before(AssetEventSystems),
handle_node_transition,
advance_animations,
// TODO: `animate_targets` can animate anything, so
// ambiguity testing currently considers it ambiguous with
// every other system in `PostUpdate`. We may want to move
// it to its own system set after `Update` but before
// `PostUpdate`. For now, we just disable ambiguity testing
// for this system.
animate_targets
.before(bevy_render::mesh::inherit_weights)
.ambiguous_with_all(),
trigger_untargeted_animation_events,
expire_completed_transitions,
)
.chain()
.in_set(AnimationSystems)
.before(TransformSystems::Propagate),
);
}
}

/// The [UUID namespace] of animation targets (e.g. bones).
///
/// [UUID namespace]: https://en.wikipedia.org/wiki/Universally_unique_identifier#Versions_3_and_5_(namespace_name-based)
Expand Down Expand Up @@ -1223,49 +1266,6 @@ pub fn animate_targets(
});
}

/// Adds animation support to an app
#[derive(Default)]
pub struct AnimationPlugin;

impl Plugin for AnimationPlugin {
fn build(&self, app: &mut App) {
app.init_asset::<AnimationClip>()
.init_asset::<AnimationGraph>()
.init_asset_loader::<AnimationGraphAssetLoader>()
.register_asset_reflect::<AnimationClip>()
.register_asset_reflect::<AnimationGraph>()
.register_type::<AnimationPlayer>()
.register_type::<AnimationTarget>()
.register_type::<AnimationTransitions>()
.register_type::<AnimationGraphHandle>()
.register_type::<NodeIndex>()
.register_type::<ThreadedAnimationGraphs>()
.init_resource::<ThreadedAnimationGraphs>()
.add_systems(
PostUpdate,
(
graph::thread_animation_graphs.before(AssetEventSystems),
advance_transitions,
advance_animations,
// TODO: `animate_targets` can animate anything, so
// ambiguity testing currently considers it ambiguous with
// every other system in `PostUpdate`. We may want to move
// it to its own system set after `Update` but before
// `PostUpdate`. For now, we just disable ambiguity testing
// for this system.
animate_targets
.before(bevy_render::mesh::inherit_weights)
.ambiguous_with_all(),
trigger_untargeted_animation_events,
expire_completed_transitions,
)
.chain()
.in_set(AnimationSystems)
.before(TransformSystems::Propagate),
);
}
}

impl AnimationTargetId {
/// Creates a new [`AnimationTargetId`] by hashing a list of names.
///
Expand Down
Loading
Loading