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

Fixed web export of SVG and PNG #683

Merged
merged 7 commits into from
Apr 27, 2024
Merged

Fixed web export of SVG and PNG #683

merged 7 commits into from
Apr 27, 2024

Conversation

Qainguin
Copy link
Contributor

This fixes #682 by adding MIME types to the JavaScriptBridge and setting a default name if there is no file name in GlobalSettings.

@MewPurPur
Copy link
Owner

MewPurPur commented Apr 26, 2024

Thank you <3

How do you want to be mentioned in Authors.md? Just Qainguin or also your real name?

@Kiisu-Master
Copy link
Contributor

What's going on with the font import changing

@Qainguin
Copy link
Contributor Author

Thank you <3

How do you want to be mentioned in Authors.md? Just Qainguin or also your real name?

Qainguin is good, thank you for including me!

@Qainguin
Copy link
Contributor Author

What's going on with the font import changing

Whenever I edit this repository with my Mac it just gets rid of the fallbacks.

@Kiisu-Master
Copy link
Contributor

Whenever I edit this repository with my Mac it just gets rid of the fallbacks.

What Godot version do you use? Also in git you can specify the files you want to commit changes of.

@Qainguin
Copy link
Contributor Author

Whenever I edit this repository with my Mac it just gets rid of the fallbacks.

What Godot version do you use? Also in git you can specify the files you want to commit changes of.

I am using 4.2.2 stable. Also, thanks for letting me know that.

@Qainguin
Copy link
Contributor Author

Ok, I have reverted all changes to unrelated files, it should now be ready for merge.

@Kiisu-Master
Copy link
Contributor

Ok, I went to check out if this works and noticed that on my laptop Godot also changed stuff in the font import file.

src/HandlerGUI.gd Outdated Show resolved Hide resolved
@Kiisu-Master
Copy link
Contributor

Maybe to reduce code duplication:

func web_save_svg() -> void:
	var file_name := Utils.get_file_name(GlobalSettings.save_data.current_file_path)
	if file_name.is_empty():
		file_name = "export"
	JavaScriptBridge.download_buffer(
		SVG.text.to_utf8_buffer(),
		file_name + ".svg",
		"image/svg+xml"
	)


func web_save_png(img: Image) -> void:
	var file_name := Utils.get_file_name(GlobalSettings.save_data.current_file_path)
	if file_name.is_empty():
		file_name = "export"
	JavaScriptBridge.download_buffer(
		img.save_png_to_buffer(),
		file_name + ".png",
		"image/png"
	)

Note: You don't need to add the "+ '.(file extension)'", MIME does it automatically
@Qainguin
Copy link
Contributor Author

I added those changes as well as getting rid of adding the file extensions. (MIME already adds the file extension)

@MewPurPur
Copy link
Owner

MewPurPur commented Apr 26, 2024

Is this ready to be merged? If you want, you can include the font change we discussed and close #685 here too

@Qainguin
Copy link
Contributor Author

It's ready to be merged but I'm gonna add the font change, give me like 15 minutes.

@Qainguin
Copy link
Contributor Author

Qainguin commented Apr 26, 2024

It is now ready to be merged, including fixing #685

@MewPurPur MewPurPur merged commit 8b8b779 into MewPurPur:main Apr 27, 2024
2 checks passed
MewPurPur pushed a commit that referenced this pull request Jun 1, 2024
MewPurPur pushed a commit that referenced this pull request Jun 1, 2024
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.

Web build exports an unknown file
3 participants