Opening .pxo files directly with Pixelorama is now also supported

Also added "-> void" to the methods that did not already have it
This commit is contained in:
OverloadedOrama 2020-02-09 18:06:03 +02:00
parent 45a31faa7b
commit 9e7a3059f2
5 changed files with 25 additions and 20 deletions

View file

@ -15,9 +15,6 @@ func _ready() -> void:
remove_child(child)
get_vbox().add_child(child)
if OS.get_cmdline_args():
_on_ImportSprites_files_selected(OS.get_cmdline_args())
func _on_ImportAsNewFrame_pressed() -> void:
new_frame = !new_frame

View file

@ -672,7 +672,7 @@ func scale3X(sprite : Image, tol : float = 50) -> Image:
sprite.unlock()
return scaled
func rotxel(sprite : Image, angle : float):
func rotxel(sprite : Image, angle : float) -> void:
# If angle is simple, then nn rotation is the best
@ -783,7 +783,7 @@ func rotxel(sprite : Image, angle : float):
sprite.unlock()
aux.unlock()
func nn_rotate(sprite : Image, angle : float):
func nn_rotate(sprite : Image, angle : float) -> void:
var aux : Image = Image.new()
aux.copy_from(sprite)
sprite.lock()

View file

@ -152,6 +152,19 @@ func _ready() -> void:
Global.left_color_picker.get_picker().move_child(Global.left_color_picker.get_picker().get_child(0), 1)
Global.right_color_picker.get_picker().move_child(Global.right_color_picker.get_picker().get_child(0), 1)
if OS.get_cmdline_args():
for arg in OS.get_cmdline_args():
print(arg)
if arg.get_extension().to_lower() == "pxo":
_on_OpenSprite_file_selected(arg)
else:
$ImportSprites._on_ImportSprites_files_selected([arg])
OS.set_window_title("(" + tr("untitled") + ") - Pixelorama")
Global.canvas.layers[0][2] = tr("Layer") + " 0"
Global.canvas.generate_layer_panels()
Import.import_brushes("Brushes")
if not Global.config_cache.has_section_key("preferences", "startup"):
@ -159,11 +172,6 @@ func _ready() -> void:
if not Global.config_cache.get_value("preferences", "startup"):
$SplashDialog.hide()
OS.set_window_title("(" + tr("untitled") + ") - Pixelorama")
Global.canvas.layers[0][2] = tr("Layer") + " 0"
Global.canvas.generate_layer_panels()
# Wait for the window to adjust itself, so the popup is correctly centered
yield(get_tree().create_timer(0.01), "timeout")
$SplashDialog.popup_centered() # Splash screen