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

Disable/Remove caching of images #2081

Closed
Sheepolution opened this issue Mar 7, 2019 · 6 comments

Comments

3 participants
@Sheepolution
Copy link

commented Mar 7, 2019

When I set an image, and then change the image in an image editor, the image does not get updated.
If I choose another image and then go back to the previous image (that I edited) it is still not changed. It seems like it is cached. I have to restart Tiled to fix this.

Please add an option to update the image. Thanks.

Steps to reproduce

  1. Create an image layer
  2. Set an image (e.g. example.png)
  3. Change example.png in an image editor.

Actual result
There is no way to have the image layer use the newest version of the image other than restarting Tiled.

Expected result
The image is automatically updated, or there is an option for it to do so.

@bjorn bjorn added the bug label Mar 7, 2019

@bjorn

This comment has been minimized.

Copy link
Owner

commented Mar 7, 2019

Actually the cache does get refreshed when the image changes on disk, but there is currently something broken about that when you change the image in Photoshop (see #44, and of course there may be other applications triggering this bug).

There is a hidden shortcut (well, it's in the manual...) to force a reload of the tilesets used by the current map (Ctrl+T), which also updates the cache.

I'm marking this issue as a bug and not a duplicate of #44, because I do think the image cache needs to remember the timestamp of the image, so that at least a changed image will be reloaded when opening / closing the tileset or when changing the image referenced by a tileset.

@bjorn

This comment has been minimized.

Copy link
Owner

commented Mar 7, 2019

There is a hidden shortcut (well, it's in the manual...) to force a reload of the tilesets used by the current map (Ctrl+T), which also updates the cache.

Sorry, of course this workaround doesn't help you at all when using image layers... Also the automatic reload on change was never extended to image layers (#912 tries to address this, but the patch duplicates too much code from the TilesetManager).

@X-Ray-Jin

This comment has been minimized.

Copy link

commented Mar 26, 2019

I was just about to add an issue on this and found this. Very nice that there is a hotkey to fix it. However I also think marking as bug is fair as I think it should be updated by default. Interestingly too once you used CTRL+T it automatically does update if you change again during that session.

BTW bug also seems to apply for the size display in the properties.
Another thing which I am not sure on how to solve is if you change an image size and replace it outside of tiled and dont reselect it in tiled the size wont be updated. thats kind of annoying to always open the set, reset the image and save manually despite the path not changing. If it is somehow possible it would be a nice feature.

@bjorn

This comment has been minimized.

Copy link
Owner

commented May 15, 2019

I pushed a fix for the caching of images, such that after changing an image and then doing anything in Tiled that should reload the image (like changing the image source of an image layer), the image will get reloaded. This is based on remembering and checking the modification time of the image.

This does not make image layer images reload immediately though, like suggested in the original report. That's a missing feature covered by issue #825.

@bjorn bjorn closed this in 5c1a59a May 15, 2019

@bjorn bjorn added this to Recently Completed in Roadmap via automation May 15, 2019

@bjorn

This comment has been minimized.

Copy link
Owner

commented May 15, 2019

BTW bug also seems to apply for the size display in the properties.

@X-Ray-Jin Which size display did you mean?

Another thing which I am not sure on how to solve is if you change an image size and replace it outside of tiled and dont reselect it in tiled the size wont be updated. thats kind of annoying to always open the set, reset the image and save manually despite the path not changing. If it is somehow possible it would be a nice feature.

Please let me know if this issue remains after this fix, cause I'm not entirely sure if it's related to the image cache. I personally don't understand why resetting the image would be needed here, rather than just opening and re-saving the file.

@X-Ray-Jin

This comment has been minimized.

Copy link

commented May 15, 2019

@bjorn
I was referring to the properties view where the width and height of the image is displayed. It would also only update after restart. I guess that should be fixed with this fix.

For the second part I am kind of sure that it will not include that. Maybe you didnt understand what I was talking about. It would be nice if one could skip the step of loading the set and saving manually after an image changed. In bigger projects or when several people are involved it might not always be obvious where an image is used. But as I said I guess that is not so easy and requires some kind auto checking, probably in a project like structure. I know you planned something like projects so maybe it is a thing to consider when it is time :) And as it is not too much work to manually do it and also doesnt occur too often I guess it is fine for now.
I will check the other stuff when a new version is out.
Thanks so far.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.