From d31509035f6d7f80cf399d72bdbf8c06f14caa51 Mon Sep 17 00:00:00 2001
From: OverloadedOrama <35376950+OverloadedOrama@users.noreply.github.com>
Date: Sat, 11 Jul 2020 02:09:17 +0300
Subject: [PATCH] Add a "Use ZSTD Compression" checkbox on Save Sprite dialog
---
CHANGELOG.md | 9 +++++++++
Translations/Translations.pot | 3 +++
src/Autoload/OpenSave.gd | 15 ++++++++++-----
src/Main.gd | 12 ++++++++++--
4 files changed, 32 insertions(+), 7 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 3e80d961e..cd4718918 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -19,6 +19,7 @@ Darshan Phaldesai (luiq54), Igor Santarek (jegor377), rob-a-bolton, Kinwailo
- You can now preview how the frames of the spritesheet you are importing will look.
- You can now import image files as layers. Their size will be cropped to the project's size.
- You can import image files as brushes, patterns and palettes.
+- Selection region and size are now being shown when making a selection on the top, next to the position label. ([#281](https://github.com/Orama-Interactive/Pixelorama/pull/281))
### Changed
- Drawing is no longer limited by the canvas boundaries. This means that, if you have a brush largen than 1px, you can draw on the edges of the canvas. All pixels that are being drawn outside of the canvas will still have no effect.
@@ -27,13 +28,19 @@ Darshan Phaldesai (luiq54), Igor Santarek (jegor377), rob-a-bolton, Kinwailo
- Imported frames are now being cropped to the project's size. It is no longer possible to have multiple sizes for each frame at all in the same project.
- Pixel perfect is no longer enabled when the brush size is bigger than 1px.
- The .pxo file structure has been changed. It's now consisted of a JSON-structured metadata part, where all the data that can be stored as text are, and a binary part, that contain all the actual image data for each cel and project brush.
+- You can now choose if you want your .pxo to use ZSTD compression or not.
+- To make a straight line, you now have to hold Shift while dragging (moving and pressing) your mouse. Releasing your mouse button makes the line. ([#281](https://github.com/Orama-Interactive/Pixelorama/pull/281))
- When making a straight line, a preview of how the line's pixels will look is now being shown. ([#260](https://github.com/Orama-Interactive/Pixelorama/pull/260))
+- Drawing lines with Ctrl are now constrained at 1:1 and 1:2 ([#201](https://github.com/Orama-Interactive/Pixelorama/issues/201))
+- Pixelorama now remembers the selected colors, tools and their options when it's closed and re-opened. ([#281](https://github.com/Orama-Interactive/Pixelorama/pull/281))
+- Drawing brushes with mirror also mirrors the images of the brushes themselves. ([#281](https://github.com/Orama-Interactive/Pixelorama/pull/281))
- When making a new palette or importing one and its name already exists, Pixelorama will add a number to its name. For example, "Palette_Name" would become "Palette_Name (2)", "Palette_Name (3)", etc.
- Language and theme checkboxes are now radio buttons.
- The Blue theme has more similar margins and seperations with the rest of the themes.
### Fixed
- Exporting large images and drawing with large image brushes is now a lot faster. (Because of Godot 3.2.2)
+- Pixel perfect strokes no longer leave gaps when the mouse is moving fast. ([#281](https://github.com/Orama-Interactive/Pixelorama/pull/281))
- Fixed failed imports of gpl palettes by adding support for the newer variant of gpl files. ([#250](https://github.com/Orama-Interactive/Pixelorama/pull/250))
- Fixed alpha blending and lighting/darkening issues when drawing pixels with mirroring.
- Fixed issue where if you moved a frame to the start (move left), it was invisible.
@@ -41,6 +48,8 @@ Darshan Phaldesai (luiq54), Igor Santarek (jegor377), rob-a-bolton, Kinwailo
- Grid and guides are now longer being displayed on previews. ([#205](https://github.com/Orama-Interactive/Pixelorama/issues/205))
- Fixed a rare problem where the custom mouse cursor's image was failing to load.
- Importing corrupted image files and non-palette json files no longer crash the app.
+- Drawing brushes no longer have clipping issues. ([#281](https://github.com/Orama-Interactive/Pixelorama/pull/281))
+- When undoing a removal of a brush, the brush index is no longer incorrect. ([#281](https://github.com/Orama-Interactive/Pixelorama/pull/281))
## [v0.7] - 2020-05-16
diff --git a/Translations/Translations.pot b/Translations/Translations.pot
index 6a64b7dcf..b813106ef 100644
--- a/Translations/Translations.pot
+++ b/Translations/Translations.pot
@@ -70,6 +70,9 @@ msgstr ""
msgid "Save as..."
msgstr ""
+msgid "Use ZSTD Compression"
+msgstr ""
+
msgid "Import"
msgstr ""
diff --git a/src/Autoload/OpenSave.gd b/src/Autoload/OpenSave.gd
index aedac5eb0..c627ff6d3 100644
--- a/src/Autoload/OpenSave.gd
+++ b/src/Autoload/OpenSave.gd
@@ -264,9 +264,14 @@ func open_old_pxo_file(file : File, new_project : Project, first_line : String)
tag_line = file.get_line()
-func save_pxo_file(path : String, autosave : bool, project : Project = Global.current_project) -> void:
- var file := File.new()
- var err := file.open_compressed(path, File.WRITE, File.COMPRESSION_ZSTD)
+func save_pxo_file(path : String, autosave : bool, use_zstd_compression := true, project : Project = Global.current_project) -> void:
+ var file : File = File.new()
+ var err
+ if use_zstd_compression:
+ err = file.open_compressed(path, File.WRITE, File.COMPRESSION_ZSTD)
+ else:
+ err = file.open(path, File.WRITE)
+
if err == OK:
if !autosave:
project.name = path.get_file()
@@ -284,7 +289,7 @@ func save_pxo_file(path : String, autosave : bool, project : Project = Global.cu
file.close()
if OS.get_name() == "HTML5" and !autosave:
- err = file.open_compressed(path, File.READ, File.COMPRESSION_ZSTD)
+ err = file.open(path, File.READ)
if !err:
var file_data = Array(file.get_buffer(file.get_len()))
JavaScript.eval("download('%s', %s, '');" % [path.get_file(), str(file_data)], true)
@@ -460,7 +465,7 @@ func _on_Autosave_timeout() -> void:
backup_save_paths[i] = "user://backup-" + String(OS.get_unix_time()) + "-%s" % i
store_backup_path(i)
- save_pxo_file(backup_save_paths[i], true, Global.projects[i])
+ save_pxo_file(backup_save_paths[i], true, true, Global.projects[i])
# Backup paths are stored in two ways:
diff --git a/src/Main.gd b/src/Main.gd
index 2b8db3306..510e11dd5 100644
--- a/src/Main.gd
+++ b/src/Main.gd
@@ -22,6 +22,13 @@ func _ready() -> void:
$QuitAndSaveDialog.add_button("Save & Exit", false, "Save")
$QuitAndSaveDialog.get_ok().text = "Exit without saving"
+ var zstd_checkbox := CheckBox.new()
+ zstd_checkbox.name = "ZSTDCompression"
+ zstd_checkbox.pressed = true
+ zstd_checkbox.text = "Use ZSTD Compression"
+ zstd_checkbox.mouse_default_cursor_shape = Control.CURSOR_POINTING_HAND
+ $SaveSprite.get_vbox().add_child(zstd_checkbox)
+
if not Global.config_cache.has_section_key("preferences", "startup"):
Global.config_cache.set_value("preferences", "startup", true)
show_splash_screen()
@@ -136,7 +143,8 @@ func _on_OpenSprite_file_selected(path : String) -> void:
func _on_SaveSprite_file_selected(path : String) -> void:
- OpenSave.save_pxo_file(path, false)
+ var zstd = Global.save_sprites_dialog.get_vbox().get_node("ZSTDCompression").pressed
+ OpenSave.save_pxo_file(path, false, zstd)
if is_quitting_on_save:
_on_QuitDialog_confirmed()
@@ -146,7 +154,7 @@ func _on_SaveSpriteHTML5_confirmed() -> void:
var file_name = Global.save_sprites_html5_dialog.get_node("FileNameContainer/FileNameLineEdit").text
file_name += ".pxo"
var path = "user://".plus_file(file_name)
- OpenSave.save_pxo_file(path, false)
+ OpenSave.save_pxo_file(path, false, false)
func _on_OpenSprite_popup_hide() -> void: