summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2023-02-17 00:32:55 +0100
committerRémi Verschelde <rverschelde@gmail.com>2023-02-17 00:32:55 +0100
commitb0dd9d69423124a11fa1e3740518bda12b66faa3 (patch)
treedaacd8afcbbaf68b89ded29101d806a1cf416553
parenteb1af0d95fc80096d6679e722c2b470792d89fb3 (diff)
parent1ba05b4b3ac2014894c0de6d6c70253451b88a5f (diff)
Merge pull request #49102 from ANamelessGhoul/master
Fix AnimatedTexture inconsistency when setting frame
-rw-r--r--doc/classes/AnimatedTexture.xml2
-rw-r--r--scene/resources/texture.cpp1
2 files changed, 2 insertions, 1 deletions
diff --git a/doc/classes/AnimatedTexture.xml b/doc/classes/AnimatedTexture.xml
index 57a7f86901..454b9c1c32 100644
--- a/doc/classes/AnimatedTexture.xml
+++ b/doc/classes/AnimatedTexture.xml
@@ -46,7 +46,7 @@
</methods>
<members>
<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 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].
diff --git a/scene/resources/texture.cpp b/scene/resources/texture.cpp
index 7e3156d2ff..085becb033 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 {