From 1ba05b4b3ac2014894c0de6d6c70253451b88a5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tecelli=20Ak=C4=B1ntu=C4=9F?= Date: Wed, 26 May 2021 12:49:53 +0300 Subject: [PATCH] Fix AnimatedTexture inconsistency when setting frame --- doc/classes/AnimatedTexture.xml | 2 +- scene/resources/texture.cpp | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/classes/AnimatedTexture.xml b/doc/classes/AnimatedTexture.xml index 57a7f869014..454b9c1c322 100644 --- a/doc/classes/AnimatedTexture.xml +++ b/doc/classes/AnimatedTexture.xml @@ -46,7 +46,7 @@ - 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. 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]. diff --git a/scene/resources/texture.cpp b/scene/resources/texture.cpp index 7e3156d2fff..085becb033e 100644 --- a/scene/resources/texture.cpp +++ b/scene/resources/texture.cpp @@ -2704,6 +2704,7 @@ void AnimatedTexture::set_current_frame(int p_frame) { RWLockWrite r(rw_lock); current_frame = p_frame; + time = 0; } int AnimatedTexture::get_current_frame() const {