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

Compare commits

..

No commits in common. "85ac0897a9a2368f22a7bff3a80e0d12e79af972" and "afaae8ee4b1f7b504a80d3558720ab14c0395444" have entirely different histories.

2 changed files with 12 additions and 32 deletions

View file

@ -3,7 +3,7 @@ extends Node
signal palette_selected(palette_name: String)
signal new_palette_imported
enum SortOptions { NEW_PALETTE, REVERSE, HUE, SATURATION, VALUE, RED, GREEN, BLUE, ALPHA }
enum SortOptions { REVERSE, HUE, SATURATION, VALUE, RED, GREEN, BLUE, ALPHA }
## Presets for creating a new palette
enum NewPalettePresetType {
EMPTY = 0, FROM_CURRENT_PALETTE = 1, FROM_CURRENT_SPRITE = 2, FROM_CURRENT_SELECTION = 3
@ -71,14 +71,6 @@ func _save_palette(palette: Palette = current_palette) -> void:
Global.notification_label("Failed to save palette")
func copy_palette() -> void:
var new_palette_name := current_palette.name
while does_palette_exist(new_palette_name):
new_palette_name += " copy"
var comment := current_palette.comment
_create_new_palette_from_current_palette(new_palette_name, comment)
func create_new_palette(
preset: int,
palette_name: String,
@ -250,8 +242,6 @@ func current_palette_delete_color(index: int) -> void:
func current_palette_sort_colors(id: SortOptions) -> void:
if id == SortOptions.NEW_PALETTE:
return
if id == SortOptions.REVERSE:
current_palette.reverse_colors()
else:

View file

@ -14,7 +14,6 @@ var edited_swatch_color := Color.TRANSPARENT
@onready var add_color_button := $"%AddColor"
@onready var delete_color_button := $"%DeleteColor"
@onready var sort_button := %Sort as MenuButton
@onready var sort_button_popup := sort_button.get_popup()
@onready var edit_palette_dialog := $"%EditPaletteDialog"
@onready var create_palette_dialog := $"%CreatePaletteDialog"
@ -24,22 +23,20 @@ var edited_swatch_color := Color.TRANSPARENT
func _ready() -> void:
sort_button_popup.add_check_item("Create a new palette", Palettes.SortOptions.NEW_PALETTE)
sort_button_popup.set_item_checked(Palettes.SortOptions.NEW_PALETTE, true)
sort_button_popup.add_item("Reverse colors", Palettes.SortOptions.REVERSE)
sort_button_popup.add_separator()
sort_button_popup.add_item("Sort by hue", Palettes.SortOptions.HUE)
sort_button_popup.add_item("Sort by saturation", Palettes.SortOptions.SATURATION)
sort_button_popup.add_item("Sort by value", Palettes.SortOptions.VALUE)
sort_button_popup.add_separator()
sort_button_popup.add_item("Sort by red", Palettes.SortOptions.RED)
sort_button_popup.add_item("Sort by green", Palettes.SortOptions.GREEN)
sort_button_popup.add_item("Sort by blue", Palettes.SortOptions.BLUE)
sort_button_popup.add_item("Sort by alpha", Palettes.SortOptions.ALPHA)
sort_button.get_popup().add_item("Reverse colors", Palettes.SortOptions.REVERSE)
sort_button.get_popup().add_separator()
sort_button.get_popup().add_item("Sort by hue", Palettes.SortOptions.HUE)
sort_button.get_popup().add_item("Sort by saturation", Palettes.SortOptions.SATURATION)
sort_button.get_popup().add_item("Sort by value", Palettes.SortOptions.VALUE)
sort_button.get_popup().add_separator()
sort_button.get_popup().add_item("Sort by red", Palettes.SortOptions.RED)
sort_button.get_popup().add_item("Sort by green", Palettes.SortOptions.GREEN)
sort_button.get_popup().add_item("Sort by blue", Palettes.SortOptions.BLUE)
sort_button.get_popup().add_item("Sort by alpha", Palettes.SortOptions.ALPHA)
Palettes.palette_selected.connect(select_palette)
Palettes.new_palette_imported.connect(setup_palettes_selector)
Tools.color_changed.connect(_color_changed)
sort_button_popup.id_pressed.connect(sort_pressed)
sort_button.get_popup().id_pressed.connect(sort_pressed)
setup_palettes_selector()
redraw_current_palette()
@ -155,13 +152,6 @@ func _on_DeleteColor_gui_input(event: InputEvent) -> void:
func sort_pressed(id: Palettes.SortOptions) -> void:
var new_palette := sort_button_popup.is_item_checked(Palettes.SortOptions.NEW_PALETTE)
if id == Palettes.SortOptions.NEW_PALETTE:
sort_button_popup.set_item_checked(Palettes.SortOptions.NEW_PALETTE, not new_palette)
return
if new_palette:
Palettes.copy_palette()
setup_palettes_selector()
Palettes.current_palette_sort_colors(id)
redraw_current_palette()