From 3191e3f8c89d2c2cd88a74ffb914b10894157a55 Mon Sep 17 00:00:00 2001 From: CheetoHead Date: Tue, 17 Dec 2019 19:49:20 -0500 Subject: [PATCH] Add new palette updates 1 --- Scripts/Global.gd | 2 +- Scripts/Main.gd | 11 ++++++++++- Scripts/PaletteContainer.gd | 11 +++++++++++ Themes & Styles/Main Theme.tres | 11 +++++++++++ project.godot | 2 +- 5 files changed, 34 insertions(+), 3 deletions(-) diff --git a/Scripts/Global.gd b/Scripts/Global.gd index d62aadceb..48082c508 100644 --- a/Scripts/Global.gd +++ b/Scripts/Global.gd @@ -182,7 +182,7 @@ var move_up_layer_button : BaseButton var move_down_layer_button : BaseButton var merge_down_layer_button : BaseButton -var add_palette_button : TextureButton +var add_palette_button : MenuButton var remove_palette_button : TextureButton var palette_option_button : OptionButton var edit_palette_button : BaseButton diff --git a/Scripts/Main.gd b/Scripts/Main.gd index 444ba90c8..56ce1ac60 100644 --- a/Scripts/Main.gd +++ b/Scripts/Main.gd @@ -101,6 +101,7 @@ func _ready() -> void: var edit_menu : PopupMenu = Global.edit_menu.get_popup() view_menu = Global.view_menu.get_popup() var help_menu : PopupMenu = Global.help_menu.get_popup() + var add_palette_menu : PopupMenu = Global.add_palette_button.get_popup() var i = 0 for item in file_menu_items.keys(): @@ -125,6 +126,7 @@ func _ready() -> void: edit_menu.connect("id_pressed", self, "edit_menu_id_pressed") view_menu.connect("id_pressed", self, "view_menu_id_pressed") help_menu.connect("id_pressed", self, "help_menu_id_pressed") + add_palette_menu.connect("id_pressed", self, "add_palette_menu_id_pressed") var root = get_tree().get_root() #Node, left mouse shortcut, right mouse shortcut @@ -1066,7 +1068,14 @@ func _on_RemovePalette_pressed() -> void: Global.palette_container.remove_current_palette() pass +func add_palette_menu_id_pressed(id) -> void: + match id: + 0: # New Empty Palette + Global.palette_container.on_new_empty_palette() + 1: # Import Palette + Global.palette_container.on_import_palette() + pass + func _on_NewPaletteDialog_confirmed() -> void: Global.palette_container.on_new_palette_confirmed() pass - diff --git a/Scripts/PaletteContainer.gd b/Scripts/PaletteContainer.gd index ef75a2597..80997fd98 100644 --- a/Scripts/PaletteContainer.gd +++ b/Scripts/PaletteContainer.gd @@ -34,6 +34,16 @@ func on_palette_select(palette_name : String) -> void: current_palette = "Default" _display_palette(Global.palettes["Default"]) +func on_new_empty_palette() -> void: + Global.new_palette_dialog.window_title = "Create a new empty palette?" + Global.new_palette_name_line_edit.text = "Custom_Palette" + from_palette = {} + Global.new_palette_dialog.popup_centered() + pass + +func on_import_palette() -> void: + pass + func on_edit_palette() -> void: var palette : Dictionary = Global.palettes[current_palette] @@ -44,6 +54,7 @@ func on_edit_palette() -> void: if create_new_palette: from_palette = Global.palettes[current_palette] + Global.new_palette_dialog.window_title = "Create a new custom palette from existing default?" Global.new_palette_name_line_edit.text = "Custom_" + current_palette Global.new_palette_dialog.popup_centered() else: diff --git a/Themes & Styles/Main Theme.tres b/Themes & Styles/Main Theme.tres index c9cffbb92..22229508c 100644 --- a/Themes & Styles/Main Theme.tres +++ b/Themes & Styles/Main Theme.tres @@ -148,6 +148,17 @@ LineEdit/icons/clear = null LineEdit/styles/focus = null LineEdit/styles/normal = SubResource( 8 ) LineEdit/styles/read_only = null +MenuButton/colors/font_color = Color( 0.878431, 0.878431, 0.878431, 1 ) +MenuButton/colors/font_color_disabled = Color( 1, 1, 1, 0.3 ) +MenuButton/colors/font_color_hover = Color( 0.941176, 0.941176, 0.941176, 1 ) +MenuButton/colors/font_color_pressed = Color( 1, 1, 1, 1 ) +MenuButton/constants/hseparation = 3 +MenuButton/fonts/font = null +MenuButton/styles/disabled = null +MenuButton/styles/focus = null +MenuButton/styles/hover = null +MenuButton/styles/normal = null +MenuButton/styles/pressed = null TabContainer/colors/font_color_bg = Color( 0.690196, 0.690196, 0.690196, 1 ) TabContainer/colors/font_color_disabled = Color( 0.9, 0.9, 0.9, 0.2 ) TabContainer/colors/font_color_fg = Color( 0.941176, 0.941176, 0.941176, 1 ) diff --git a/project.godot b/project.godot index 86a73f30a..d9dd9391f 100644 --- a/project.godot +++ b/project.godot @@ -33,11 +33,11 @@ _global_script_class_icons={ [application] config/name="Pixelorama" -config/description="A free & open-source 2D sprite editor" run/main_scene="res://Main.tscn" boot_splash/image="res://splash.png" boot_splash/bg_color=Color( 0.145098, 0.145098, 0.164706, 1 ) config/icon="res://icon.png" +config/description="A free & open-source 2D sprite editor" config/Version="v0.5" [autoload]