-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
[Merged by Bors] - Rename play
to start
and add new play
method that won't overwrite the existing animation if it's already playing
#6350
Conversation
249734a
to
f525419
Compare
Bikeshed: can we call this method start_playing? |
Here's my bikeshed: maybe call this |
@MrGVSV I really like that, @alice-i-cecile what do you think? |
Yep, I'm on board with that change. |
f525419
to
005508e
Compare
@alice-i-cecile ok, done! |
@@ -115,14 +115,22 @@ impl Default for AnimationPlayer { | |||
|
|||
impl AnimationPlayer { | |||
/// Start playing an animation, resetting state of the player | |||
pub fn play(&mut self, handle: Handle<AnimationClip>) -> &mut Self { | |||
pub fn start(&mut self, handle: Handle<AnimationClip>) -> &mut Self { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this change affect other code, such as any examples?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested the examples and they work the same as before. AFAICT none of them call play
on an animation that's already playing.
005508e
to
e0274dc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Except for the small thing with the docs, it looks good to me.
crates/bevy_animation/src/lib.rs
Outdated
*self = Self { | ||
animation_clip: handle, | ||
..Default::default() | ||
}; | ||
self | ||
} | ||
|
||
/// Like `start`, but does nothing if the requested animation is already playing. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't start
be wrapped in a square brackets to link the method?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could be wrong but it might even need a path to the method (i.e. [`start`](Self::start)
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Once you add that doc link, update the PR title and add a migration guide, this LGTM.
e0274dc
to
2d63bf4
Compare
play_unless_already_playing
method to AnimationPlayerplay
to start
and add new play
method that won't overwrite the existing animation if it's already playing
@alice-i-cecile done! |
2d63bf4
to
4205190
Compare
crates/bevy_animation/src/lib.rs
Outdated
*self = Self { | ||
animation_clip: handle, | ||
..Default::default() | ||
}; | ||
self | ||
} | ||
|
||
/// Like [`start`](Self::start), but does nothing if the requested animation is already playing. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this doc is not self-explaining, could you reformulate?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think of the new doc?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Much better IMO.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good for me, thanks 👍
4205190
to
924544e
Compare
924544e
to
9549e46
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the new doc :)
bors r+ |
…te the existing animation if it's already playing (#6350) # Objective - You usually want to say that a given animation *should* be playing, doing nothing if it's already playing. ## Solution - Rename play to start and add new play method that won't overwrite the existing animation if it's already playing #6350 --- ## Changelog ### Changed `AnimationPlayer::play` will now not restart the animation if it's already playing ### Added An `AnimationPlayer ::start` method, which has the old behavior of `play` ## Migration guide - If you were using `play` to restart an animation that was already playing, that functionality has been moved to `start`. Now, `play` won't have any effect if the requested animation is already playing.
play
to start
and add new play
method that won't overwrite the existing animation if it's already playingplay
to start
and add new play
method that won't overwrite the existing animation if it's already playing
…te the existing animation if it's already playing (bevyengine#6350) # Objective - You usually want to say that a given animation *should* be playing, doing nothing if it's already playing. ## Solution - Rename play to start and add new play method that won't overwrite the existing animation if it's already playing bevyengine#6350 --- ## Changelog ### Changed `AnimationPlayer::play` will now not restart the animation if it's already playing ### Added An `AnimationPlayer ::start` method, which has the old behavior of `play` ## Migration guide - If you were using `play` to restart an animation that was already playing, that functionality has been moved to `start`. Now, `play` won't have any effect if the requested animation is already playing.
…te the existing animation if it's already playing (bevyengine#6350) # Objective - You usually want to say that a given animation *should* be playing, doing nothing if it's already playing. ## Solution - Rename play to start and add new play method that won't overwrite the existing animation if it's already playing bevyengine#6350 --- ## Changelog ### Changed `AnimationPlayer::play` will now not restart the animation if it's already playing ### Added An `AnimationPlayer ::start` method, which has the old behavior of `play` ## Migration guide - If you were using `play` to restart an animation that was already playing, that functionality has been moved to `start`. Now, `play` won't have any effect if the requested animation is already playing.
…te the existing animation if it's already playing (bevyengine#6350) # Objective - You usually want to say that a given animation *should* be playing, doing nothing if it's already playing. ## Solution - Rename play to start and add new play method that won't overwrite the existing animation if it's already playing bevyengine#6350 --- ## Changelog ### Changed `AnimationPlayer::play` will now not restart the animation if it's already playing ### Added An `AnimationPlayer ::start` method, which has the old behavior of `play` ## Migration guide - If you were using `play` to restart an animation that was already playing, that functionality has been moved to `start`. Now, `play` won't have any effect if the requested animation is already playing.
Objective
Solution
play
tostart
and add newplay
method that won't overwrite the existing animation if it's already playing #6350Changelog
Changed
AnimationPlayer::play
will now not restart the animation if it's already playingAdded
An
AnimationPlayer ::start
method, which has the old behavior ofplay
Migration guide
play
to restart an animation that was already playing, that functionality has been moved tostart
. Now,play
won't have any effect if the requested animation is already playing.