From 891b3295c0feaac57388cdff8e9a9acfffdebf77 Mon Sep 17 00:00:00 2001 From: stilobique Date: Thu, 5 Nov 2026 11:46:27 +0100 Subject: [PATCH] Add global show/hide toggle for the Shutter window Reads a new ToggleShutterInputActionLineEdit setting and checks it in _process() with Input.is_action_just_pressed() instead of _input(), since the Shutter is its own native Window: its _input() only fires while it has OS focus, and stops entirely once hidden. Input's action state is global to the process, so this lets the configured key show the Shutter again from the main Play window. --- .../autoload/shutter_window/shutter_window.gd | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/addons/screenshots/autoload/shutter_window/shutter_window.gd b/addons/screenshots/autoload/shutter_window/shutter_window.gd index 34fff1a..d908618 100644 --- a/addons/screenshots/autoload/shutter_window/shutter_window.gd +++ b/addons/screenshots/autoload/shutter_window/shutter_window.gd @@ -13,6 +13,7 @@ signal image_captured(image: Image) signal burst_ended var _input_action: String +var _toggle_shutter_action: String func _ready() -> void: @@ -25,14 +26,29 @@ func _ready() -> void: if only_run_in_editor and not OS.has_feature("editor"): set_process_input(false) + set_process(false) hide() return _input_action = _local_data.settings.load_value("misc", "InputActionLineEdit", "") + _toggle_shutter_action = _local_data.settings.load_value("misc", "ToggleShutterInputActionLineEdit", "") %ShutterButton.pressed.connect(take_burst) close_requested.connect(_on_close_requested) +## Checked every frame (not via _input) because the shutter is its own native +## Window: once hidden, it stops receiving OS input entirely, and its _input() +## only ever fires while it has OS focus anyway. Input.is_action_just_pressed +## reflects global key state for the whole process, so this lets the toggle be +## pressed from the main Play window even while the shutter is hidden. +func _process(_delta: float) -> void: + if _toggle_shutter_action.is_empty() or not InputMap.has_action(_toggle_shutter_action): + return + if Input.is_action_just_pressed(_toggle_shutter_action): + visible = not visible + _local_data.settings.save("misc", "ShowShutterCheckBox", visible) + + func _on_close_requested() -> void: hide()