Merge pull request #49102 from ANamelessGhoul/master

Fix AnimatedTexture inconsistency when setting frame
This commit is contained in:
Rémi Verschelde 2023-02-17 00:32:55 +01:00
commit b0dd9d6942
No known key found for this signature in database
GPG Key ID: C3336907360768E1
2 changed files with 2 additions and 1 deletions

View File

@ -46,7 +46,7 @@
</methods> </methods>
<members> <members>
<member name="current_frame" type="int" setter="set_current_frame" getter="get_current_frame"> <member name="current_frame" type="int" setter="set_current_frame" getter="get_current_frame">
Sets the currently visible frame of the texture. Sets the currently visible frame of the texture. Setting this frame while playing resets the current frame time, so the newly selected frame plays for its whole configured frame duration.
</member> </member>
<member name="frames" type="int" setter="set_frames" getter="get_frames" default="1"> <member name="frames" type="int" setter="set_frames" getter="get_frames" default="1">
Number of frames to use in the animation. While you can create the frames independently with [method set_frame_texture], you need to set this value for the animation to take new frames into account. The maximum number of frames is [constant MAX_FRAMES]. Number of frames to use in the animation. While you can create the frames independently with [method set_frame_texture], you need to set this value for the animation to take new frames into account. The maximum number of frames is [constant MAX_FRAMES].

View File

@ -2704,6 +2704,7 @@ void AnimatedTexture::set_current_frame(int p_frame) {
RWLockWrite r(rw_lock); RWLockWrite r(rw_lock);
current_frame = p_frame; current_frame = p_frame;
time = 0;
} }
int AnimatedTexture::get_current_frame() const { int AnimatedTexture::get_current_frame() const {