Disabled window position/size save/restore in tool mode

This commit is contained in:
RodZill4 2019-11-22 07:48:14 +01:00
parent 8650a5ae40
commit 2e06e9db9a

View File

@ -59,17 +59,19 @@ var is_mac = false
func _ready() -> void:
# Restore the window position/size if values are present in the configuration cache
config_cache.load("user://cache.ini")
if Engine.editor_hint:
set_process_input(false)
else:
if config_cache.has_section_key("window", "screen"):
OS.current_screen = config_cache.get_value("window", "screen")
if config_cache.has_section_key("window", "maximized"):
OS.window_maximized = config_cache.get_value("window", "maximized")
if config_cache.has_section_key("window", "screen"):
OS.current_screen = config_cache.get_value("window", "screen")
if config_cache.has_section_key("window", "maximized"):
OS.window_maximized = config_cache.get_value("window", "maximized")
if !OS.window_maximized:
if config_cache.has_section_key("window", "position"):
OS.window_position = config_cache.get_value("window", "position")
if config_cache.has_section_key("window", "size"):
OS.window_size = config_cache.get_value("window", "size")
if !OS.window_maximized:
if config_cache.has_section_key("window", "position"):
OS.window_position = config_cache.get_value("window", "position")
if config_cache.has_section_key("window", "size"):
OS.window_size = config_cache.get_value("window", "size")
if OS.get_name() == "OSX":
is_mac = true
@ -515,8 +517,9 @@ func _on_Preview_show_background_preview(v) -> void:
func _exit_tree() -> void:
# Save the window position and size to remember it when restarting the application
config_cache.set_value("window", "screen", OS.current_screen)
config_cache.set_value("window", "maximized", OS.window_maximized || OS.window_fullscreen)
config_cache.set_value("window", "position", OS.window_position)
config_cache.set_value("window", "size", OS.window_size)
config_cache.save("user://cache.ini")
if !Engine.editor_hint:
config_cache.set_value("window", "screen", OS.current_screen)
config_cache.set_value("window", "maximized", OS.window_maximized || OS.window_fullscreen)
config_cache.set_value("window", "position", OS.window_position)
config_cache.set_value("window", "size", OS.window_size)
config_cache.save("user://cache.ini")