mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-01-18 17:19:50 +00:00
Fixed crash when importing images that were failing to load
They still fail to load, but Pixelorama does not crash.
This commit is contained in:
parent
3b289c5772
commit
d83057120b
|
@ -10,9 +10,15 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||||
- Spanish translation - thanks to azagaya!
|
- Spanish translation - thanks to azagaya!
|
||||||
- Translators can now be seen in the About window.
|
- Translators can now be seen in the About window.
|
||||||
|
|
||||||
|
## Changed
|
||||||
|
- Updates to the Greek, Russian and Traditional Chinese translations.
|
||||||
|
- Replaced some OS alerts with a custom made error dialog.
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
- Delay the splash screen popup so it shows properly centered (thanks to YeldhamDev)
|
- Delay the splash screen popup so it shows properly centered (thanks to YeldhamDev)
|
||||||
- Possibly fixed crashes with motion drawing and undo/redoing.
|
- Possibly fixed crashes with motion drawing and undo/redoing.
|
||||||
|
- Fixed bug (which also caused crashes sometimes) when generating an outline inside the image and it was going outside the canvas' borders.
|
||||||
|
- Fixed crash when importing images that were failing to load. They still fail to load, but Pixelorama does not crash.
|
||||||
|
|
||||||
## [v0.6.1] - 13-01-2020
|
## [v0.6.1] - 13-01-2020
|
||||||
|
|
||||||
|
|
|
@ -35,8 +35,7 @@ func _on_ImportSprites_files_selected(paths : PoolStringArray) -> void:
|
||||||
Global.control.clear_canvases()
|
Global.control.clear_canvases()
|
||||||
|
|
||||||
var first_path : String = paths[0]
|
var first_path : String = paths[0]
|
||||||
var i: int = Global.canvases.size()
|
var i : int = Global.canvases.size()
|
||||||
|
|
||||||
if !import_spritesheet:
|
if !import_spritesheet:
|
||||||
# Find the biggest image and let it handle the camera zoom options
|
# Find the biggest image and let it handle the camera zoom options
|
||||||
var max_size : Vector2
|
var max_size : Vector2
|
||||||
|
@ -45,7 +44,9 @@ func _on_ImportSprites_files_selected(paths : PoolStringArray) -> void:
|
||||||
var image := Image.new()
|
var image := Image.new()
|
||||||
var err := image.load(path)
|
var err := image.load(path)
|
||||||
if err != OK: # An error occured
|
if err != OK: # An error occured
|
||||||
OS.alert("Can't load file")
|
var file_name : String = path.get_file()
|
||||||
|
Global.error_dialog.set_text("Can't load file '%s'.\nError code: %s" % [file_name, str(err)])
|
||||||
|
Global.error_dialog.popup_centered()
|
||||||
continue
|
continue
|
||||||
|
|
||||||
var canvas : Canvas = load("res://Prefabs/Canvas.tscn").instance()
|
var canvas : Canvas = load("res://Prefabs/Canvas.tscn").instance()
|
||||||
|
@ -69,13 +70,16 @@ func _on_ImportSprites_files_selected(paths : PoolStringArray) -> void:
|
||||||
|
|
||||||
i += 1
|
i += 1
|
||||||
|
|
||||||
biggest_canvas.camera_zoom()
|
if biggest_canvas:
|
||||||
|
biggest_canvas.camera_zoom()
|
||||||
|
|
||||||
else:
|
else:
|
||||||
var image := Image.new()
|
var image := Image.new()
|
||||||
var err := image.load(first_path)
|
var err := image.load(first_path)
|
||||||
if err != OK: # An error occured
|
if err != OK: # An error occured
|
||||||
OS.alert("Can't load file")
|
var file_name : String = first_path.get_file()
|
||||||
|
Global.error_dialog.set_text("Can't load file '%s'.\nError code: %s" % [file_name, str(err)])
|
||||||
|
Global.error_dialog.popup_centered()
|
||||||
return
|
return
|
||||||
|
|
||||||
spritesheet_horizontal = min(spritesheet_horizontal, image.get_size().x)
|
spritesheet_horizontal = min(spritesheet_horizontal, image.get_size().x)
|
||||||
|
|
Loading…
Reference in a new issue