fix: start AnimatedTextures unpaused to fix race condition
AnimatedTextures were created paused, relying on the gui_focus_changed handler to unpause them. But get_boxart is async — by the time the AnimatedTexture is set on the TextureRect, focus may already be on the card, so gui_focus_changed never fires for it. Animation stays paused. Start unpaused instead. The focus handler still pauses unfocused cards and unpauses focused ones, so only the active card animates. Bump to v0.1.17
This commit is contained in:
parent
157593e853
commit
92851f4e1e
1 changed files with 2 additions and 4 deletions
|
|
@ -449,9 +449,8 @@ func _fetch_image(url: String, cache_flags: int) -> Texture2D:
|
||||||
|
|
||||||
|
|
||||||
## Downloads a GIF and converts it to a Godot texture. When animated GIFs
|
## Downloads a GIF and converts it to a Godot texture. When animated GIFs
|
||||||
## are enabled, extracts all frames and returns an AnimatedTexture (paused
|
## are enabled, extracts all frames and returns an AnimatedTexture. Otherwise
|
||||||
## by default — the focus handler unpauses it). Otherwise extracts only
|
## extracts only the first frame and returns a static ImageTexture.
|
||||||
## the first frame and returns a static ImageTexture.
|
|
||||||
## Results are cached in _animated_texture_cache keyed by URL.
|
## Results are cached in _animated_texture_cache keyed by URL.
|
||||||
func _fetch_gif_as_texture(url: String, cache_flags: int) -> Texture2D:
|
func _fetch_gif_as_texture(url: String, cache_flags: int) -> Texture2D:
|
||||||
# Return cached result if available.
|
# Return cached result if available.
|
||||||
|
|
@ -569,7 +568,6 @@ func _extract_gif_frames(ffmpeg_bin: String, gif_path: String, frames_dir: Strin
|
||||||
func _assemble_animated_texture(frame_files: PackedStringArray, frames_dir: String, delays: Array, url: String) -> AnimatedTexture:
|
func _assemble_animated_texture(frame_files: PackedStringArray, frames_dir: String, delays: Array, url: String) -> AnimatedTexture:
|
||||||
var anim_tex := AnimatedTexture.new()
|
var anim_tex := AnimatedTexture.new()
|
||||||
anim_tex.frames_count = frame_files.size()
|
anim_tex.frames_count = frame_files.size()
|
||||||
anim_tex.pause = true # Start paused — focus handler unpauses.
|
|
||||||
|
|
||||||
for i in frame_files.size():
|
for i in frame_files.size():
|
||||||
var frame_path := frames_dir + "/" + frame_files[i]
|
var frame_path := frames_dir + "/" + frame_files[i]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue