mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-01-31 07:29:49 +00:00
Drag and drop palette files to open them
This commit is contained in:
parent
f7cc9a8104
commit
25d9aca0c4
|
@ -139,6 +139,9 @@ msgstr ""
|
|||
msgid "Open File(s)"
|
||||
msgstr ""
|
||||
|
||||
msgid "Import Options"
|
||||
msgstr ""
|
||||
|
||||
msgid "Import as:"
|
||||
msgstr ""
|
||||
|
||||
|
|
|
@ -20,9 +20,12 @@ func _ready() -> void:
|
|||
func handle_loading_files(files : PoolStringArray) -> void:
|
||||
for file in files:
|
||||
file = file.replace("\\", "/")
|
||||
if file.get_extension().to_lower() == "pxo":
|
||||
var file_ext : String = file.get_extension().to_lower()
|
||||
if file_ext == "pxo": # Pixelorama project file
|
||||
open_pxo_file(file)
|
||||
else:
|
||||
elif file_ext == "json" or file_ext == "gpl": # Palettes
|
||||
Global.palette_container.on_palette_import_file_selected(file)
|
||||
else: # Image files
|
||||
var image := Image.new()
|
||||
var err := image.load(file)
|
||||
if err != OK: # An error occured
|
||||
|
|
|
@ -13,15 +13,12 @@ onready var texture_rect : TextureRect = $VBoxContainer/CenterContainer/TextureR
|
|||
onready var spritesheet_options = $VBoxContainer/HBoxContainer/SpritesheetOptions
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
spritesheet_options.get_node("HorizontalFrames").max_value = min(spritesheet_options.get_node("HorizontalFrames").max_value, image.get_size().x)
|
||||
spritesheet_options.get_node("VerticalFrames").max_value = min(spritesheet_options.get_node("VerticalFrames").max_value, image.get_size().y)
|
||||
|
||||
|
||||
func _on_PreviewDialog_about_to_show() -> void:
|
||||
var img_texture := ImageTexture.new()
|
||||
img_texture.create_from_image(image)
|
||||
texture_rect.texture = img_texture
|
||||
spritesheet_options.get_node("HorizontalFrames").max_value = min(spritesheet_options.get_node("HorizontalFrames").max_value, image.get_size().x)
|
||||
spritesheet_options.get_node("VerticalFrames").max_value = min(spritesheet_options.get_node("VerticalFrames").max_value, image.get_size().y)
|
||||
|
||||
|
||||
func _on_PreviewDialog_popup_hide() -> void:
|
||||
|
|
|
@ -7,6 +7,7 @@ margin_right = 200.0
|
|||
margin_bottom = 70.0
|
||||
rect_min_size = Vector2( 550, 70 )
|
||||
popup_exclusive = true
|
||||
window_title = "Import Options"
|
||||
resizable = true
|
||||
script = ExtResource( 1 )
|
||||
__meta__ = {
|
||||
|
|
Loading…
Reference in a new issue