Add PAL palette format import (#315)

* Add PAL palette format import

* Move .pal selection into Dialog; Attempt HTML implementation

* Fix issue with HTML5 pal palette import.
This commit is contained in:
Matthew Paul 2020-08-26 05:36:03 -04:00 committed by GitHub
parent f121c39ddc
commit 348d758ef4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 38 additions and 2 deletions

View file

@ -58,6 +58,13 @@ func on_palette_import_file_selected(path : String) -> void:
var text = file.get_as_text()
file.close()
palette = Import.import_gpl(path, text)
elif path.to_lower().ends_with("pal"):
var file = File.new()
if file.file_exists(path):
file.open(path, File.READ)
var text = file.get_as_text()
file.close()
palette = Import.import_pal_palette(path, text)
elif path.to_lower().ends_with("png") or path.to_lower().ends_with("bmp") or path.to_lower().ends_with("hdr") or path.to_lower().ends_with("jpg") or path.to_lower().ends_with("svg") or path.to_lower().ends_with("tga") or path.to_lower().ends_with("webp"):
var image := Image.new()
var err := image.load(path)

View file

@ -10,6 +10,6 @@ window_title = "Open a File"
resizable = true
mode = 0
access = 2
filters = PoolStringArray( "*.json ; JavaScript Object Notation", "*.gpl ; Gimp Palette Library", "*.png; Portable Network Graphics" )
filters = PoolStringArray( "*.json ; JavaScript Object Notation", "*.gpl ; Gimp Palette Library", "*.png; Portable Network Graphics", "*.pal; JASC Palette" )
current_dir = "/Users"
current_path = "/Users/"