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

fix certain logos not showing after export #6

Merged
merged 1 commit into from
May 7, 2022

Conversation

nickgirga
Copy link

I noticed there was a warning in the editor when I was using the twist splash screen:
godot-awesome-splash_warning
What it was suggesting was correct. It did not work on export (on v3.4.4.stable.official [419e713a2]).

I tested on Linux:
godot-awesome-splash_bug_0
I tested on Android:
godot-awesome-splash_bug_1
Neither of them showed the Godot icon because the image was not being loaded after the project was exported.

When looking for solutions, I ran across this on the internet: https://godotengine.org/qa/50031/image-fails-export-with-warning-loading-resource-image-export

This seemed to be the same problem I was experiencing. So I rewrote AweSplashScreen.load_texture(String) a bit. Instead of using image.load(path), I loaded path as a resource in a variable called stream_texture using load(path). Then, I set image to the image data from stream_texture.get_data(). This pretty much achieves the same thing, but without the warning. It also appears to work on export.

I tested on Linux:
godot-awesome-splash_fixed_0
I tested on Android:
godot-awesome-splash_fixed_1
Both show the Godot icon now.

@duongvituan
Copy link
Owner

@nickgirga
Thanks for your help :)

@duongvituan duongvituan merged commit 0225445 into duongvituan:master May 7, 2022
@nickgirga
Copy link
Author

Of course!

If you're interested: I looked a bit more into why image.load(path) wasn't optimal for our use case and it seems that Image.load(String) loads an image directly from the image file itself (which won't be exported with the project because Godot will convert it to a stex to pack in the PCK). This may be desirable behavior, but for the vast majority of cases (and what I assume is the case here, considering we don't really need to expose the Godot logo as an image file to users and probably shouldn't), you want to use load(String) because it will actually look for that file as a stex in the exported assets after you export it instead of continuing to search for an image file that no longer exists in a standard image format. The Image.load(String) method confuses enough people and is so seldom used for its intended purpose that Juan Linietsky was even considering removing it to alleviate confusion back in 2018 (but never did because some people do legitimately use it for its intended purpose). So, people seem to run into the issue a decent amount and I can definitely see why.

@nickgirga nickgirga deleted the export-fix branch May 7, 2022 12:18
@duongvituan
Copy link
Owner

Thanks for your sharing and i'm glad for your help :).

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

Successfully merging this pull request may close these issues.

2 participants