Compare commits
6
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
228b4dd694 | ||
|
|
320b572134 | ||
|
|
bbe9440ee7 | ||
|
|
36a258dcd8 | ||
|
|
ee7bec9595 | ||
|
|
891b3295c0 |
No files matched your search
@@ -28,6 +28,7 @@ Configure the addon from its Debugger panel. Settings are stored at `settings.cf
|
||||
|
||||
- **Shutter sounds**: Whether to play shutter sound effect
|
||||
- **Input Action**: Set an Input Action to trigger a screenshot
|
||||
- **Input Show/Hide shutter**: Easily show or hide the shutter with an action
|
||||
|
||||
### Resolution
|
||||
- Specify one or more target sizes. The addon calls `DisplayServer.window_set_size()` for each size before capturing.
|
||||
|
||||
@@ -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,24 @@ 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)
|
||||
|
||||
|
||||
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()
|
||||
|
||||
@@ -119,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:
|
||||
@@ -145,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:
|
||||
@@ -170,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
|
||||
@@ -187,3 +198,4 @@ func get_unique_filepath(base_path: String) -> String:
|
||||
new_path = "%s/%s_%d.%s" % [dir, filename, counter, extension]
|
||||
|
||||
return new_path
|
||||
|
||||
@@ -37,7 +37,7 @@ grow_vertical = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
script = ExtResource("1_7ct7k")
|
||||
nodes_to_save = [NodePath("HSplitContainer/VBoxContainer/ScrollContainer/Settings/Shutter/VBoxContainer/HBoxContainer4/PausesGameCheckBox"), NodePath("HSplitContainer/VBoxContainer/ScrollContainer/Settings/Shutter/VBoxContainer/HBoxContainer2/ShowShutterCheckBox"), NodePath("HSplitContainer/VBoxContainer/ScrollContainer/Settings/Shutter/VBoxContainer/HBoxContainer3/ShutterSoundsCheckBox"), NodePath("HSplitContainer/VBoxContainer/ScrollContainer/Settings/Shutter/VBoxContainer/HBoxContainer/InputActionLineEdit"), NodePath("HSplitContainer/VBoxContainer/ScrollContainer/Settings/SaveFolder/VBoxContainer/FormatsContainers/PNGCheckBox"), NodePath("HSplitContainer/VBoxContainer/ScrollContainer/Settings/SaveFolder/VBoxContainer/FormatsContainers/JPGCheckBox"), NodePath("HSplitContainer/VBoxContainer/ScrollContainer/Settings/SaveFolder/VBoxContainer/FormatsContainers/WEBPCheckBox"), NodePath("HSplitContainer/VBoxContainer/ScrollContainer/Settings/SaveFolder/VBoxContainer/HBoxContainer/PathLineEdit"), NodePath("HSplitContainer/VBoxContainer/ScrollContainer/Settings/SaveFolder/VBoxContainer/HBoxContainer2/UseSubFoldersCheckBox"), NodePath("HSplitContainer/VBoxContainer/ScrollContainer/Settings/Shutter/VBoxContainer/HBoxContainer5/OnlyRunInEditorCheckBox")]
|
||||
nodes_to_save = [NodePath("HSplitContainer/VBoxContainer/ScrollContainer/Settings/Shutter/VBoxContainer/HBoxContainer4/PausesGameCheckBox"), NodePath("HSplitContainer/VBoxContainer/ScrollContainer/Settings/Shutter/VBoxContainer/HBoxContainer2/ShowShutterCheckBox"), NodePath("HSplitContainer/VBoxContainer/ScrollContainer/Settings/Shutter/VBoxContainer/HBoxContainer3/ShutterSoundsCheckBox"), NodePath("HSplitContainer/VBoxContainer/ScrollContainer/Settings/Shutter/VBoxContainer/HBoxContainer/InputActionLineEdit"), NodePath("HSplitContainer/VBoxContainer/ScrollContainer/Settings/Shutter/VBoxContainer/HBoxContainer6/ToggleShutterInputActionLineEdit"), NodePath("HSplitContainer/VBoxContainer/ScrollContainer/Settings/SaveFolder/VBoxContainer/FormatsContainers/PNGCheckBox"), NodePath("HSplitContainer/VBoxContainer/ScrollContainer/Settings/SaveFolder/VBoxContainer/FormatsContainers/JPGCheckBox"), NodePath("HSplitContainer/VBoxContainer/ScrollContainer/Settings/SaveFolder/VBoxContainer/FormatsContainers/WEBPCheckBox"), NodePath("HSplitContainer/VBoxContainer/ScrollContainer/Settings/SaveFolder/VBoxContainer/HBoxContainer/PathLineEdit"), NodePath("HSplitContainer/VBoxContainer/ScrollContainer/Settings/SaveFolder/VBoxContainer/HBoxContainer2/UseSubFoldersCheckBox"), NodePath("HSplitContainer/VBoxContainer/ScrollContainer/Settings/Shutter/VBoxContainer/HBoxContainer5/OnlyRunInEditorCheckBox")]
|
||||
|
||||
[node name="LocalData" type="Node" parent="."]
|
||||
unique_name_in_owner = true
|
||||
@@ -170,6 +170,21 @@ unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="HBoxContainer6" type="HBoxContainer" parent="HSplitContainer/VBoxContainer/ScrollContainer/Settings/Shutter/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="HSplitContainer/VBoxContainer/ScrollContainer/Settings/Shutter/VBoxContainer/HBoxContainer6"]
|
||||
custom_minimum_size = Vector2(250, 0)
|
||||
layout_mode = 2
|
||||
tooltip_text = "Set an Input Action to show/hide the shutter from anywhere, including the Play window, even while it's hidden"
|
||||
mouse_filter = 1
|
||||
text = "Input Show/Hide Shutter"
|
||||
|
||||
[node name="ToggleShutterInputActionLineEdit" type="LineEdit" parent="HSplitContainer/VBoxContainer/ScrollContainer/Settings/Shutter/VBoxContainer/HBoxContainer6"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="Resolution" type="FoldableContainer" parent="HSplitContainer/VBoxContainer/ScrollContainer/Settings" node_paths=PackedStringArray("sizes_container")]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
|
||||
@@ -3,5 +3,5 @@
|
||||
name="Screenshots"
|
||||
description="Takes screenshots of all sizes and locales with a single click."
|
||||
author="Davide Di Staso"
|
||||
version="1.2"
|
||||
version="1.3"
|
||||
script="plugin.gd"
|
||||
Reference in new issue
Block a user