mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-01-18 17:19:50 +00:00
Makes the background UI darker when a dialog is being opened
This commit is contained in:
parent
0f5c7c5e59
commit
51b6aadbdd
29
src/Main.gd
29
src/Main.gd
|
@ -175,6 +175,7 @@ func _ready() -> void:
|
||||||
yield(get_tree().create_timer(0.01), "timeout")
|
yield(get_tree().create_timer(0.01), "timeout")
|
||||||
if Global.config_cache.get_value("preferences", "startup"):
|
if Global.config_cache.get_value("preferences", "startup"):
|
||||||
$SplashDialog.popup_centered() # Splash screen
|
$SplashDialog.popup_centered() # Splash screen
|
||||||
|
modulate = Color(0.5, 0.5, 0.5)
|
||||||
else:
|
else:
|
||||||
Global.can_draw = true
|
Global.can_draw = true
|
||||||
|
|
||||||
|
@ -198,6 +199,8 @@ func _ready() -> void:
|
||||||
$BackupConfirmation.connect("confirmed", self, "_on_BackupConfirmation_confirmed", [project_paths[0], backup_path])
|
$BackupConfirmation.connect("confirmed", self, "_on_BackupConfirmation_confirmed", [project_paths[0], backup_path])
|
||||||
$BackupConfirmation.get_cancel().connect("pressed", self, "_on_BackupConfirmation_delete", [project_paths[0], backup_path])
|
$BackupConfirmation.get_cancel().connect("pressed", self, "_on_BackupConfirmation_delete", [project_paths[0], backup_path])
|
||||||
$BackupConfirmation.popup_centered()
|
$BackupConfirmation.popup_centered()
|
||||||
|
Global.can_draw = false
|
||||||
|
modulate = Color(0.5, 0.5, 0.5)
|
||||||
else:
|
else:
|
||||||
if Global.open_last_project:
|
if Global.open_last_project:
|
||||||
load_last_project()
|
load_last_project()
|
||||||
|
@ -258,9 +261,11 @@ func file_menu_id_pressed(id : int) -> void:
|
||||||
else:
|
else:
|
||||||
$CreateNewImage.popup_centered()
|
$CreateNewImage.popup_centered()
|
||||||
Global.can_draw = false
|
Global.can_draw = false
|
||||||
|
modulate = Color(0.5, 0.5, 0.5)
|
||||||
1: # Open
|
1: # Open
|
||||||
$OpenSprite.popup_centered()
|
$OpenSprite.popup_centered()
|
||||||
Global.can_draw = false
|
Global.can_draw = false
|
||||||
|
modulate = Color(0.5, 0.5, 0.5)
|
||||||
opensprite_file_selected = false
|
opensprite_file_selected = false
|
||||||
2: # Open last project
|
2: # Open last project
|
||||||
# Check if last project path is set and if yes then open
|
# Check if last project path is set and if yes then open
|
||||||
|
@ -268,34 +273,43 @@ func file_menu_id_pressed(id : int) -> void:
|
||||||
if Global.project_has_changed:
|
if Global.project_has_changed:
|
||||||
unsaved_canvas_state = id
|
unsaved_canvas_state = id
|
||||||
$UnsavedCanvasDialog.popup_centered()
|
$UnsavedCanvasDialog.popup_centered()
|
||||||
|
Global.can_draw = false
|
||||||
|
modulate = Color(0.5, 0.5, 0.5)
|
||||||
else:
|
else:
|
||||||
load_last_project()
|
load_last_project()
|
||||||
else: # if not then warn user that he didn't edit any project yet
|
else: # if not then warn user that he didn't edit any project yet
|
||||||
$NoProjectEditedOrCreatedAlertDialog.popup_centered()
|
$NoProjectEditedOrCreatedAlertDialog.popup_centered()
|
||||||
|
Global.can_draw = false
|
||||||
|
modulate = Color(0.5, 0.5, 0.5)
|
||||||
3: # Save
|
3: # Save
|
||||||
is_quitting_on_save = false
|
is_quitting_on_save = false
|
||||||
if OpenSave.current_save_path == "":
|
if OpenSave.current_save_path == "":
|
||||||
$SaveSprite.popup_centered()
|
$SaveSprite.popup_centered()
|
||||||
Global.can_draw = false
|
Global.can_draw = false
|
||||||
|
modulate = Color(0.5, 0.5, 0.5)
|
||||||
else:
|
else:
|
||||||
_on_SaveSprite_file_selected(OpenSave.current_save_path)
|
_on_SaveSprite_file_selected(OpenSave.current_save_path)
|
||||||
4: # Save as
|
4: # Save as
|
||||||
is_quitting_on_save = false
|
is_quitting_on_save = false
|
||||||
$SaveSprite.popup_centered()
|
$SaveSprite.popup_centered()
|
||||||
Global.can_draw = false
|
Global.can_draw = false
|
||||||
|
modulate = Color(0.5, 0.5, 0.5)
|
||||||
5: # Import
|
5: # Import
|
||||||
$ImportSprites.popup_centered()
|
$ImportSprites.popup_centered()
|
||||||
Global.can_draw = false
|
Global.can_draw = false
|
||||||
|
modulate = Color(0.5, 0.5, 0.5)
|
||||||
opensprite_file_selected = false
|
opensprite_file_selected = false
|
||||||
6: # Export
|
6: # Export
|
||||||
if $ExportDialog.was_exported == false:
|
if $ExportDialog.was_exported == false:
|
||||||
$ExportDialog.popup_centered()
|
$ExportDialog.popup_centered()
|
||||||
Global.can_draw = false
|
Global.can_draw = false
|
||||||
|
modulate = Color(0.5, 0.5, 0.5)
|
||||||
else:
|
else:
|
||||||
$ExportDialog.external_export()
|
$ExportDialog.external_export()
|
||||||
7: # Export as
|
7: # Export as
|
||||||
$ExportDialog.popup_centered()
|
$ExportDialog.popup_centered()
|
||||||
Global.can_draw = false
|
Global.can_draw = false
|
||||||
|
modulate = Color(0.5, 0.5, 0.5)
|
||||||
8: # Quit
|
8: # Quit
|
||||||
show_quit_dialog()
|
show_quit_dialog()
|
||||||
|
|
||||||
|
@ -319,6 +333,7 @@ func edit_menu_id_pressed(id : int) -> void:
|
||||||
3: # Preferences
|
3: # Preferences
|
||||||
$PreferencesDialog.popup_centered(Vector2(400, 280))
|
$PreferencesDialog.popup_centered(Vector2(400, 280))
|
||||||
Global.can_draw = false
|
Global.can_draw = false
|
||||||
|
modulate = Color(0.5, 0.5, 0.5)
|
||||||
|
|
||||||
|
|
||||||
func view_menu_id_pressed(id : int) -> void:
|
func view_menu_id_pressed(id : int) -> void:
|
||||||
|
@ -356,6 +371,7 @@ func image_menu_id_pressed(id : int) -> void:
|
||||||
0: # Scale Image
|
0: # Scale Image
|
||||||
$ScaleImage.popup_centered()
|
$ScaleImage.popup_centered()
|
||||||
Global.can_draw = false
|
Global.can_draw = false
|
||||||
|
modulate = Color(0.5, 0.5, 0.5)
|
||||||
1: # Crop Image
|
1: # Crop Image
|
||||||
# Use first layer as a starting rectangle
|
# Use first layer as a starting rectangle
|
||||||
var used_rect : Rect2 = Global.canvas.layers[0][0].get_used_rect()
|
var used_rect : Rect2 = Global.canvas.layers[0][0].get_used_rect()
|
||||||
|
@ -408,6 +424,7 @@ func image_menu_id_pressed(id : int) -> void:
|
||||||
$RotateImage.set_sprite(image)
|
$RotateImage.set_sprite(image)
|
||||||
$RotateImage.popup_centered()
|
$RotateImage.popup_centered()
|
||||||
Global.can_draw = false
|
Global.can_draw = false
|
||||||
|
modulate = Color(0.5, 0.5, 0.5)
|
||||||
5: # Invert Colors
|
5: # Invert Colors
|
||||||
var image : Image = Global.canvas.layers[Global.current_layer][0]
|
var image : Image = Global.canvas.layers[Global.current_layer][0]
|
||||||
Global.canvas.handle_undo("Draw")
|
Global.canvas.handle_undo("Draw")
|
||||||
|
@ -433,9 +450,11 @@ func image_menu_id_pressed(id : int) -> void:
|
||||||
7: # Outline
|
7: # Outline
|
||||||
$OutlineDialog.popup_centered()
|
$OutlineDialog.popup_centered()
|
||||||
Global.can_draw = false
|
Global.can_draw = false
|
||||||
|
modulate = Color(0.5, 0.5, 0.5)
|
||||||
8: # HSV
|
8: # HSV
|
||||||
$HSVDialog.popup_centered()
|
$HSVDialog.popup_centered()
|
||||||
Global.can_draw = false
|
Global.can_draw = false
|
||||||
|
modulate = Color(0.5, 0.5, 0.5)
|
||||||
|
|
||||||
|
|
||||||
func help_menu_id_pressed(id : int) -> void:
|
func help_menu_id_pressed(id : int) -> void:
|
||||||
|
@ -443,6 +462,7 @@ func help_menu_id_pressed(id : int) -> void:
|
||||||
0: # Splash Screen
|
0: # Splash Screen
|
||||||
$SplashDialog.popup_centered()
|
$SplashDialog.popup_centered()
|
||||||
Global.can_draw = false
|
Global.can_draw = false
|
||||||
|
modulate = Color(0.5, 0.5, 0.5)
|
||||||
1: # Issue Tracker
|
1: # Issue Tracker
|
||||||
OS.shell_open("https://github.com/Orama-Interactive/Pixelorama/issues")
|
OS.shell_open("https://github.com/Orama-Interactive/Pixelorama/issues")
|
||||||
2: # Changelog
|
2: # Changelog
|
||||||
|
@ -450,6 +470,7 @@ func help_menu_id_pressed(id : int) -> void:
|
||||||
3: # About Pixelorama
|
3: # About Pixelorama
|
||||||
$AboutDialog.popup_centered()
|
$AboutDialog.popup_centered()
|
||||||
Global.can_draw = false
|
Global.can_draw = false
|
||||||
|
modulate = Color(0.5, 0.5, 0.5)
|
||||||
|
|
||||||
|
|
||||||
func load_last_project() -> void:
|
func load_last_project() -> void:
|
||||||
|
@ -463,11 +484,15 @@ func load_last_project() -> void:
|
||||||
else:
|
else:
|
||||||
# If file doesn't exist on disk then warn user about this
|
# If file doesn't exist on disk then warn user about this
|
||||||
$OpenLastProjectAlertDialog.popup_centered()
|
$OpenLastProjectAlertDialog.popup_centered()
|
||||||
|
Global.can_draw = false
|
||||||
|
modulate = Color(0.5, 0.5, 0.5)
|
||||||
|
|
||||||
|
|
||||||
func _on_UnsavedCanvasDialog_confirmed() -> void:
|
func _on_UnsavedCanvasDialog_confirmed() -> void:
|
||||||
if unsaved_canvas_state == 0: # New image
|
if unsaved_canvas_state == 0: # New image
|
||||||
$CreateNewImage.popup_centered()
|
$CreateNewImage.popup_centered()
|
||||||
|
Global.can_draw = false
|
||||||
|
modulate = Color(0.5, 0.5, 0.5)
|
||||||
elif unsaved_canvas_state == 2: # Open last project
|
elif unsaved_canvas_state == 2: # Open last project
|
||||||
load_last_project()
|
load_last_project()
|
||||||
|
|
||||||
|
@ -504,6 +529,7 @@ func _on_SaveSprite_file_selected(path : String) -> void:
|
||||||
func _on_ImportSprites_popup_hide() -> void:
|
func _on_ImportSprites_popup_hide() -> void:
|
||||||
if !opensprite_file_selected:
|
if !opensprite_file_selected:
|
||||||
Global.can_draw = true
|
Global.can_draw = true
|
||||||
|
modulate = Color.white
|
||||||
|
|
||||||
|
|
||||||
func _on_ViewportContainer_mouse_entered() -> void:
|
func _on_ViewportContainer_mouse_entered() -> void:
|
||||||
|
@ -516,6 +542,7 @@ func _on_ViewportContainer_mouse_exited() -> void:
|
||||||
|
|
||||||
func _can_draw_true() -> void:
|
func _can_draw_true() -> void:
|
||||||
Global.can_draw = true
|
Global.can_draw = true
|
||||||
|
modulate = Color.white
|
||||||
|
|
||||||
|
|
||||||
func _can_draw_false() -> void:
|
func _can_draw_false() -> void:
|
||||||
|
@ -823,6 +850,7 @@ func show_quit_dialog() -> void:
|
||||||
$QuitAndSaveDialog.call_deferred("popup_centered")
|
$QuitAndSaveDialog.call_deferred("popup_centered")
|
||||||
|
|
||||||
Global.can_draw = false
|
Global.can_draw = false
|
||||||
|
modulate = Color(0.5, 0.5, 0.5)
|
||||||
|
|
||||||
|
|
||||||
func _on_QuitAndSaveDialog_custom_action(action : String) -> void:
|
func _on_QuitAndSaveDialog_custom_action(action : String) -> void:
|
||||||
|
@ -831,6 +859,7 @@ func _on_QuitAndSaveDialog_custom_action(action : String) -> void:
|
||||||
$SaveSprite.popup_centered()
|
$SaveSprite.popup_centered()
|
||||||
$QuitDialog.hide()
|
$QuitDialog.hide()
|
||||||
Global.can_draw = false
|
Global.can_draw = false
|
||||||
|
modulate = Color(0.5, 0.5, 0.5)
|
||||||
OpenSave.remove_backup()
|
OpenSave.remove_backup()
|
||||||
|
|
||||||
|
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -26,6 +26,7 @@ func open(palette : String) -> void:
|
||||||
_display_palette()
|
_display_palette()
|
||||||
Global.can_draw = false
|
Global.can_draw = false
|
||||||
self.popup_centered()
|
self.popup_centered()
|
||||||
|
Global.control.modulate = Color(0.5, 0.5, 0.5)
|
||||||
|
|
||||||
left_color_button.modulate = Global.left_color_picker.color
|
left_color_button.modulate = Global.left_color_picker.color
|
||||||
right_color_button.modulate = Global.right_color_picker.color
|
right_color_button.modulate = Global.right_color_picker.color
|
||||||
|
@ -188,3 +189,4 @@ func _on_RightColor_pressed() -> void:
|
||||||
|
|
||||||
func _on_EditPalettePopup_popup_hide() -> void:
|
func _on_EditPalettePopup_popup_hide() -> void:
|
||||||
Global.can_draw = true
|
Global.can_draw = true
|
||||||
|
Global.control.modulate = Color.white
|
||||||
|
|
|
@ -37,11 +37,13 @@ func on_new_empty_palette() -> void:
|
||||||
from_palette = null
|
from_palette = null
|
||||||
Global.new_palette_dialog.popup_centered()
|
Global.new_palette_dialog.popup_centered()
|
||||||
Global.can_draw = false
|
Global.can_draw = false
|
||||||
|
Global.control.modulate = Color(0.5, 0.5, 0.5)
|
||||||
|
|
||||||
|
|
||||||
func on_import_palette() -> void:
|
func on_import_palette() -> void:
|
||||||
Global.palette_import_file_dialog.popup_centered()
|
Global.palette_import_file_dialog.popup_centered()
|
||||||
Global.can_draw = false
|
Global.can_draw = false
|
||||||
|
Global.control.modulate = Color(0.5, 0.5, 0.5)
|
||||||
|
|
||||||
|
|
||||||
func on_palette_import_file_selected(path : String) -> void:
|
func on_palette_import_file_selected(path : String) -> void:
|
||||||
|
@ -65,9 +67,13 @@ func on_palette_import_file_selected(path : String) -> void:
|
||||||
else:
|
else:
|
||||||
Global.error_dialog.set_text(tr("Error: Palette named '%s' already exists!") % palette.name)
|
Global.error_dialog.set_text(tr("Error: Palette named '%s' already exists!") % palette.name)
|
||||||
Global.error_dialog.popup_centered()
|
Global.error_dialog.popup_centered()
|
||||||
|
Global.can_draw = false
|
||||||
|
Global.control.modulate = Color(0.5, 0.5, 0.5)
|
||||||
else:
|
else:
|
||||||
Global.error_dialog.set_text("Invalid Palette file!")
|
Global.error_dialog.set_text("Invalid Palette file!")
|
||||||
Global.error_dialog.popup_centered()
|
Global.error_dialog.popup_centered()
|
||||||
|
Global.can_draw = false
|
||||||
|
Global.control.modulate = Color(0.5, 0.5, 0.5)
|
||||||
|
|
||||||
|
|
||||||
func _on_AddPalette_pressed() -> void:
|
func _on_AddPalette_pressed() -> void:
|
||||||
|
@ -80,6 +86,8 @@ func on_new_palette_confirmed() -> void:
|
||||||
if not result.empty():
|
if not result.empty():
|
||||||
Global.error_dialog.set_text(result)
|
Global.error_dialog.set_text(result)
|
||||||
Global.error_dialog.popup_centered()
|
Global.error_dialog.popup_centered()
|
||||||
|
Global.can_draw = false
|
||||||
|
Global.control.modulate = Color(0.5, 0.5, 0.5)
|
||||||
|
|
||||||
|
|
||||||
func add_palette_menu_id_pressed(id : int) -> void:
|
func add_palette_menu_id_pressed(id : int) -> void:
|
||||||
|
@ -132,6 +140,7 @@ func on_edit_palette() -> void:
|
||||||
Global.new_palette_name_line_edit.text = "Custom_" + current_palette
|
Global.new_palette_name_line_edit.text = "Custom_" + current_palette
|
||||||
Global.new_palette_dialog.popup_centered()
|
Global.new_palette_dialog.popup_centered()
|
||||||
Global.can_draw = false
|
Global.can_draw = false
|
||||||
|
Global.control.modulate = Color(0.5, 0.5, 0.5)
|
||||||
else:
|
else:
|
||||||
from_palette = null
|
from_palette = null
|
||||||
Global.edit_palette_popup.open(current_palette)
|
Global.edit_palette_popup.open(current_palette)
|
||||||
|
@ -270,3 +279,4 @@ func save_palette(palette_name : String, filename : String) -> void:
|
||||||
|
|
||||||
func _on_NewPaletteDialog_popup_hide() -> void:
|
func _on_NewPaletteDialog_popup_hide() -> void:
|
||||||
Global.can_draw = true
|
Global.can_draw = true
|
||||||
|
Global.control.modulate = Color.white
|
||||||
|
|
|
@ -16,6 +16,7 @@ func _ready() -> void:
|
||||||
|
|
||||||
func _on_FrameTagDialog_about_to_show() -> void:
|
func _on_FrameTagDialog_about_to_show() -> void:
|
||||||
Global.can_draw = false
|
Global.can_draw = false
|
||||||
|
Global.control.modulate = Color(0.5, 0.5, 0.5)
|
||||||
for vbox in tag_vboxes:
|
for vbox in tag_vboxes:
|
||||||
vbox.queue_free()
|
vbox.queue_free()
|
||||||
tag_vboxes.clear()
|
tag_vboxes.clear()
|
||||||
|
@ -58,6 +59,7 @@ func _on_FrameTagDialog_about_to_show() -> void:
|
||||||
|
|
||||||
func _on_FrameTagDialog_popup_hide() -> void:
|
func _on_FrameTagDialog_popup_hide() -> void:
|
||||||
Global.can_draw = true
|
Global.can_draw = true
|
||||||
|
Global.control.modulate = Color.white
|
||||||
|
|
||||||
|
|
||||||
func _on_AddTag_pressed() -> void:
|
func _on_AddTag_pressed() -> void:
|
||||||
|
|
|
@ -52,6 +52,8 @@ func _on_ImportSprites_files_selected(paths : PoolStringArray) -> void:
|
||||||
var file_name : String = path.get_file()
|
var file_name : String = path.get_file()
|
||||||
Global.error_dialog.set_text(tr("Can't load file '%s'.\nError code: %s") % [file_name, str(err)])
|
Global.error_dialog.set_text(tr("Can't load file '%s'.\nError code: %s") % [file_name, str(err)])
|
||||||
Global.error_dialog.popup_centered()
|
Global.error_dialog.popup_centered()
|
||||||
|
Global.can_draw = false
|
||||||
|
Global.control.modulate = Color(0.5, 0.5, 0.5)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
var canvas : Canvas = load("res://src/Canvas.tscn").instance()
|
var canvas : Canvas = load("res://src/Canvas.tscn").instance()
|
||||||
|
@ -98,6 +100,8 @@ func _on_ImportSprites_files_selected(paths : PoolStringArray) -> void:
|
||||||
var file_name : String = first_path.get_file()
|
var file_name : String = first_path.get_file()
|
||||||
Global.error_dialog.set_text(tr("Can't load file '%s'.\nError code: %s") % [file_name, str(err)])
|
Global.error_dialog.set_text(tr("Can't load file '%s'.\nError code: %s") % [file_name, str(err)])
|
||||||
Global.error_dialog.popup_centered()
|
Global.error_dialog.popup_centered()
|
||||||
|
Global.can_draw = false
|
||||||
|
Global.control.modulate = Color(0.5, 0.5, 0.5)
|
||||||
return
|
return
|
||||||
|
|
||||||
spritesheet_horizontal = min(spritesheet_horizontal, image.get_size().x)
|
spritesheet_horizontal = min(spritesheet_horizontal, image.get_size().x)
|
||||||
|
|
Loading…
Reference in a new issue