Added a warning dialog when clicking the remove palette button

This prevents accidental palette deletions
This commit is contained in:
OverloadedOrama 2020-10-13 14:30:51 +03:00
parent 24463076d2
commit 37a8f51249
4 changed files with 22 additions and 1 deletions

View file

@ -9,6 +9,7 @@ var current_palette = "Default"
var from_palette : Palette
onready var palette_from_sprite_dialog = $"../../../../PaletteFromSpriteDialog"
onready var remove_palette_warning = $"../../../../RemovePaletteWarning"
func _ready() -> void:
@ -411,7 +412,8 @@ func _on_NewPaletteDialog_popup_hide() -> void:
func _on_RemovePalette_pressed() -> void:
remove_palette(current_palette)
remove_palette_warning.popup_centered()
Global.dialog_open(true)
func _on_PaletteFromSpriteDialog_confirmed() -> void:
@ -420,3 +422,11 @@ func _on_PaletteFromSpriteDialog_confirmed() -> void:
func _on_PaletteFromSpriteDialog_popup_hide() -> void:
Global.dialog_open(false)
func _on_RemovePaletteWarning_confirmed() -> void:
remove_palette(current_palette)
func _on_RemovePaletteWarning_popup_hide() -> void:
Global.dialog_open(false)

View file

@ -244,6 +244,11 @@ mouse_default_cursor_shape = 2
text = "Current cel"
items = [ "Current cel", null, false, 0, null, "Current frame", null, false, 1, null, "All frames", null, false, 2, null ]
selected = 0
[node name="RemovePaletteWarning" type="ConfirmationDialog" parent="."]
margin_right = 200.0
margin_bottom = 70.0
dialog_text = "Are you sure you want to remove this palette? (Cannot be undone)"
[connection signal="pressed" from="PaletteVBoxContainer/CenterContainer/PaletteButtons/AddPalette" to="PaletteVBoxContainer/ScrollPalette/CenterPalette/PaletteContainer" method="_on_AddPalette_pressed"]
[connection signal="pressed" from="PaletteVBoxContainer/CenterContainer/PaletteButtons/EditPalette" to="PaletteVBoxContainer/ScrollPalette/CenterPalette/PaletteContainer" method="on_edit_palette"]
[connection signal="pressed" from="PaletteVBoxContainer/CenterContainer/PaletteButtons/RemovePalette" to="PaletteVBoxContainer/ScrollPalette/CenterPalette/PaletteContainer" method="_on_RemovePalette_pressed"]
@ -254,3 +259,5 @@ selected = 0
[connection signal="popup_hide" from="PaletteImportFileDialog" to="PaletteVBoxContainer/ScrollPalette/CenterPalette/PaletteContainer" method="_on_NewPaletteDialog_popup_hide"]
[connection signal="confirmed" from="PaletteFromSpriteDialog" to="PaletteVBoxContainer/ScrollPalette/CenterPalette/PaletteContainer" method="_on_PaletteFromSpriteDialog_confirmed"]
[connection signal="popup_hide" from="PaletteFromSpriteDialog" to="PaletteVBoxContainer/ScrollPalette/CenterPalette/PaletteContainer" method="_on_PaletteFromSpriteDialog_popup_hide"]
[connection signal="confirmed" from="RemovePaletteWarning" to="PaletteVBoxContainer/ScrollPalette/CenterPalette/PaletteContainer" method="_on_RemovePaletteWarning_confirmed"]
[connection signal="popup_hide" from="RemovePaletteWarning" to="PaletteVBoxContainer/ScrollPalette/CenterPalette/PaletteContainer" method="_on_RemovePaletteWarning_popup_hide"]