1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-02-20 12:33:14 +00:00

Persist palette selection (#549)

This commit is contained in:
Silent Orb 2021-10-17 07:20:11 -06:00 committed by GitHub
parent 087387a700
commit 520e31cd7e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -54,6 +54,7 @@ func does_palette_exist(palette_name: String) -> bool:
func select_palette(palette_path: String) -> void:
current_palette = palettes.get(palette_path)
clear_selected_colors()
Global.config_cache.set_value("data", "last_palette", current_palette.name)
func is_any_palette_selected() -> bool:
@ -304,6 +305,7 @@ func load_palettes() -> void:
# get overwritten by those of the same name in user files
search_locations.invert()
priority_ordered_files.invert()
var default_palette_name = Global.config_cache.get_value("data", "last_palette", DEFAULT_PALETTE_NAME)
for i in range(len(search_locations)):
# If palette is not in palettes write path - make it's copy in the write path
var make_copy := false
@ -324,7 +326,7 @@ func load_palettes() -> void:
palettes[palette.resource_path] = palette
# Store index of the default palette
if palette.name == DEFAULT_PALETTE_NAME:
if palette.name == default_palette_name:
select_palette(palette.resource_path)
if not current_palette && palettes.size() > 0: