mirror of
https://github.com/tonytins/CozyPixelStudio.git
synced 2025-06-25 12:14:42 -04:00
Add palette import from a PNG file
This commit is contained in:
parent
b3a8eb6d84
commit
3b16b727b9
4 changed files with 39 additions and 1 deletions
|
@ -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
|
||||
|
|
|
@ -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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue