diff --git a/src/Palette/EditPalettePopup.gd b/src/Palette/EditPalettePopup.gd index 65177e559..830d9e36e 100644 --- a/src/Palette/EditPalettePopup.gd +++ b/src/Palette/EditPalettePopup.gd @@ -12,6 +12,7 @@ onready var color_name_edit = $VBoxContainer/PaletteOptions/EditPaletteColorName onready var palette_name_edit = $VBoxContainer/PaletteOptions/EditPaletteNameLineEdit onready var left_color_button = $VBoxContainer/HBoxContainer/VBoxContainer/CenterContainer/HBoxContainer/LeftColor/NinePatchRect onready var right_color_button = $VBoxContainer/HBoxContainer/VBoxContainer/CenterContainer/HBoxContainer/RightColor/NinePatchRect +onready var dummyBtn = $DummyBtn func _ready() -> void: @@ -46,6 +47,7 @@ func _display_palette() -> void: new_button.index = index new_button.connect("on_drop_data", self, "on_move_swatch") new_button.connect("pressed", self, "on_swatch_select", [new_button]) + new_button.group = dummyBtn.group palette_grid.add_child(new_button) index += 1 @@ -56,7 +58,7 @@ func _display_palette() -> void: func _clear_swatches() -> void: for child in palette_grid.get_children(): - if child is BaseButton: + if child is BaseButton and child.text != "Dummy": child.disconnect("on_drop_data", self, "on_move_swatch") child.queue_free() @@ -90,6 +92,7 @@ func _on_AddSwatchButton_pressed() -> void: new_button.index = index new_button.connect("on_drop_data", self, "on_move_swatch") new_button.connect("pressed", self, "on_swatch_select", [new_button]) + new_button.group = dummyBtn.group palette_grid.add_child(new_button) on_swatch_select(new_button) diff --git a/src/Palette/EditPalettePopup.tscn b/src/Palette/EditPalettePopup.tscn index a93ce725d..76d5d2ce3 100644 --- a/src/Palette/EditPalettePopup.tscn +++ b/src/Palette/EditPalettePopup.tscn @@ -1,10 +1,12 @@ -[gd_scene load_steps=5 format=2] +[gd_scene load_steps=6 format=2] [ext_resource path="res://src/Palette/EditPalettePopup.gd" type="Script" id=1] [ext_resource path="res://assets/graphics/dark_themes/timeline/new_frame.png" type="Texture" id=2] [ext_resource path="res://assets/graphics/dark_themes/timeline/remove_frame.png" type="Texture" id=3] [ext_resource path="res://assets/graphics/palette/palette_button_fill.png" type="Texture" id=6] +[sub_resource type="ButtonGroup" id=1] + [node name="EditPalettePopup" type="WindowDialog"] margin_right = 600.0 margin_bottom = 550.0 @@ -228,6 +230,15 @@ margin_left = 423.0 margin_right = 580.0 margin_bottom = 20.0 size_flags_horizontal = 3 + +[node name="DummyBtn" type="Button" parent="."] +visible = false +margin_left = 322.0 +margin_top = 10.0 +margin_right = 385.0 +margin_bottom = 30.0 +group = SubResource( 1 ) +text = "Dummy" [connection signal="popup_hide" from="." to="." method="_on_EditPalettePopup_popup_hide"] [connection signal="color_changed" from="VBoxContainer/HBoxContainer/EditPaletteColorPicker" to="." method="_on_EditPaletteColorPicker_color_changed"] [connection signal="pressed" from="VBoxContainer/HBoxContainer/VBoxContainer/CenterContainer/HBoxContainer/LeftColor" to="." method="_on_LeftColor_pressed"] diff --git a/src/Palette/PaletteButton.tscn b/src/Palette/PaletteButton.tscn index 872230e92..361af5191 100644 --- a/src/Palette/PaletteButton.tscn +++ b/src/Palette/PaletteButton.tscn @@ -7,9 +7,6 @@ [ext_resource path="res://assets/themes/palette_styleboxes/palette_stylebox_normal.tres" type="StyleBox" id=5] [ext_resource path="res://assets/graphics/palette/palette_button_fill.png" type="Texture" id=6] - - - [sub_resource type="ImageTexture" id=1] [node name="PaletteButton" type="Button"] @@ -22,6 +19,7 @@ custom_styles/hover = ExtResource( 2 ) custom_styles/pressed = ExtResource( 1 ) custom_styles/focus = ExtResource( 4 ) custom_styles/normal = ExtResource( 5 ) +toggle_mode = true action_mode = 0 button_mask = 3 icon = SubResource( 1 ) diff --git a/src/Palette/PaletteContainer.gd b/src/Palette/PaletteContainer.gd index bb6962b5d..5850c49a0 100644 --- a/src/Palette/PaletteContainer.gd +++ b/src/Palette/PaletteContainer.gd @@ -18,7 +18,7 @@ func _ready() -> void: func _clear_swatches() -> void: for child in get_children(): - if child is BaseButton: + if child is BaseButton and child.text != "Dummy": child.disconnect("pressed", self, "on_color_select") child.queue_free() @@ -218,6 +218,7 @@ func _display_palette(palette : Palette) -> void: new_button.get_child(0).modulate = color new_button.hint_tooltip = "#" + color_data.data.to_upper() + " " + color_data.name new_button.connect("pressed", self, "on_color_select", [index]) + new_button.group = $DummyBtn.group add_child(new_button) index += 1 diff --git a/src/Palette/PalettePanelContainer.tscn b/src/Palette/PalettePanelContainer.tscn index 0f86c59ac..179420b15 100644 --- a/src/Palette/PalettePanelContainer.tscn +++ b/src/Palette/PalettePanelContainer.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=8 format=2] +[gd_scene load_steps=9 format=2] [ext_resource path="res://src/Palette/PaletteContainer.gd" type="Script" id=1] [ext_resource path="res://assets/graphics/dark_themes/palette/edit_palette.png" type="Texture" id=2] @@ -8,6 +8,8 @@ [ext_resource path="res://src/Palette/NewPaletteDialog.tscn" type="PackedScene" id=6] [ext_resource path="res://src/Palette/EditPalettePopup.tscn" type="PackedScene" id=7] +[sub_resource type="ButtonGroup" id=1] + [node name="PalettePanelContainer" type="PanelContainer"] margin_left = 15.0 margin_top = 261.0 @@ -160,6 +162,13 @@ size_flags_horizontal = 3 columns = 10 script = ExtResource( 1 ) +[node name="DummyBtn" type="Button" parent="PaletteVBoxContainer/ScrollPalette/CenterPalette/PaletteContainer"] +visible = false +margin_right = 12.0 +margin_bottom = 20.0 +group = SubResource( 1 ) +text = "Dummy" + [node name="NewPaletteDialog" parent="." instance=ExtResource( 6 )] margin_left = 7.0 margin_top = 7.0 @@ -175,6 +184,8 @@ margin_left = 7.0 margin_top = 7.0 margin_right = 507.0 margin_bottom = 307.0 +current_dir = "/home/luiq/data/libDev/git/Pixelorama" +current_path = "/home/luiq/data/libDev/git/Pixelorama/" [node name="EditPalettePopup" parent="." instance=ExtResource( 7 )] margin_left = 7.0