1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-02-20 12:33:14 +00:00

Fixed issue with open last image and turned off pixel perfect drawing by default

This commit is contained in:
OverloadedOrama 2020-05-01 00:02:52 +03:00
parent 82fe186b65
commit 460f86ff8e
6 changed files with 49 additions and 49 deletions

View file

@ -17,6 +17,7 @@ sapient-cogbag, Kinwailo, Igor Santarek (jegor377), Dávid Gábor BODOR (dragonf
- A new rotation method has been added, "Upscale, Rotate and Downscale". It's similar to Rotsprite.
- An HSV Adjust dialog has been added in the Images menu.
- Pattern filling is now possible. The bucket tool can now use Patterns to fill areas, instead of a single color.
- An autosave feature that keeps backups of unsaved projects have been added. In the case of a software crash, the users can restore their work with this system.
- Users can now change keyboard shortcut bindings for tools, in the Preferences.
- Pixel Perfect mode has been added for pencil, eraser and lighten/darken tools.
- Importing .pngs as palettes is now possible.
@ -25,7 +26,7 @@ sapient-cogbag, Kinwailo, Igor Santarek (jegor377), Dávid Gábor BODOR (dragonf
- Templates and a lock aspect ratio option have been added to the "Create new image" dialog.
- Locking layers is now possible. When a layer is locked, no changes can be made to it. Layers are unlocked by default.
- Ability to get color for palette buttons, when editing a palette, from the currently selected left and right colors.
- Esperanto translation.
- Esperanto & Indonesian translation.
- When the image is unsaved and the user tries to make a new one, a new warning dialog will appear to ask for confirmation.
- A new zoom tool has been added, and you can also zoom in with the `+` key, and zoom out with `-`.
- You can now move the canvas with the `Arrow keys`. `Shift + Arrows` make it move with medium speed, and `Ctrl + Shift + Arrows` makes it move with high speed.
@ -49,7 +50,7 @@ sapient-cogbag, Kinwailo, Igor Santarek (jegor377), Dávid Gábor BODOR (dragonf
- The default window size is now 1280x720, and the minimum window size is 1024x576.
- .pxo files now use ZSTD compression to result in smaller file sizes.
- Palettes/Brushes get loaded/saved in appropriate locations as specified by the XDG basedir standard, for easier usage of standard linux/bsd packaging methods and for better per-user usability.
- The splash screen is no longer purple, it now gets affected by the chosen theme.
- The splash screen has been revamped and is no longer purple, it now gets affected by the chosen theme.
- The brush selection popup now closes when a brush is selected.
### Fixed

File diff suppressed because one or more lines are too long

View file

@ -8,6 +8,7 @@ margin_top = -1.0
margin_right = 464.0
margin_bottom = 318.0
window_title = "Adjust HSV"
resizable = true
script = ExtResource( 1 )
[node name="MarginContainer" type="MarginContainer" parent="."]

View file

@ -2,7 +2,7 @@ class Drawer:
func reset() -> void:
pass
func set_pixel(sprite: Image, pos: Vector2, new_color: Color) -> void:
func set_pixel(_sprite: Image, _pos: Vector2, _new_color: Color) -> void:
pass
@ -10,8 +10,8 @@ class SimpleDrawer extends Drawer:
func reset() -> void:
pass
func set_pixel(sprite: Image, pos: Vector2, new_color: Color) -> void:
sprite.set_pixel(pos.x, pos.y, new_color)
func set_pixel(_sprite: Image, _pos: Vector2, _new_color: Color) -> void:
_sprite.set_pixel(_pos.x, _pos.y, _new_color)
class PixelPerfectDrawer extends Drawer:
@ -22,9 +22,9 @@ class PixelPerfectDrawer extends Drawer:
func reset():
last_pixels = [null, null]
func set_pixel(sprite: Image, pos: Vector2, new_color: Color) -> void:
last_pixels.push_back([pos, sprite.get_pixel(pos.x, pos.y)])
sprite.set_pixel(pos.x, pos.y, new_color)
func set_pixel(_sprite: Image, _pos: Vector2, _new_color: Color) -> void:
last_pixels.push_back([_pos, _sprite.get_pixel(_pos.x, _pos.y)])
_sprite.set_pixel(_pos.x, _pos.y, _new_color)
var corner = last_pixels.pop_front()
var neighbour = last_pixels[0]
@ -32,6 +32,6 @@ class PixelPerfectDrawer extends Drawer:
if corner == null or neighbour == null:
return
if pos - corner[0] in corners and pos - neighbour[0] in neighbours:
sprite.set_pixel(neighbour[0].x, neighbour[0].y, neighbour[1])
if _pos - corner[0] in corners and _pos - neighbour[0] in neighbours:
_sprite.set_pixel(neighbour[0].x, neighbour[0].y, neighbour[1])
last_pixels[0] = corner

View file

@ -105,8 +105,8 @@ var left_vertical_mirror := false
var right_horizontal_mirror := false
var right_vertical_mirror := false
var left_pixel_perfect := true
var right_pixel_perfect := true
var left_pixel_perfect := false
var right_pixel_perfect := false
# View menu options
var tile_mode := false

View file

@ -210,9 +210,11 @@ func _ready() -> void:
$BackupConfirmation.get_cancel().connect("pressed", self, "_on_BackupConfirmation_delete", [project_paths[0], backup_path])
$BackupConfirmation.popup_centered()
else:
load_last_project()
if Global.open_last_project:
load_last_project()
else:
load_last_project()
if Global.open_last_project:
load_last_project()
func _input(event : InputEvent) -> void:
@ -439,18 +441,17 @@ func help_menu_id_pressed(id : int) -> void:
$AboutDialog.popup_centered()
Global.can_draw = false
func load_last_project():
if Global.open_last_project:
# Check if any project was saved or opened last time
if Global.config_cache.has_section_key("preferences", "last_project_path"):
# Check if file still exists on disk
var file_path = Global.config_cache.get_value("preferences", "last_project_path")
var file_check := File.new()
if file_check.file_exists(file_path): # If yes then load the file
_on_OpenSprite_file_selected(file_path)
else:
# If file doesn't exist on disk then warn user about this
$OpenLastProjectAlertDialog.popup_centered()
func load_last_project() -> void:
# Check if any project was saved or opened last time
if Global.config_cache.has_section_key("preferences", "last_project_path"):
# Check if file still exists on disk
var file_path = Global.config_cache.get_value("preferences", "last_project_path")
var file_check := File.new()
if file_check.file_exists(file_path): # If yes then load the file
_on_OpenSprite_file_selected(file_path)
else:
# If file doesn't exist on disk then warn user about this
$OpenLastProjectAlertDialog.popup_centered()
func _on_UnsavedCanvasDialog_confirmed() -> void:
@ -828,12 +829,13 @@ func _on_BackupConfirmation_delete(project_path : String, backup_path : String)
OpenSave.remove_backup_by_path(project_path, backup_path)
OpenSave.autosave_timer.start()
# Reopen last project
load_last_project()
if Global.open_last_project:
load_last_project()
func _on_LeftPixelPerfectMode_toggled(button_pressed) -> void:
func _on_LeftPixelPerfectMode_toggled(button_pressed : bool) -> void:
Global.left_pixel_perfect = button_pressed
func _on_RightPixelPerfectMode_toggled(button_pressed) -> void:
func _on_RightPixelPerfectMode_toggled(button_pressed : bool) -> void:
Global.right_pixel_perfect = button_pressed