mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-01-18 17:19:50 +00:00
Added a Tween to make the background UI darker when a dialog is opened
This commit is contained in:
parent
51b6aadbdd
commit
7484ce1b9e
|
@ -44,7 +44,8 @@ sapient-cogbag, Kinwailo, Igor Santarek (jegor377), Dávid Gábor BODOR (dragonf
|
|||
- LineEdits lose focus when the user presses Enter.
|
||||
- When cloning a frame, the clone will appear next to the original.
|
||||
- Layer visibility is taken into account when exporting the drawing as a `.png` file. This means that invisible layers will not be included in the final `.png` file.
|
||||
- The Godot theme has changed.
|
||||
- The Godot theme has changed and been renamed to Blue. The Gold theme has also been renamed to Caramel.
|
||||
- When a dialog is opened, the UI in the background gets darker.
|
||||
- Visual change, added border outlines to all window dialogs.
|
||||
- Animation now loops by default.
|
||||
- Onion skinning settings have been moved to a popup window, and 2 new buttons were added. One that toggles onion skinning, and one that opens the settings window.
|
||||
|
|
|
@ -691,6 +691,17 @@ func layer_changed(value : int) -> void:
|
|||
self.current_frame = current_frame # Call frame_changed to update UI
|
||||
|
||||
|
||||
func dialog_open(open : bool) -> void:
|
||||
if open:
|
||||
can_draw = false
|
||||
control.get_node("ModulateTween").interpolate_property(control, "modulate", control.modulate, Color(0.5, 0.5, 0.5), 0.1, Tween.TRANS_LINEAR, Tween.EASE_OUT)
|
||||
else:
|
||||
can_draw = true
|
||||
control.get_node("ModulateTween").interpolate_property(control, "modulate", control.modulate, Color.white, 0.1, Tween.TRANS_LINEAR, Tween.EASE_OUT)
|
||||
|
||||
control.get_node("ModulateTween").start()
|
||||
|
||||
|
||||
func disable_button(button : BaseButton, disable : bool) -> void:
|
||||
button.disabled = disable
|
||||
if disable:
|
||||
|
|
67
src/Main.gd
67
src/Main.gd
|
@ -193,7 +193,6 @@ func _ready() -> void:
|
|||
var backup_path = Global.config_cache.get_value("backups", project_paths[0])
|
||||
# Temporatily stop autosave until user confirms backup
|
||||
OpenSave.autosave_timer.stop()
|
||||
Global.can_draw = false
|
||||
# For it's only possible to reload the first found backup
|
||||
$BackupConfirmation.dialog_text = tr($BackupConfirmation.dialog_text) % project_paths[0]
|
||||
$BackupConfirmation.connect("confirmed", self, "_on_BackupConfirmation_confirmed", [project_paths[0], backup_path])
|
||||
|
@ -260,12 +259,10 @@ func file_menu_id_pressed(id : int) -> void:
|
|||
$UnsavedCanvasDialog.popup_centered()
|
||||
else:
|
||||
$CreateNewImage.popup_centered()
|
||||
Global.can_draw = false
|
||||
modulate = Color(0.5, 0.5, 0.5)
|
||||
Global.dialog_open(true)
|
||||
1: # Open
|
||||
$OpenSprite.popup_centered()
|
||||
Global.can_draw = false
|
||||
modulate = Color(0.5, 0.5, 0.5)
|
||||
Global.dialog_open(true)
|
||||
opensprite_file_selected = false
|
||||
2: # Open last project
|
||||
# Check if last project path is set and if yes then open
|
||||
|
@ -273,43 +270,36 @@ func file_menu_id_pressed(id : int) -> void:
|
|||
if Global.project_has_changed:
|
||||
unsaved_canvas_state = id
|
||||
$UnsavedCanvasDialog.popup_centered()
|
||||
Global.can_draw = false
|
||||
modulate = Color(0.5, 0.5, 0.5)
|
||||
Global.dialog_open(true)
|
||||
else:
|
||||
load_last_project()
|
||||
else: # if not then warn user that he didn't edit any project yet
|
||||
$NoProjectEditedOrCreatedAlertDialog.popup_centered()
|
||||
Global.can_draw = false
|
||||
modulate = Color(0.5, 0.5, 0.5)
|
||||
Global.dialog_open(true)
|
||||
3: # Save
|
||||
is_quitting_on_save = false
|
||||
if OpenSave.current_save_path == "":
|
||||
$SaveSprite.popup_centered()
|
||||
Global.can_draw = false
|
||||
modulate = Color(0.5, 0.5, 0.5)
|
||||
Global.dialog_open(true)
|
||||
else:
|
||||
_on_SaveSprite_file_selected(OpenSave.current_save_path)
|
||||
4: # Save as
|
||||
is_quitting_on_save = false
|
||||
$SaveSprite.popup_centered()
|
||||
Global.can_draw = false
|
||||
modulate = Color(0.5, 0.5, 0.5)
|
||||
Global.dialog_open(true)
|
||||
5: # Import
|
||||
$ImportSprites.popup_centered()
|
||||
Global.can_draw = false
|
||||
modulate = Color(0.5, 0.5, 0.5)
|
||||
Global.dialog_open(true)
|
||||
opensprite_file_selected = false
|
||||
6: # Export
|
||||
if $ExportDialog.was_exported == false:
|
||||
$ExportDialog.popup_centered()
|
||||
Global.can_draw = false
|
||||
modulate = Color(0.5, 0.5, 0.5)
|
||||
Global.dialog_open(true)
|
||||
else:
|
||||
$ExportDialog.external_export()
|
||||
7: # Export as
|
||||
$ExportDialog.popup_centered()
|
||||
Global.can_draw = false
|
||||
modulate = Color(0.5, 0.5, 0.5)
|
||||
Global.dialog_open(true)
|
||||
8: # Quit
|
||||
show_quit_dialog()
|
||||
|
||||
|
@ -332,8 +322,7 @@ func edit_menu_id_pressed(id : int) -> void:
|
|||
Global.canvas.handle_redo("Rectangle Select")
|
||||
3: # Preferences
|
||||
$PreferencesDialog.popup_centered(Vector2(400, 280))
|
||||
Global.can_draw = false
|
||||
modulate = Color(0.5, 0.5, 0.5)
|
||||
Global.dialog_open(true)
|
||||
|
||||
|
||||
func view_menu_id_pressed(id : int) -> void:
|
||||
|
@ -370,8 +359,7 @@ func image_menu_id_pressed(id : int) -> void:
|
|||
match id:
|
||||
0: # Scale Image
|
||||
$ScaleImage.popup_centered()
|
||||
Global.can_draw = false
|
||||
modulate = Color(0.5, 0.5, 0.5)
|
||||
Global.dialog_open(true)
|
||||
1: # Crop Image
|
||||
# Use first layer as a starting rectangle
|
||||
var used_rect : Rect2 = Global.canvas.layers[0][0].get_used_rect()
|
||||
|
@ -423,8 +411,7 @@ func image_menu_id_pressed(id : int) -> void:
|
|||
var image : Image = Global.canvas.layers[Global.current_layer][0]
|
||||
$RotateImage.set_sprite(image)
|
||||
$RotateImage.popup_centered()
|
||||
Global.can_draw = false
|
||||
modulate = Color(0.5, 0.5, 0.5)
|
||||
Global.dialog_open(true)
|
||||
5: # Invert Colors
|
||||
var image : Image = Global.canvas.layers[Global.current_layer][0]
|
||||
Global.canvas.handle_undo("Draw")
|
||||
|
@ -449,28 +436,24 @@ func image_menu_id_pressed(id : int) -> void:
|
|||
Global.canvas.handle_redo("Draw")
|
||||
7: # Outline
|
||||
$OutlineDialog.popup_centered()
|
||||
Global.can_draw = false
|
||||
modulate = Color(0.5, 0.5, 0.5)
|
||||
Global.dialog_open(true)
|
||||
8: # HSV
|
||||
$HSVDialog.popup_centered()
|
||||
Global.can_draw = false
|
||||
modulate = Color(0.5, 0.5, 0.5)
|
||||
Global.dialog_open(true)
|
||||
|
||||
|
||||
func help_menu_id_pressed(id : int) -> void:
|
||||
match id:
|
||||
0: # Splash Screen
|
||||
$SplashDialog.popup_centered()
|
||||
Global.can_draw = false
|
||||
modulate = Color(0.5, 0.5, 0.5)
|
||||
Global.dialog_open(true)
|
||||
1: # Issue Tracker
|
||||
OS.shell_open("https://github.com/Orama-Interactive/Pixelorama/issues")
|
||||
2: # Changelog
|
||||
OS.shell_open("https://github.com/Orama-Interactive/Pixelorama/blob/master/Changelog.md#v07---unreleased")
|
||||
3: # About Pixelorama
|
||||
$AboutDialog.popup_centered()
|
||||
Global.can_draw = false
|
||||
modulate = Color(0.5, 0.5, 0.5)
|
||||
Global.dialog_open(true)
|
||||
|
||||
|
||||
func load_last_project() -> void:
|
||||
|
@ -484,15 +467,13 @@ func load_last_project() -> void:
|
|||
else:
|
||||
# If file doesn't exist on disk then warn user about this
|
||||
$OpenLastProjectAlertDialog.popup_centered()
|
||||
Global.can_draw = false
|
||||
modulate = Color(0.5, 0.5, 0.5)
|
||||
Global.dialog_open(true)
|
||||
|
||||
|
||||
func _on_UnsavedCanvasDialog_confirmed() -> void:
|
||||
if unsaved_canvas_state == 0: # New image
|
||||
$CreateNewImage.popup_centered()
|
||||
Global.can_draw = false
|
||||
modulate = Color(0.5, 0.5, 0.5)
|
||||
Global.dialog_open(true)
|
||||
elif unsaved_canvas_state == 2: # Open last project
|
||||
load_last_project()
|
||||
|
||||
|
@ -528,8 +509,7 @@ func _on_SaveSprite_file_selected(path : String) -> void:
|
|||
|
||||
func _on_ImportSprites_popup_hide() -> void:
|
||||
if !opensprite_file_selected:
|
||||
Global.can_draw = true
|
||||
modulate = Color.white
|
||||
_can_draw_true()
|
||||
|
||||
|
||||
func _on_ViewportContainer_mouse_entered() -> void:
|
||||
|
@ -541,8 +521,7 @@ func _on_ViewportContainer_mouse_exited() -> void:
|
|||
|
||||
|
||||
func _can_draw_true() -> void:
|
||||
Global.can_draw = true
|
||||
modulate = Color.white
|
||||
Global.dialog_open(false)
|
||||
|
||||
|
||||
func _can_draw_false() -> void:
|
||||
|
@ -849,8 +828,7 @@ func show_quit_dialog() -> void:
|
|||
else:
|
||||
$QuitAndSaveDialog.call_deferred("popup_centered")
|
||||
|
||||
Global.can_draw = false
|
||||
modulate = Color(0.5, 0.5, 0.5)
|
||||
Global.dialog_open(true)
|
||||
|
||||
|
||||
func _on_QuitAndSaveDialog_custom_action(action : String) -> void:
|
||||
|
@ -858,8 +836,7 @@ func _on_QuitAndSaveDialog_custom_action(action : String) -> void:
|
|||
is_quitting_on_save = true
|
||||
$SaveSprite.popup_centered()
|
||||
$QuitDialog.hide()
|
||||
Global.can_draw = false
|
||||
modulate = Color(0.5, 0.5, 0.5)
|
||||
Global.dialog_open(true)
|
||||
OpenSave.remove_backup()
|
||||
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -24,9 +24,8 @@ func open(palette : String) -> void:
|
|||
if Global.palettes.has(palette):
|
||||
working_palette = Global.palettes[palette].duplicate()
|
||||
_display_palette()
|
||||
Global.can_draw = false
|
||||
self.popup_centered()
|
||||
Global.control.modulate = Color(0.5, 0.5, 0.5)
|
||||
Global.dialog_open(true)
|
||||
|
||||
left_color_button.modulate = Global.left_color_picker.color
|
||||
right_color_button.modulate = Global.right_color_picker.color
|
||||
|
@ -188,5 +187,4 @@ func _on_RightColor_pressed() -> void:
|
|||
|
||||
|
||||
func _on_EditPalettePopup_popup_hide() -> void:
|
||||
Global.can_draw = true
|
||||
Global.control.modulate = Color.white
|
||||
Global.dialog_open(false)
|
||||
|
|
|
@ -36,14 +36,12 @@ func on_new_empty_palette() -> void:
|
|||
Global.new_palette_name_line_edit.text = "Custom_Palette"
|
||||
from_palette = null
|
||||
Global.new_palette_dialog.popup_centered()
|
||||
Global.can_draw = false
|
||||
Global.control.modulate = Color(0.5, 0.5, 0.5)
|
||||
Global.dialog_open(true)
|
||||
|
||||
|
||||
func on_import_palette() -> void:
|
||||
Global.palette_import_file_dialog.popup_centered()
|
||||
Global.can_draw = false
|
||||
Global.control.modulate = Color(0.5, 0.5, 0.5)
|
||||
Global.dialog_open(true)
|
||||
|
||||
|
||||
func on_palette_import_file_selected(path : String) -> void:
|
||||
|
@ -67,13 +65,11 @@ func on_palette_import_file_selected(path : String) -> void:
|
|||
else:
|
||||
Global.error_dialog.set_text(tr("Error: Palette named '%s' already exists!") % palette.name)
|
||||
Global.error_dialog.popup_centered()
|
||||
Global.can_draw = false
|
||||
Global.control.modulate = Color(0.5, 0.5, 0.5)
|
||||
Global.dialog_open(true)
|
||||
else:
|
||||
Global.error_dialog.set_text("Invalid Palette file!")
|
||||
Global.error_dialog.popup_centered()
|
||||
Global.can_draw = false
|
||||
Global.control.modulate = Color(0.5, 0.5, 0.5)
|
||||
Global.dialog_open(true)
|
||||
|
||||
|
||||
func _on_AddPalette_pressed() -> void:
|
||||
|
@ -86,8 +82,7 @@ func on_new_palette_confirmed() -> void:
|
|||
if not result.empty():
|
||||
Global.error_dialog.set_text(result)
|
||||
Global.error_dialog.popup_centered()
|
||||
Global.can_draw = false
|
||||
Global.control.modulate = Color(0.5, 0.5, 0.5)
|
||||
Global.dialog_open(true)
|
||||
|
||||
|
||||
func add_palette_menu_id_pressed(id : int) -> void:
|
||||
|
@ -139,8 +134,7 @@ func on_edit_palette() -> void:
|
|||
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()
|
||||
Global.can_draw = false
|
||||
Global.control.modulate = Color(0.5, 0.5, 0.5)
|
||||
Global.dialog_open(true)
|
||||
else:
|
||||
from_palette = null
|
||||
Global.edit_palette_popup.open(current_palette)
|
||||
|
@ -278,5 +272,4 @@ func save_palette(palette_name : String, filename : String) -> void:
|
|||
|
||||
|
||||
func _on_NewPaletteDialog_popup_hide() -> void:
|
||||
Global.can_draw = true
|
||||
Global.control.modulate = Color.white
|
||||
Global.dialog_open(false)
|
||||
|
|
|
@ -15,8 +15,7 @@ func _ready() -> void:
|
|||
|
||||
|
||||
func _on_FrameTagDialog_about_to_show() -> void:
|
||||
Global.can_draw = false
|
||||
Global.control.modulate = Color(0.5, 0.5, 0.5)
|
||||
Global.dialog_open(true)
|
||||
for vbox in tag_vboxes:
|
||||
vbox.queue_free()
|
||||
tag_vboxes.clear()
|
||||
|
@ -58,8 +57,7 @@ func _on_FrameTagDialog_about_to_show() -> void:
|
|||
|
||||
|
||||
func _on_FrameTagDialog_popup_hide() -> void:
|
||||
Global.can_draw = true
|
||||
Global.control.modulate = Color.white
|
||||
Global.dialog_open(false)
|
||||
|
||||
|
||||
func _on_AddTag_pressed() -> void:
|
||||
|
|
|
@ -52,8 +52,7 @@ func _on_ImportSprites_files_selected(paths : PoolStringArray) -> void:
|
|||
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.popup_centered()
|
||||
Global.can_draw = false
|
||||
Global.control.modulate = Color(0.5, 0.5, 0.5)
|
||||
Global.dialog_open(true)
|
||||
continue
|
||||
|
||||
var canvas : Canvas = load("res://src/Canvas.tscn").instance()
|
||||
|
@ -100,8 +99,7 @@ func _on_ImportSprites_files_selected(paths : PoolStringArray) -> void:
|
|||
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.popup_centered()
|
||||
Global.can_draw = false
|
||||
Global.control.modulate = Color(0.5, 0.5, 0.5)
|
||||
Global.dialog_open(true)
|
||||
return
|
||||
|
||||
spritesheet_horizontal = min(spritesheet_horizontal, image.get_size().x)
|
||||
|
|
Loading…
Reference in a new issue