Revert clean code

This commit is contained in:
stilobique committed 2026-11-05 14:46:23 +01:00
1 parent 320b572134
commit 228b4dd694
1 file changed
+4 -8
@@ -36,11 +36,6 @@ func _ready() -> void:
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
@@ -135,7 +130,8 @@ func save_image() -> void:
var timestamp = Time.get_time_string_from_system()
var play_shutter_sounds = _local_data.settings.load_value("misc", "ShutterSoundsCheckBox", true)
# Save the screenshot
var image = get_tree().root.get_viewport().get_texture().get_image()
# var image = get_tree().root.get_viewport().get_texture().get_image()
var image = get_parent().get_viewport().get_texture().get_image()
image_captured.emit(image)
if play_shutter_sounds:
@@ -161,7 +157,7 @@ func save_image() -> void:
var formats = {
"PNGCheckBox": ["png", image.save_png, true],
"JPGCheckBox": ["jpg", image.save_jpg, false],
"WEBPCheckBox": ["webp", image.save_webp, false],
"WEBPCheckBox": ["webp", image.save_webp, false]
}
for setting_key in formats:
@@ -186,7 +182,6 @@ func save_image() -> void:
print_rich("[Screenshots] Saved at: [url=%s]%s[/url]" % [ProjectSettings.globalize_path(file_path.get_base_dir()), file_path])
func get_unique_filepath(base_path: String) -> String:
if not FileAccess.file_exists(base_path):
return base_path
@@ -203,3 +198,4 @@ func get_unique_filepath(base_path: String) -> String:
new_path = "%s/%s_%d.%s" % [dir, filename, counter, extension]
return new_path