Merge pull request #61 from Calinou/dim-ui-when-exiting

Dim the UI when exiting the application
This commit is contained in:
Rodz Labs 2020-01-16 23:09:26 +01:00 committed by GitHub
commit ae102030b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -298,6 +298,7 @@ func quit() -> void:
if Engine.editor_hint: if Engine.editor_hint:
emit_signal("quit") emit_signal("quit")
else: else:
dim_window()
get_tree().quit() get_tree().quit()
func edit_cut() -> void: func edit_cut() -> void:
@ -527,6 +528,16 @@ func _exit_tree() -> void:
config_cache.set_value("window", "size", OS.window_size) config_cache.set_value("window", "size", OS.window_size)
config_cache.save("user://cache.ini") config_cache.save("user://cache.ini")
func _notification(what : int) -> void:
if !Engine.editor_hint:
if what == MainLoop.NOTIFICATION_WM_QUIT_REQUEST:
dim_window()
func dim_window() -> void:
# Darken the UI to denote that the application is currently exiting
# (it won't respond to user input in this state).
modulate = Color(0.5, 0.5, 0.5)
func show_background_preview(button_pressed): func show_background_preview(button_pressed):
$VBoxContainer/HBoxContainer/ProjectsPane/Preview3D.visible = button_pressed $VBoxContainer/HBoxContainer/ProjectsPane/Preview3D.visible = button_pressed
$VBoxContainer/HBoxContainer/ProjectsPane/HBoxContainer/HBoxContainer.visible = button_pressed $VBoxContainer/HBoxContainer/ProjectsPane/HBoxContainer/HBoxContainer.visible = button_pressed