Add palette import from a PNG file

This commit is contained in:
novhack 2020-03-02 22:37:52 +01:00
parent b3a8eb6d84
commit 3b16b727b9
4 changed files with 39 additions and 1 deletions

View file

@ -50,6 +50,12 @@ func get_color_data(index : int) -> String:
return result
func has_color(color: Color) -> bool:
for palette_color in colors:
if palette_color.color == color:
return true
return false
func set_color_data(index : int, new_color : String) -> void:
if index < colors.size():
colors[index].data = new_color

View file

@ -43,6 +43,8 @@ func on_palette_import_file_selected(path : String) -> void:
palette = Palette.new().load_from_file(path)
elif path.to_lower().ends_with("gpl"):
palette = Import.import_gpl(path)
elif path.to_lower().ends_with("png"):
palette = Import.import_png_palette(path)
if palette:
if not Global.palettes.has(palette.name):