Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AnimatedTextures do not pause when tree is paused #44625

Open
chucklepie opened this issue Dec 23, 2020 · 5 comments
Open

AnimatedTextures do not pause when tree is paused #44625

chucklepie opened this issue Dec 23, 2020 · 5 comments

Comments

@chucklepie
Copy link

Godot version:
3.2.3

OS/device including version:
Linux mint 19.1

Issue description:
Animated Textures (tres) do not pause when game is paused via get_tree().paused=true

Observe the gif below, when the first dialog appears (this is set to process so does not pause) the tilemap and game pauses ok. Now, wait for the next screen and when the second dialog appears you will notice the blue graphics (animated texture in a tilemap) are still spinning.

Peek 2020-12-23 18-08_animtexbug

It is irrelevant whether the tres is part of a tilemap or a texture to a sprite, the same thing happens. Note, particles pause just fine so it is not linked to #41582 that I raised a while ago regarding particles/tres not stopping during debug. This is a more serious bug as it affects gameplay.

Steps to reproduce:

  1. create an animated tres file
  2. add it to a sprite
  3. pause the game
@Calinou
Copy link
Member

Calinou commented Dec 23, 2020

I'm not sure if this can be fixed since AnimatedTexture is a resource, not a node that obeys a specific pause mode. After all, you may want specific AnimatedTextures to still be animated if the game is paused.

@chucklepie
Copy link
Author

chucklepie commented Dec 23, 2020

If you have a sprite in animation or an animated sprite and pause then they pause, but if your sprite is an animated texture then it doesn't. That doesn't make any sense. Also, animated textures are literally the only means of supporting tilemap animation so because of this limitation, anyone with a tilemap cannot have a proper pause game.

I get what you're saying, but technical points aside, when you use paused=true you want the game to stop and freeze, ignoring animated textures makes this feature redundant and having a pause screen near impossible...

I guess more of a direct question, why can't animated textures be updated as part of some base level process code, is it because opengl supports these kinds of textures on the gpu?

@Calinou Calinou changed the title animated texture files do not pause when tree is paused AnimatedTextures do not pause when tree is paused Jan 25, 2022
@Atermnus
Copy link

Have found a quick fix for this.

var alltiles =tile_set.get_tiles_ids()

for i in alltiles:
tile_set.tile_get_texture(i).pause = val

Do not know it's performance, works well on a tileset with around 200 tiles, but haven't tried it on a low-spec machine.

@joemicmc
Copy link

For Godot 4.0 you can do something like this to pause animations for each tile set.

var tile_set_atlas_source = tile_map.tile_set.get_source(0)
for i in range(0, tile_set_atlas_source.get_tiles_count()):
    var atlas_coords = tile_set_atlas_source.get_tile_id(i)
    tile_set_atlas_source.set_tile_animation_frame_duration(atlas_coords, 0, INF)

Would have to restore the frame duration from somewhere though... I have read through the documentation but doesn't appear to be an easier way to do this! https://docs.godotengine.org/en/latest/classes/class_tilesetatlassource.html

@berarma
Copy link
Contributor

berarma commented Apr 26, 2024

In Godot 4 it's a lot harder to implement our own pause function unless there's some other workaround I don't know about.

I think process_mode should be in control of the animations. This would give us a lot of control whether we want the animations to stop or not.

This issue is marked as a discussion but there hasn't been any comment against it since it was created. It isn't exactly a regression but something that was reasonably easy to do is now harder. Pausing a game is a very common action and pausing means stopping everything.

What can be done to progress in this issue? Would a PR help?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants