1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-01-31 07:29:49 +00:00

Add "include blended images" in SaveSpriteHTML5.tscn, and use save_project() for both desktop and web platforms

This commit is contained in:
Emmanouil Papadeas 2023-12-18 20:55:40 +02:00
parent 89b17177a1
commit 10ca31b916
3 changed files with 31 additions and 25 deletions

View file

@ -281,7 +281,7 @@ func _on_OpenSprite_files_selected(paths: PackedStringArray) -> void:
func show_save_dialog(project := Global.current_project) -> void:
Global.dialog_open(true)
if OS.get_name() == "Web":
var save_filename := save_sprite_html5.get_node("FileNameContainer/FileNameLineEdit")
var save_filename := save_sprite_html5.get_node("%FileNameLineEdit")
save_sprite_html5.popup_centered()
save_filename.text = project.name
else:
@ -294,12 +294,19 @@ func _on_SaveSprite_file_selected(path: String) -> void:
func save_project(path: String) -> void:
var include_blended: bool = (
Global.save_sprites_dialog.get_vbox().get_node("IncludeBlended").button_pressed
)
var project_to_save := Global.current_project
if is_quitting_on_save:
project_to_save = changed_projects_on_quit[0]
var include_blended := false
if OS.get_name() == "Web":
var file_name: String = save_sprite_html5.get_node("%FileNameLineEdit").text
file_name += ".pxo"
path = "user://".path_join(file_name)
include_blended = save_sprite_html5.get_node("%IncludeBlended").button_pressed
else:
include_blended = (
Global.save_sprites_dialog.get_vbox().get_node("IncludeBlended").button_pressed
)
var success := OpenSave.save_pxo_file(path, false, include_blended, project_to_save)
if success:
Global.open_sprites_dialog.current_dir = path.get_base_dir()
@ -309,19 +316,6 @@ func save_project(path: String) -> void:
_save_on_quit_confirmation()
func _on_SaveSpriteHTML5_confirmed() -> void:
var file_name: String = save_sprite_html5.get_node("FileNameContainer/FileNameLineEdit").text
file_name += ".pxo"
var path := "user://".path_join(file_name)
var project_to_save := Global.current_project
if is_quitting_on_save:
project_to_save = changed_projects_on_quit[0]
OpenSave.save_pxo_file(path, false, false, project_to_save)
if is_quitting_on_save:
changed_projects_on_quit.pop_front()
_save_on_quit_confirmation()
func _on_open_sprite_visibility_changed() -> void:
if !opensprite_file_selected:
_can_draw_true()

View file

@ -120,7 +120,7 @@ visible = false
[connection signal="visibility_changed" from="Dialogs/OpenSprite" to="." method="_on_open_sprite_visibility_changed"]
[connection signal="file_selected" from="Dialogs/SaveSprite" to="." method="_on_SaveSprite_file_selected"]
[connection signal="visibility_changed" from="Dialogs/SaveSprite" to="." method="_can_draw_true"]
[connection signal="confirmed" from="Dialogs/SaveSpriteHTML5" to="." method="_on_SaveSpriteHTML5_confirmed"]
[connection signal="confirmed" from="Dialogs/SaveSpriteHTML5" to="." method="save_project" binds= [""]]
[connection signal="visibility_changed" from="Dialogs/SaveSpriteHTML5" to="." method="_can_draw_true"]
[connection signal="visibility_changed" from="Dialogs/ExportDialog" to="." method="_can_draw_true"]
[connection signal="visibility_changed" from="Dialogs/UnsavedCanvasDialog" to="." method="_can_draw_true"]

View file

@ -1,22 +1,34 @@
[gd_scene format=3 uid="uid://cltlo2whtiejd"]
[node name="SaveSpriteHTML5" type="ConfirmationDialog"]
size = Vector2i(205, 111)
ok_button_text = "Save"
[node name="FileNameContainer" type="HBoxContainer" parent="."]
anchors_preset = 10
anchor_right = 1.0
[node name="VBoxContainer" type="VBoxContainer" parent="."]
offset_left = 8.0
offset_top = 8.0
offset_right = -8.0
offset_bottom = 34.0
offset_right = 197.0
offset_bottom = 66.0
[node name="FileNameLabel" type="Label" parent="FileNameContainer"]
[node name="FileNameContainer" type="HBoxContainer" parent="VBoxContainer"]
layout_mode = 2
[node name="FileNameLabel" type="Label" parent="VBoxContainer/FileNameContainer"]
layout_mode = 2
text = "File Name:"
[node name="FileNameLineEdit" type="LineEdit" parent="FileNameContainer"]
[node name="FileNameLineEdit" type="LineEdit" parent="VBoxContainer/FileNameContainer"]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 4
text = "untitled"
[node name="IncludeBlended" type="CheckBox" parent="VBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
tooltip_text = "If enabled, the final blended images are also being stored in the pxo, for each frame.
This makes the pxo file larger and is useful for importing by third-party software
or CLI exporting. Loading pxo files in Pixelorama does not need this option to be enabled."
mouse_default_cursor_shape = 2
text = "Include blended images"