From fa198c482eb0fd64442c60afd7cdfdc9aca0ae8f Mon Sep 17 00:00:00 2001 From: Silc Renew Date: Sun, 29 Jan 2023 00:24:52 +0900 Subject: Fix AnimatedSprite play() don't redraw immediately --- scene/2d/animated_sprite_2d.cpp | 3 ++- scene/3d/sprite_3d.cpp | 3 ++- scene/animation/animation_player.h | 2 +- scene/animation/animation_tree.h | 6 ++++-- 4 files changed, 9 insertions(+), 5 deletions(-) (limited to 'scene') diff --git a/scene/2d/animated_sprite_2d.cpp b/scene/2d/animated_sprite_2d.cpp index ccf9696d82..8f7006caca 100644 --- a/scene/2d/animated_sprite_2d.cpp +++ b/scene/2d/animated_sprite_2d.cpp @@ -475,8 +475,9 @@ void AnimatedSprite2D::play(const StringName &p_name, float p_custom_scale, bool } } - notify_property_list_changed(); set_process_internal(true); + notify_property_list_changed(); + queue_redraw(); } void AnimatedSprite2D::play_backwards(const StringName &p_name) { diff --git a/scene/3d/sprite_3d.cpp b/scene/3d/sprite_3d.cpp index 635c566ef8..9712df0936 100644 --- a/scene/3d/sprite_3d.cpp +++ b/scene/3d/sprite_3d.cpp @@ -1182,8 +1182,9 @@ void AnimatedSprite3D::play(const StringName &p_name, float p_custom_scale, bool } } - notify_property_list_changed(); set_process_internal(true); + notify_property_list_changed(); + _queue_redraw(); } void AnimatedSprite3D::play_backwards(const StringName &p_name) { diff --git a/scene/animation/animation_player.h b/scene/animation/animation_player.h index 25de278f97..b0975fbead 100644 --- a/scene/animation/animation_player.h +++ b/scene/animation/animation_player.h @@ -149,7 +149,7 @@ private: HashMap bezier_anim; struct PlayingAudioStreamInfo { - int64_t index = -1; + AudioStreamPlaybackPolyphonic::ID index = -1; double start = 0.0; double len = 0.0; }; diff --git a/scene/animation/animation_tree.h b/scene/animation/animation_tree.h index 394a3a2237..c54493828f 100644 --- a/scene/animation/animation_tree.h +++ b/scene/animation/animation_tree.h @@ -253,12 +253,14 @@ private: } }; + // Audio stream information for each audio stream placed on the track. struct PlayingAudioStreamInfo { - int64_t index = -1; + AudioStreamPlaybackPolyphonic::ID index = -1; // ID retrieved from AudioStreamPlaybackPolyphonic. double start = 0.0; double len = 0.0; }; + // Audio track information for mixng and ending. struct PlayingAudioTrackInfo { HashMap stream_info; double length = 0.0; @@ -272,7 +274,7 @@ private: struct TrackCacheAudio : public TrackCache { Ref audio_stream; Ref audio_stream_playback; - HashMap playing_streams; // Animation resource RID & AudioTrack key index: PlayingAudioStreamInfo. + HashMap playing_streams; // Key is Animation resource ObjectID. TrackCacheAudio() { type = Animation::TYPE_AUDIO; -- cgit v1.2.3