mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-01-18 17:19:50 +00:00
Created dummyBtn which holds the ButtonGrp (#329)
* Created dummyBtn which holds the ButtonGrp Also added the swatch Buttons to the same group. * Bug Fixes Also Updated the EditPalettePopup since it uses the PaletteButtons.
This commit is contained in:
parent
e0fb942c7c
commit
2bb7cab76b
|
@ -12,6 +12,7 @@ onready var color_name_edit = $VBoxContainer/PaletteOptions/EditPaletteColorName
|
||||||
onready var palette_name_edit = $VBoxContainer/PaletteOptions/EditPaletteNameLineEdit
|
onready var palette_name_edit = $VBoxContainer/PaletteOptions/EditPaletteNameLineEdit
|
||||||
onready var left_color_button = $VBoxContainer/HBoxContainer/VBoxContainer/CenterContainer/HBoxContainer/LeftColor/NinePatchRect
|
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 right_color_button = $VBoxContainer/HBoxContainer/VBoxContainer/CenterContainer/HBoxContainer/RightColor/NinePatchRect
|
||||||
|
onready var dummyBtn = $DummyBtn
|
||||||
|
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
|
@ -46,6 +47,7 @@ func _display_palette() -> void:
|
||||||
new_button.index = index
|
new_button.index = index
|
||||||
new_button.connect("on_drop_data", self, "on_move_swatch")
|
new_button.connect("on_drop_data", self, "on_move_swatch")
|
||||||
new_button.connect("pressed", self, "on_swatch_select", [new_button])
|
new_button.connect("pressed", self, "on_swatch_select", [new_button])
|
||||||
|
new_button.group = dummyBtn.group
|
||||||
|
|
||||||
palette_grid.add_child(new_button)
|
palette_grid.add_child(new_button)
|
||||||
index += 1
|
index += 1
|
||||||
|
@ -56,7 +58,7 @@ func _display_palette() -> void:
|
||||||
|
|
||||||
func _clear_swatches() -> void:
|
func _clear_swatches() -> void:
|
||||||
for child in palette_grid.get_children():
|
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.disconnect("on_drop_data", self, "on_move_swatch")
|
||||||
child.queue_free()
|
child.queue_free()
|
||||||
|
|
||||||
|
@ -90,6 +92,7 @@ func _on_AddSwatchButton_pressed() -> void:
|
||||||
new_button.index = index
|
new_button.index = index
|
||||||
new_button.connect("on_drop_data", self, "on_move_swatch")
|
new_button.connect("on_drop_data", self, "on_move_swatch")
|
||||||
new_button.connect("pressed", self, "on_swatch_select", [new_button])
|
new_button.connect("pressed", self, "on_swatch_select", [new_button])
|
||||||
|
new_button.group = dummyBtn.group
|
||||||
|
|
||||||
palette_grid.add_child(new_button)
|
palette_grid.add_child(new_button)
|
||||||
on_swatch_select(new_button)
|
on_swatch_select(new_button)
|
||||||
|
|
|
@ -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://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/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/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]
|
[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"]
|
[node name="EditPalettePopup" type="WindowDialog"]
|
||||||
margin_right = 600.0
|
margin_right = 600.0
|
||||||
margin_bottom = 550.0
|
margin_bottom = 550.0
|
||||||
|
@ -228,6 +230,15 @@ margin_left = 423.0
|
||||||
margin_right = 580.0
|
margin_right = 580.0
|
||||||
margin_bottom = 20.0
|
margin_bottom = 20.0
|
||||||
size_flags_horizontal = 3
|
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="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="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"]
|
[connection signal="pressed" from="VBoxContainer/HBoxContainer/VBoxContainer/CenterContainer/HBoxContainer/LeftColor" to="." method="_on_LeftColor_pressed"]
|
||||||
|
|
|
@ -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/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]
|
[ext_resource path="res://assets/graphics/palette/palette_button_fill.png" type="Texture" id=6]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[sub_resource type="ImageTexture" id=1]
|
[sub_resource type="ImageTexture" id=1]
|
||||||
|
|
||||||
[node name="PaletteButton" type="Button"]
|
[node name="PaletteButton" type="Button"]
|
||||||
|
@ -22,6 +19,7 @@ custom_styles/hover = ExtResource( 2 )
|
||||||
custom_styles/pressed = ExtResource( 1 )
|
custom_styles/pressed = ExtResource( 1 )
|
||||||
custom_styles/focus = ExtResource( 4 )
|
custom_styles/focus = ExtResource( 4 )
|
||||||
custom_styles/normal = ExtResource( 5 )
|
custom_styles/normal = ExtResource( 5 )
|
||||||
|
toggle_mode = true
|
||||||
action_mode = 0
|
action_mode = 0
|
||||||
button_mask = 3
|
button_mask = 3
|
||||||
icon = SubResource( 1 )
|
icon = SubResource( 1 )
|
||||||
|
|
|
@ -18,7 +18,7 @@ func _ready() -> void:
|
||||||
|
|
||||||
func _clear_swatches() -> void:
|
func _clear_swatches() -> void:
|
||||||
for child in get_children():
|
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.disconnect("pressed", self, "on_color_select")
|
||||||
child.queue_free()
|
child.queue_free()
|
||||||
|
|
||||||
|
@ -218,6 +218,7 @@ func _display_palette(palette : Palette) -> void:
|
||||||
new_button.get_child(0).modulate = color
|
new_button.get_child(0).modulate = color
|
||||||
new_button.hint_tooltip = "#" + color_data.data.to_upper() + " " + color_data.name
|
new_button.hint_tooltip = "#" + color_data.data.to_upper() + " " + color_data.name
|
||||||
new_button.connect("pressed", self, "on_color_select", [index])
|
new_button.connect("pressed", self, "on_color_select", [index])
|
||||||
|
new_button.group = $DummyBtn.group
|
||||||
|
|
||||||
add_child(new_button)
|
add_child(new_button)
|
||||||
index += 1
|
index += 1
|
||||||
|
|
|
@ -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://src/Palette/PaletteContainer.gd" type="Script" id=1]
|
||||||
[ext_resource path="res://assets/graphics/dark_themes/palette/edit_palette.png" type="Texture" id=2]
|
[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/NewPaletteDialog.tscn" type="PackedScene" id=6]
|
||||||
[ext_resource path="res://src/Palette/EditPalettePopup.tscn" type="PackedScene" id=7]
|
[ext_resource path="res://src/Palette/EditPalettePopup.tscn" type="PackedScene" id=7]
|
||||||
|
|
||||||
|
[sub_resource type="ButtonGroup" id=1]
|
||||||
|
|
||||||
[node name="PalettePanelContainer" type="PanelContainer"]
|
[node name="PalettePanelContainer" type="PanelContainer"]
|
||||||
margin_left = 15.0
|
margin_left = 15.0
|
||||||
margin_top = 261.0
|
margin_top = 261.0
|
||||||
|
@ -160,6 +162,13 @@ size_flags_horizontal = 3
|
||||||
columns = 10
|
columns = 10
|
||||||
script = ExtResource( 1 )
|
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 )]
|
[node name="NewPaletteDialog" parent="." instance=ExtResource( 6 )]
|
||||||
margin_left = 7.0
|
margin_left = 7.0
|
||||||
margin_top = 7.0
|
margin_top = 7.0
|
||||||
|
@ -175,6 +184,8 @@ margin_left = 7.0
|
||||||
margin_top = 7.0
|
margin_top = 7.0
|
||||||
margin_right = 507.0
|
margin_right = 507.0
|
||||||
margin_bottom = 307.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 )]
|
[node name="EditPalettePopup" parent="." instance=ExtResource( 7 )]
|
||||||
margin_left = 7.0
|
margin_left = 7.0
|
||||||
|
|
Loading…
Reference in a new issue