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

Reloading resources from "Debug" menu #2928

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

Vankata453
Copy link
Member

@Vankata453 Vankata453 commented Apr 28, 2024

The new "Reload Resources" option in the "Debug" menu allows for reloading all fonts, textures, sprites and tilesets.

Additionally:

  • Removes the name field for sprites. I honestly didn't know it existed before, and don't know what the point of it is, considering it's not referenced anywhere in the code, other than in logs, where a filename can be used instead.

Closes #2901.

Copy link
Member

@Frostwithasideofsalt Frostwithasideofsalt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank the gato gods 🙏🏼

@mrkubax10 mrkubax10 added type:feature category:code status:needs-review Work needs to be reviewed by other people labels Apr 30, 2024
src/supertux/tile_set.cpp Outdated Show resolved Hide resolved
@tylerandari13
Copy link
Contributor

My train of thought to test this was to load the game, and remove an image. If it works then it should display a missing texture, because the images are no longer there, which resulted in this:

[WARNING] /home/tylerandari12/STcompilation/supertux/src/video/texture_manager.cpp:84 Image '/res/industrial/gfx-enemy/duker/duker-body.png' doesn't exist. Attempting to load ".deprecated" version.
[WARNING] /home/tylerandari12/STcompilation/supertux/src/video/texture_manager.cpp:439 Couldn't load texture '/res/industrial/gfx-enemy/duker/duker-body.png' (now using dummy texture): Couldn't open '/res/industrial/gfx-enemy/duker/duker-body.deprecated.png': not found
[WARNING] /home/tylerandari12/STcompilation/supertux/src/video/texture_manager.cpp:84 Image '/res/industrial/gfx-enemy/duker/duker-end.png' doesn't exist. Attempting to load ".deprecated" version.
[WARNING] /home/tylerandari12/STcompilation/supertux/src/video/texture_manager.cpp:439 Couldn't load texture '/res/industrial/gfx-enemy/duker/duker-end.png' (now using dummy texture): Couldn't open '/res/industrial/gfx-enemy/duker/duker-end.deprecated.png': not found
[WARNING] /home/tylerandari12/STcompilation/supertux/src/video/texture_manager.cpp:84 Image '/res/industrial/gfx-enemy/duker/duker-head.png' doesn't exist. Attempting to load ".deprecated" version.
[WARNING] /home/tylerandari12/STcompilation/supertux/src/video/texture_manager.cpp:439 Couldn't load texture '/res/industrial/gfx-enemy/duker/duker-head.png' (now using dummy texture): Couldn't open '/res/industrial/gfx-enemy/duker/duker-head.deprecated.png': not found
[WARNING] /home/tylerandari12/STcompilation/supertux/src/video/texture_manager.cpp:84 Image '/res/industrial/gfx-enemy/duker/duker-head.png' doesn't exist. Attempting to load ".deprecated" version.
[WARNING] /home/tylerandari12/STcompilation/supertux/src/video/texture_manager.cpp:376 Couldn't load texture '/res/industrial/gfx-enemy/duker/duker-head.png' (now using dummy texture): Couldn't open '/res/industrial/gfx-enemy/duker/duker-head.deprecated.png': not found
[FATAL] /home/tylerandari12/STcompilation/supertux/src/supertux/main.cpp:745 Unexpected exception: Cannot load image.

(The game closed after this was printed.)

duker-body.png, duker-end.png, and duker-head.png are the three images I removed so i could test. duker-head.png was the only image on a scripted object. Im not sure why the other two also tried to load.

I found another thing, which Im not sure if its related directly to this PR, but I might as well mention it. When this happened I thought "Well that sucks, but if I open the game again I should be able to add the images back in after opening and hit reload resources to make them appear.", but when I opened the level again, the scripted object which had the image was not there at all. I closed the game, added the images back in, and reopened the level, and the scripted object was back again.

@Vankata453
Copy link
Member Author

Vankata453 commented May 16, 2024

duker-body.png, duker-end.png, and duker-head.png are the three images I removed so i could test. duker-head.png was the only image on a scripted object. Im not sure why the other two also tried to load.

It reloads everything loaded since the start of the game.

I found another thing, which Im not sure if its related directly to this PR, but I might as well mention it. When this happened I thought "Well that sucks, but if I open the game again I should be able to add the images back in after opening and hit reload resources to make them appear.", but when I opened the level again, the scripted object which had the image was not there at all. I closed the game, added the images back in, and reopened the level, and the scripted object was back again.

Doesn't matter where the script object is, the resource is loaded into the game separately in its own manager.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:code status:needs-review Work needs to be reviewed by other people type:feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add "refresh resources" button in dev mode
5 participants