Skip to content

Rename AnimationGraph #16280

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 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
18 changes: 9 additions & 9 deletions crates/bevy_animation/src/animatable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use bevy_math::*;
use bevy_reflect::Reflect;
use bevy_transform::prelude::Transform;

/// An individual input for [`Animatable::blend`].
/// An individual input for [`Blendable::blend`].
pub struct BlendInput<T> {
/// The individual item's weight. This may not be bound to the range `[0.0, 1.0]`.
pub weight: f32,
Expand All @@ -17,7 +17,7 @@ pub struct BlendInput<T> {
}

/// An animatable value type.
pub trait Animatable: Reflect + Sized + Send + Sync + 'static {
pub trait Blendable: Reflect + Sized + Send + Sync + 'static {
/// Interpolates between `a` and `b` with a interpolation factor of `time`.
///
/// The `time` parameter here may not be clamped to the range `[0.0, 1.0]`.
Expand All @@ -31,7 +31,7 @@ pub trait Animatable: Reflect + Sized + Send + Sync + 'static {

macro_rules! impl_float_animatable {
($ty: ty, $base: ty) => {
impl Animatable for $ty {
impl Blendable for $ty {
#[inline]
fn interpolate(a: &Self, b: &Self, t: f32) -> Self {
let t = <$base>::from(t);
Expand All @@ -56,7 +56,7 @@ macro_rules! impl_float_animatable {

macro_rules! impl_color_animatable {
($ty: ident) => {
impl Animatable for $ty {
impl Blendable for $ty {
#[inline]
fn interpolate(a: &Self, b: &Self, t: f32) -> Self {
let value = *a * (1. - t) + *b * t;
Expand Down Expand Up @@ -96,7 +96,7 @@ impl_color_animatable!(Srgba);
impl_color_animatable!(Xyza);

// Vec3 is special cased to use Vec3A internally for blending
impl Animatable for Vec3 {
impl Blendable for Vec3 {
#[inline]
fn interpolate(a: &Self, b: &Self, t: f32) -> Self {
(*a) * (1.0 - t) + (*b) * t
Expand All @@ -116,7 +116,7 @@ impl Animatable for Vec3 {
}
}

impl Animatable for bool {
impl Blendable for bool {
#[inline]
fn interpolate(a: &Self, b: &Self, t: f32) -> Self {
util::step_unclamped(*a, *b, t)
Expand All @@ -131,7 +131,7 @@ impl Animatable for bool {
}
}

impl Animatable for Transform {
impl Blendable for Transform {
fn interpolate(a: &Self, b: &Self, t: f32) -> Self {
Self {
translation: Vec3::interpolate(&a.translation, &b.translation, t),
Expand Down Expand Up @@ -170,7 +170,7 @@ impl Animatable for Transform {
}
}

impl Animatable for Quat {
impl Blendable for Quat {
/// Performs a slerp to smoothly interpolate between quaternions.
#[inline]
fn interpolate(a: &Self, b: &Self, t: f32) -> Self {
Expand Down Expand Up @@ -204,7 +204,7 @@ impl Animatable for Quat {
/// The derivatives are linearly scaled by `duration`.
pub fn interpolate_with_cubic_bezier<T>(p0: &T, d0: &T, d3: &T, p3: &T, t: f32, duration: f32) -> T
where
T: Animatable + Clone,
T: Blendable + Clone,
{
// We're given two endpoints, along with the derivatives at those endpoints,
// and have to evaluate the cubic Bézier curve at time t using only
Expand Down
Loading