23 Commits
Author SHA1 Message Date
stilobique ee7bec9595 Add UI field for the shutter toggle Input Action
New "Toggle shutter Input Action" LineEdit in the Shutter settings
section, same pattern as the existing "Input Action" field for the
burst trigger. Writes/reads ToggleShutterInputActionLineEdit, which
shutter_window.gd already reads.
2026-11-05 13:31:21 +01:00
stilobique 891b3295c0 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.
2026-11-05 11:46:27 +01:00
treepumpkin 22c364f2bd Added support for different stretch modes 2025-10-22 15:47:19 +02:00
treepumpkin 3ec4b5786f Code formatted using GDQuest's formatter 2025-10-17 20:11:59 +02:00
Davide Di Staso fefb1a5bf0 Update README.md 2025-10-13 22:17:29 +02:00
Davide Di Staso cd32302dcd Ensure a default size is present 2025-10-13 21:50:22 +02:00
treepumpkin 371178c7fb Bump plugin version 2025-10-13 08:00:01 +02:00
Davide Di Staso 9505df1405 Change folder structure of the ZIP
Create Release / release (push) Successful in 21s
2025-10-12 22:28:47 +02:00
Davide Di Staso 49603fa133 Added tooltips 2025-10-12 22:25:24 +02:00
Davide Di Staso 70dc914845 Create icon.png.import 2025-10-12 22:17:20 +02:00
Davide Di Staso cc2a3d7344 Do not queue_free when not in Editor 2025-10-12 22:17:11 +02:00
Davide Di Staso a27585a8ae Added DirectoryWatcher license 2025-10-11 19:00:52 +02:00
Davide Di Staso d4e568f17c Added PNG for AssetLib 2025-10-11 16:49:50 +02:00
Davide Di Staso eaa3c39b11 Minor fixes
Create Release / release (push) Successful in 27s
2025-10-11 16:26:03 +02:00
Davide Di Staso 71ba8eadb4 Update release.yml 2025-10-11 16:13:42 +02:00
Davide Di Staso 61dda6fa0d Bumped plugin version 2025-10-11 16:11:17 +02:00
Davide Di Staso 0da38fde76 Added extension to LICENSE 2025-10-11 16:11:10 +02:00
Davide Di Staso f65ad365c5 Added GitHub action 2025-10-11 16:10:58 +02:00
Davide Di Staso 94d8dc96b7 Removed unused %s from string 2025-10-11 16:00:48 +02:00
Davide Di Staso 3775bd00e1 Fixes issue with "none" locale 2025-10-11 13:21:28 +02:00
Davide Di Staso 78c925d372 Camera roll previews queued free on file deletion 2025-10-11 12:40:39 +02:00
Davide Di Staso d25aae8428 Use _disable_plugin() to remove the singleton 2025-10-11 12:14:37 +02:00
Davide Di Staso 7233a3ca4d Various improvements
- Improved performance by only sending the file path to the debugger
- By default, shutter window will queue free if not running in the Editor
- Remember shutter window position
- Do not remember camera roll
2025-10-11 12:12:48 +02:00
23 changed files with 608 additions and 175 deletions

No files matched your search

+53
View File
@@ -0,0 +1,53 @@
name: Create Release
on:
push:
tags:
- 'v*.*' # Triggers on version tags like v1.0
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Get version from tag
id: get_version
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
- name: Get version without dots
id: version_no_dots
run: echo "VERSION_NO_DOTS=$(echo '${{ steps.get_version.outputs.VERSION }}' | tr -d '.')" >> $GITHUB_OUTPUT
- name: Get tag message
id: tag_message
run: |
git fetch --depth=1 origin +refs/tags/*:refs/tags/*
echo "MESSAGE<<EOF" >> $GITHUB_OUTPUT
git tag -l --format='%(contents)' ${GITHUB_REF#refs/tags/} >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Create release directory
run: mkdir -p release_temp/godot-screenshots-${{ steps.version_no_dots.outputs.VERSION_NO_DOTS }}/addons/screenshots
- name: Copy plugin files
run: |
cp -r addons/screenshots/* release_temp/godot-screenshots-${{ steps.version_no_dots.outputs.VERSION_NO_DOTS }}/addons/screenshots/
cp LICENSE.md release_temp/godot-screenshots-${{ steps.version_no_dots.outputs.VERSION_NO_DOTS }}/addons/screenshots/
- name: Create ZIP archive
run: |
cd release_temp
zip -r ../godot-screenshots-${{ steps.get_version.outputs.VERSION }}.zip godot-screenshots-${{ steps.version_no_dots.outputs.VERSION_NO_DOTS }}
cd ..
- name: Create Release
uses: softprops/action-gh-release@v1
with:
files: godot-screenshots-${{ steps.get_version.outputs.VERSION }}.zip
body: ${{ steps.tag_message.outputs.MESSAGE }}
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+1
View File
@@ -9,4 +9,5 @@
/addons/kenyoni/plugin_reloader /addons/kenyoni/plugin_reloader
/addons/explore-editor-theme /addons/explore-editor-theme
/addons/GDQuest_GDScript_formatter
addons/screenshots/settings.cfg addons/screenshots/settings.cfg
View File
File renamed without changes.
+15 -6
View File
@@ -10,7 +10,7 @@ Godot addon that lets you rapidly take screenshots. Supports taking bursts in mu
</p> </p>
## Installation ## Installation
- Download the latest release and paste it into your Godot project - Download the addon from [AssetLib](https://godotengine.org/asset-library/asset/4405) within the Godot Editor
- Enable the addon in the Project Settings - Enable the addon in the Project Settings
## Usage ## Usage
@@ -22,11 +22,12 @@ Godot addon that lets you rapidly take screenshots. Supports taking bursts in mu
## Configuration ## Configuration
Configure the addon from its Debugger panel. Settings are stored at `settings.cfg`. Configure the addon from its Debugger panel. Settings are stored at `settings.cfg`.
### Shutter ### Shutter
- **Pauses game**: Pause execution while taking screenshots. Useful for ensuring consistency across burst captures.
- **Show shutter**: Toggle shutter visibility - **Show shutter**: Toggle shutter visibility
- **Only run in Editor**: If the game is running outside the editor (`OS.has_feature("editor")` is `false`), hide the shutter and disable input processing
- **Pauses game**: Pause execution while taking screenshots. Useful for ensuring consistency across burst captures.
- **Shutter sounds**: Whether to play shutter sound effect - **Shutter sounds**: Whether to play shutter sound effect
- **Input Action**: Configure keyboard shortcut - **Input Action**: Set an Input Action to trigger a screenshot
### Resolution ### Resolution
- Specify one or more target sizes. The addon calls `DisplayServer.window_set_size()` for each size before capturing. - Specify one or more target sizes. The addon calls `DisplayServer.window_set_size()` for each size before capturing.
@@ -37,7 +38,7 @@ Configure the addon from its Debugger panel. Settings are stored at `settings.cf
### Save ### Save
- **Path**: Screenshot save location (default: `user://screenshots`) - **Path**: Screenshot save location (default: `user://screenshots`)
- **Formats**: PNG, JPG, WEBP - **Formats**: PNG, JPG, WEBP
- **Use subfolders**: Organize bursts into folders with this structure `$PROJECTNAME_$TIMESTAMP/$LOCALE/$RESOLUTION` - **Use subfolders**: Organize bursts into folders with this structure `projectname_timestamp/locale/resolution`
## API ## API
Accessible through the `Screenshots` singleton. Accessible through the `Screenshots` singleton.
@@ -64,14 +65,22 @@ burst_ended
``` ```
Fires after the burst is completed. Use it to unhide debug UI elements. Fires after the burst is completed. Use it to unhide debug UI elements.
#### Example
```gdscript
func _ready() -> void:
Screenshots.burst_starting.connect(_hide_debug_ui)
Screenshots.burst_ended.connect(_show_debug_ui)
```
## Version Compatibility ## Version Compatibility
Tested on Godot 4.5 (Linux and macOS) Tested on Godot 4.5 (Linux and macOS)
## Support ## Support
Questions? Email hello@pumpkintree.games For bugs and feature requests, please open an issue. Additional questions? Email [hello@pumpkintree.games](mailto:hello@pumpkintree.games)
## Credits ## Credits
- Developed by [Davide Di Staso](http://www.pumpkintree.games) - Developed by [Davide Di Staso](http://www.pumpkintree.games)
- Uses [Directory Watcher](https://github.com/KoBeWi/Godot-Directory-Watcher) by Tomek
- Screenshots addon icon based on modified Godot Editor icons - Screenshots addon icon based on modified Godot Editor icons
- Shutter icon by [Bootstrap](https://github.com/twbs/icons) - Shutter icon by [Bootstrap](https://github.com/twbs/icons)
- Shutter sound effect by [ALEXIS_GAMING_CAM](https://pixabay.com/users/alexis_gaming_cam-50011695/) from [Pixabay](https://pixabay.com/) - Shutter sound effect by [ALEXIS_GAMING_CAM](https://pixabay.com/users/alexis_gaming_cam-50011695/) from [Pixabay](https://pixabay.com/)
@@ -1,5 +1,4 @@
extends Window extends Window
## Godot addon that lets you rapidly take screenshots. Supports taking bursts in multiple resolutions, locales, and formats. ## Godot addon that lets you rapidly take screenshots. Supports taking bursts in multiple resolutions, locales, and formats.
@export var _local_data: Node @export var _local_data: Node
@@ -14,29 +13,75 @@ signal image_captured(image: Image)
signal burst_ended signal burst_ended
var _input_action: String var _input_action: String
var _toggle_shutter_action: String
func _ready() -> void: func _ready() -> void:
var saved_position = _local_data.settings.load_value("misc", "ShutterWindowPosition")
if saved_position:
position = saved_position
old_position = position
var only_run_in_editor = _local_data.settings.load_value("misc", "OnlyRunInEditorCheckBox", true)
visible = _local_data.settings.load_value("misc", "ShowShutterCheckBox", true) visible = _local_data.settings.load_value("misc", "ShowShutterCheckBox", true)
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", "") _input_action = _local_data.settings.load_value("misc", "InputActionLineEdit", "")
_toggle_shutter_action = _local_data.settings.load_value("misc", "ToggleShutterInputActionLineEdit", "")
%ShutterButton.pressed.connect(take_burst) %ShutterButton.pressed.connect(take_burst)
close_requested.connect(_on_close_requested) 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: func _on_close_requested() -> void:
hide() hide()
var old_position: Vector2i
func _input(event: InputEvent) -> void: func _input(event: InputEvent) -> void:
if old_position != position:
_local_data.settings.save("misc", "ShutterWindowPosition", position)
old_position = position
if not InputMap.has_action(_input_action): if not InputMap.has_action(_input_action):
return return
if event.is_action_pressed(_input_action): if event.is_action_pressed(_input_action):
take_burst() take_burst()
## Takes one or more screenshots (a burst) using settings specified in the Debugger panel ## Takes one or more screenshots (a burst) using settings specified in the Debugger panel
func take_burst() -> void: func take_burst() -> void:
var old_position = position
_local_data.settings.load_config() _local_data.settings.load_config()
burst_starting.emit() burst_starting.emit()
var stretch_mode = get_tree().root.content_scale_mode
var is_embedded = Engine.is_embedded_in_editor()
var pause_game = _local_data.settings.load_value("misc", "PausesGameCheckBox", true) var pause_game = _local_data.settings.load_value("misc", "PausesGameCheckBox", true)
var shutter_was_visible = visible var shutter_was_visible = visible
var sizes = _local_data.settings.load_value("misc", "Sizes", [])
var def_width = ProjectSettings.get_setting("display/window/size/viewport_width")
var def_height = ProjectSettings.get_setting("display/window/size/viewport_height")
var sizes = _local_data.settings.load_value("misc", "Sizes", [Vector2i(def_width, def_height)])
var locales = _local_data.settings.load_value("misc", "Locales", ["none"]) var locales = _local_data.settings.load_value("misc", "Locales", ["none"])
var previous_locale = TranslationServer.get_locale() var previous_locale = TranslationServer.get_locale()
hide() hide()
@@ -46,37 +91,115 @@ func take_burst() -> void:
if pause_game: if pause_game:
tree.paused = true tree.paused = true
var prev_size = DisplayServer.window_get_size() var prev_size = DisplayServer.window_get_size()
var timestamp = Time.get_time_string_from_system()
if stretch_mode == CONTENT_SCALE_MODE_VIEWPORT:
prev_size = get_tree().root.get_viewport().content_scale_size
# Take screenshots for each configured size # Take screenshots for each configured size
for s in sizes: for s in sizes:
DisplayServer.window_set_size(s) set_resolution(s, stretch_mode)
await get_tree().create_timer(0.01).timeout await RenderingServer.frame_post_draw
for locale in locales: for locale in locales:
if not locale == "none": var locale_to_set = locale
TranslationServer.set_locale(locale)
await get_tree().process_frame
_send_viewport_texture_to_debugger(timestamp, TranslationServer.get_locale()) if locale == "none":
locale_to_set = previous_locale
TranslationServer.set_locale(locale_to_set)
await RenderingServer.frame_post_draw
save_image()
TranslationServer.set_locale(previous_locale) TranslationServer.set_locale(previous_locale)
DisplayServer.window_set_size(prev_size) set_resolution(prev_size, stretch_mode)
# Print clickable paths
print_rich("[color=green][Screenshots] Done! (%s)[/color]" % timestamp)
tree.paused = game_was_paused tree.paused = game_was_paused
visible = shutter_was_visible visible = shutter_was_visible
burst_ended.emit() burst_ended.emit()
print_rich("[color=green][Screenshots] Done![/color]")
position = old_position
func _send_viewport_texture_to_debugger(timestamp: String, locale: String) -> void: func set_resolution(resolution: Vector2i, stretch_mode: ContentScaleMode) -> void:
var screen_resolution = DisplayServer.screen_get_size()
match stretch_mode:
CONTENT_SCALE_MODE_VIEWPORT:
get_tree().root.get_viewport().content_scale_size = resolution
_:
if resolution > screen_resolution:
print_rich("[color=yellow][Screenshots] Warning! You are trying to take a screenshot at %dx%d, but your screen size is %dx%d" % [resolution.x, resolution.y, screen_resolution.x, screen_resolution.y])
print("[color=yellow][Screenshots] To take a screenshot larger than your screen size, use the 'viewport' stretch mode (Project Settings > Stretch > Mode)")
DisplayServer.window_set_size(resolution)
func save_image() -> void:
var locale = TranslationServer.get_locale()
var timestamp = Time.get_time_string_from_system()
var play_shutter_sounds = _local_data.settings.load_value("misc", "ShutterSoundsCheckBox", true) var play_shutter_sounds = _local_data.settings.load_value("misc", "ShutterSoundsCheckBox", true)
# Save the screenshot # Save the screenshot
var image = get_parent().get_viewport().get_texture().get_image() var image = get_tree().root.get_viewport().get_texture().get_image()
EngineDebugger.send_message("screenshot:take", [image.save_png_to_buffer(), timestamp, locale])
image_captured.emit(image) image_captured.emit(image)
if play_shutter_sounds: if play_shutter_sounds:
%AudioStreamPlayer.play() %AudioStreamPlayer.play()
var save_folder: String = _local_data.settings.load_value("misc", "PathLineEdit", "user://screenshots")
var project_title = ProjectSettings.get_setting("application/config/name")
var screenshot_size = image.get_size()
# Build the save path with optional subfolders
var target_folder = save_folder
if _local_data.settings.load_value("misc", "UseSubFoldersCheckBox", false):
# Create subfolder structure: Project_timestamp/locale/resolution
var timestamp_folder = "%s_%s" % [project_title, timestamp.replace(":", "-")]
var locale_folder = locale
var resolution_folder = "%dx%d" % [screenshot_size.x, screenshot_size.y]
target_folder = save_folder.path_join(timestamp_folder).path_join(locale_folder).path_join(resolution_folder)
# Ensure target folder exists
if not DirAccess.dir_exists_absolute(target_folder):
DirAccess.make_dir_recursive_absolute(target_folder)
var formats = {
"PNGCheckBox": ["png", image.save_png, true],
"JPGCheckBox": ["jpg", image.save_jpg, false],
"WEBPCheckBox": ["webp", image.save_webp, false],
}
for setting_key in formats:
var default = formats[setting_key][2]
if _local_data.settings.load_value("misc", setting_key, default):
var extension = formats[setting_key][0]
var save_method = formats[setting_key][1]
var filename: String
if _local_data.settings.load_value("misc", "UseSubFoldersCheckBox", false):
filename = "%s_%s" % [project_title, timestamp.replace(":", "-")]
else:
filename = "%s_%s_%s_%dx%d" % [project_title, timestamp.replace(":", "-"), locale, screenshot_size.x, screenshot_size.y]
var file_path = target_folder.path_join("%s.%s" % [filename, extension])
# Get unique filepath to avoid overwriting
file_path = get_unique_filepath(file_path)
save_method.call(file_path)
EngineDebugger.send_message("screenshot:taken", [file_path, timestamp, locale])
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
var dir = base_path.get_base_dir()
var filename = base_path.get_file().get_basename()
var extension = base_path.get_extension()
var counter = 1
var new_path = "%s/%s_%d.%s" % [dir, filename, counter, extension]
while FileAccess.file_exists(new_path):
counter += 1
new_path = "%s/%s_%d.%s" % [dir, filename, counter, extension]
return new_path
@@ -3,10 +3,12 @@ extends Control
@export var nodes_to_save: Array[Node] @export var nodes_to_save: Array[Node]
func _ready() -> void: func _ready() -> void:
load_nodes_from_config(nodes_to_save) load_nodes_from_config(nodes_to_save)
setup_auto_save(nodes_to_save) setup_auto_save(nodes_to_save)
func save_nodes_to_config(p_nodes_to_save: Array[Node]) -> void: func save_nodes_to_config(p_nodes_to_save: Array[Node]) -> void:
for node in p_nodes_to_save: for node in p_nodes_to_save:
var key = node.name var key = node.name
@@ -20,6 +22,7 @@ func save_nodes_to_config(p_nodes_to_save: Array[Node]) -> void:
value = node.text value = node.text
%LocalData.settings.save("misc", key, value) %LocalData.settings.save("misc", key, value)
func load_nodes_from_config(p_nodes_to_load: Array[Node]) -> void: func load_nodes_from_config(p_nodes_to_load: Array[Node]) -> void:
for node in p_nodes_to_load: for node in p_nodes_to_load:
var value = %LocalData.settings.load_value("misc", node.name) var value = %LocalData.settings.load_value("misc", node.name)
@@ -30,6 +33,7 @@ func load_nodes_from_config(p_nodes_to_load: Array[Node]) -> void:
if node is LineEdit: if node is LineEdit:
node.text = value node.text = value
func setup_auto_save(nodes: Array[Node]) -> void: func setup_auto_save(nodes: Array[Node]) -> void:
for node in nodes: for node in nodes:
if node is CheckBox: if node is CheckBox:
@@ -37,15 +41,13 @@ func setup_auto_save(nodes: Array[Node]) -> void:
if node is LineEdit: if node is LineEdit:
node.text_changed.connect(func(_new_text): save_nodes_to_config([node])) node.text_changed.connect(func(_new_text): save_nodes_to_config([node]))
func on_session_started() -> void: func on_session_started() -> void:
pass pass
func on_editor_debugger_plugin_capture(p_message, p_data) -> bool: func on_editor_debugger_plugin_capture(p_message, p_data) -> bool:
if p_message == "screenshot:take": if p_message == "screenshot:taken":
var buffer: PackedByteArray = p_data[0] %CameraRoll.add_preview(p_data[0], p_data[1], p_data[2])
var img := Image.new()
var err := img.load_png_from_buffer(buffer)
if err == OK:
%CameraRoll.save_image(img, p_data[1], p_data[2])
return true return true
return false return false
@@ -1,4 +1,4 @@
[gd_scene load_steps=11 format=3 uid="uid://b2ktx6dty0dq4"] [gd_scene load_steps=12 format=3 uid="uid://b2ktx6dty0dq4"]
[ext_resource type="Script" uid="uid://culd18vnvt4ej" path="res://addons/screenshots/debugger/bottom_panel/bottom_panel.gd" id="1_7ct7k"] [ext_resource type="Script" uid="uid://culd18vnvt4ej" path="res://addons/screenshots/debugger/bottom_panel/bottom_panel.gd" id="1_7ct7k"]
[ext_resource type="Script" uid="uid://bq5amyoktrfo4" path="res://addons/screenshots/debugger/bottom_panel/settings.gd" id="2_ivg3g"] [ext_resource type="Script" uid="uid://bq5amyoktrfo4" path="res://addons/screenshots/debugger/bottom_panel/settings.gd" id="2_ivg3g"]
@@ -6,14 +6,15 @@
[ext_resource type="Script" uid="uid://c034i367kogf6" path="res://addons/screenshots/debugger/bottom_panel/locales.gd" id="6_m7syr"] [ext_resource type="Script" uid="uid://c034i367kogf6" path="res://addons/screenshots/debugger/bottom_panel/locales.gd" id="6_m7syr"]
[ext_resource type="Script" uid="uid://jfpjg1put47h" path="res://addons/screenshots/debugger/bottom_panel/save_folder.gd" id="7_q2ypf"] [ext_resource type="Script" uid="uid://jfpjg1put47h" path="res://addons/screenshots/debugger/bottom_panel/save_folder.gd" id="7_q2ypf"]
[ext_resource type="Script" uid="uid://cvvxb0tom0wc" path="res://addons/screenshots/debugger/bottom_panel/camera_roll.gd" id="8_6oft3"] [ext_resource type="Script" uid="uid://cvvxb0tom0wc" path="res://addons/screenshots/debugger/bottom_panel/camera_roll.gd" id="8_6oft3"]
[ext_resource type="Script" uid="uid://x5sotkduu1be" path="res://addons/screenshots/debugger/bottom_panel/directory_watcher.gd" id="8_2337e"]
[ext_resource type="Script" uid="uid://c5poruw4iu2ve" path="res://addons/screenshots/debugger/bottom_panel/camera_roll_bottom_buttons.gd" id="8_epjix"] [ext_resource type="Script" uid="uid://c5poruw4iu2ve" path="res://addons/screenshots/debugger/bottom_panel/camera_roll_bottom_buttons.gd" id="8_epjix"]
[ext_resource type="Script" uid="uid://cx82rfmwl8gk0" path="res://addons/screenshots/screenshots_local_data.gd" id="9_ke0xa"] [ext_resource type="Script" uid="uid://cx82rfmwl8gk0" path="res://addons/screenshots/screenshots_local_data.gd" id="9_ke0xa"]
[sub_resource type="DPITexture" id="DPITexture_q8tfr"] [sub_resource type="DPITexture" id="DPITexture_2337e"]
_source = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\"><path fill=\"#ff5d5d\" d=\"M2 1v8.586l1.293-1.293a1 1 0 0 1 1.414 0L7 10.587l2.293-2.293a1 1 0 0 1 1.414 0L13 10.586l1-1V6H9V1H2zm8 0v4h4zm-6 9.414-2 2V15h12v-2.586l-.293.293a1 1 0 0 1-1.414 0L10 10.414l-2.293 2.293a1 1 0 0 1-1.414 0L4 10.414z\"/></svg> _source = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\"><path fill=\"#ff5d5d\" d=\"M2 1v8.586l1.293-1.293a1 1 0 0 1 1.414 0L7 10.587l2.293-2.293a1 1 0 0 1 1.414 0L13 10.586l1-1V6H9V1H2zm8 0v4h4zm-6 9.414-2 2V15h12v-2.586l-.293.293a1 1 0 0 1-1.414 0L10 10.414l-2.293 2.293a1 1 0 0 1-1.414 0L4 10.414z\"/></svg>
" "
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_2337e"] [sub_resource type="StyleBoxFlat" id="StyleBoxFlat_ua4ux"]
content_margin_left = 4.0 content_margin_left = 4.0
content_margin_top = 4.0 content_margin_top = 4.0
content_margin_right = 4.0 content_margin_right = 4.0
@@ -36,7 +37,7 @@ grow_vertical = 2
size_flags_horizontal = 3 size_flags_horizontal = 3
size_flags_vertical = 3 size_flags_vertical = 3
script = ExtResource("1_7ct7k") 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")] 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="."] [node name="LocalData" type="Node" parent="."]
unique_name_in_owner = true unique_name_in_owner = true
@@ -63,7 +64,7 @@ alignment = 1
[node name="SettingsIcon" type="TextureRect" parent="HSplitContainer/VBoxContainer/PanelContainer/HBoxContainer"] [node name="SettingsIcon" type="TextureRect" parent="HSplitContainer/VBoxContainer/PanelContainer/HBoxContainer"]
unique_name_in_owner = true unique_name_in_owner = true
layout_mode = 2 layout_mode = 2
texture = SubResource("DPITexture_q8tfr") texture = SubResource("DPITexture_2337e")
stretch_mode = 3 stretch_mode = 3
[node name="Label" type="Label" parent="HSplitContainer/VBoxContainer/PanelContainer/HBoxContainer"] [node name="Label" type="Label" parent="HSplitContainer/VBoxContainer/PanelContainer/HBoxContainer"]
@@ -92,26 +93,14 @@ title = "Shutter"
visible = false visible = false
layout_mode = 2 layout_mode = 2
[node name="HBoxContainer4" type="HBoxContainer" parent="HSplitContainer/VBoxContainer/ScrollContainer/Settings/Shutter/VBoxContainer"]
layout_mode = 2
[node name="Label" type="Label" parent="HSplitContainer/VBoxContainer/ScrollContainer/Settings/Shutter/VBoxContainer/HBoxContainer4"]
custom_minimum_size = Vector2(250, 0)
layout_mode = 2
text = "Pauses game"
[node name="PausesGameCheckBox" type="CheckBox" parent="HSplitContainer/VBoxContainer/ScrollContainer/Settings/Shutter/VBoxContainer/HBoxContainer4"]
unique_name_in_owner = true
layout_mode = 2
button_pressed = true
text = "On"
[node name="HBoxContainer2" type="HBoxContainer" parent="HSplitContainer/VBoxContainer/ScrollContainer/Settings/Shutter/VBoxContainer"] [node name="HBoxContainer2" type="HBoxContainer" parent="HSplitContainer/VBoxContainer/ScrollContainer/Settings/Shutter/VBoxContainer"]
layout_mode = 2 layout_mode = 2
[node name="Label" type="Label" parent="HSplitContainer/VBoxContainer/ScrollContainer/Settings/Shutter/VBoxContainer/HBoxContainer2"] [node name="Label" type="Label" parent="HSplitContainer/VBoxContainer/ScrollContainer/Settings/Shutter/VBoxContainer/HBoxContainer2"]
custom_minimum_size = Vector2(250, 0) custom_minimum_size = Vector2(250, 0)
layout_mode = 2 layout_mode = 2
tooltip_text = "Toggle shutter visibility"
mouse_filter = 1
text = "Show shutter" text = "Show shutter"
[node name="ShowShutterCheckBox" type="CheckBox" parent="HSplitContainer/VBoxContainer/ScrollContainer/Settings/Shutter/VBoxContainer/HBoxContainer2"] [node name="ShowShutterCheckBox" type="CheckBox" parent="HSplitContainer/VBoxContainer/ScrollContainer/Settings/Shutter/VBoxContainer/HBoxContainer2"]
@@ -120,12 +109,45 @@ layout_mode = 2
button_pressed = true button_pressed = true
text = "On" text = "On"
[node name="HBoxContainer5" type="HBoxContainer" parent="HSplitContainer/VBoxContainer/ScrollContainer/Settings/Shutter/VBoxContainer"]
layout_mode = 2
[node name="Label" type="Label" parent="HSplitContainer/VBoxContainer/ScrollContainer/Settings/Shutter/VBoxContainer/HBoxContainer5"]
custom_minimum_size = Vector2(250, 0)
layout_mode = 2
tooltip_text = "If the game is running outside the editor, hide the shutter and disable input processing"
mouse_filter = 1
text = "Only run in Editor"
[node name="OnlyRunInEditorCheckBox" type="CheckBox" parent="HSplitContainer/VBoxContainer/ScrollContainer/Settings/Shutter/VBoxContainer/HBoxContainer5"]
layout_mode = 2
button_pressed = true
text = "On"
[node name="HBoxContainer4" type="HBoxContainer" parent="HSplitContainer/VBoxContainer/ScrollContainer/Settings/Shutter/VBoxContainer"]
layout_mode = 2
[node name="Label" type="Label" parent="HSplitContainer/VBoxContainer/ScrollContainer/Settings/Shutter/VBoxContainer/HBoxContainer4"]
custom_minimum_size = Vector2(250, 0)
layout_mode = 2
tooltip_text = "Pause execution while taking screenshots. Useful for ensuring consistency across burst captures."
mouse_filter = 1
text = "Pauses game"
[node name="PausesGameCheckBox" type="CheckBox" parent="HSplitContainer/VBoxContainer/ScrollContainer/Settings/Shutter/VBoxContainer/HBoxContainer4"]
unique_name_in_owner = true
layout_mode = 2
button_pressed = true
text = "On"
[node name="HBoxContainer3" type="HBoxContainer" parent="HSplitContainer/VBoxContainer/ScrollContainer/Settings/Shutter/VBoxContainer"] [node name="HBoxContainer3" type="HBoxContainer" parent="HSplitContainer/VBoxContainer/ScrollContainer/Settings/Shutter/VBoxContainer"]
layout_mode = 2 layout_mode = 2
[node name="Label" type="Label" parent="HSplitContainer/VBoxContainer/ScrollContainer/Settings/Shutter/VBoxContainer/HBoxContainer3"] [node name="Label" type="Label" parent="HSplitContainer/VBoxContainer/ScrollContainer/Settings/Shutter/VBoxContainer/HBoxContainer3"]
custom_minimum_size = Vector2(250, 0) custom_minimum_size = Vector2(250, 0)
layout_mode = 2 layout_mode = 2
tooltip_text = "Whether to play shutter sound effect"
mouse_filter = 1
text = "Shutter sounds" text = "Shutter sounds"
[node name="ShutterSoundsCheckBox" type="CheckBox" parent="HSplitContainer/VBoxContainer/ScrollContainer/Settings/Shutter/VBoxContainer/HBoxContainer3"] [node name="ShutterSoundsCheckBox" type="CheckBox" parent="HSplitContainer/VBoxContainer/ScrollContainer/Settings/Shutter/VBoxContainer/HBoxContainer3"]
@@ -139,6 +161,8 @@ layout_mode = 2
[node name="Label" type="Label" parent="HSplitContainer/VBoxContainer/ScrollContainer/Settings/Shutter/VBoxContainer/HBoxContainer"] [node name="Label" type="Label" parent="HSplitContainer/VBoxContainer/ScrollContainer/Settings/Shutter/VBoxContainer/HBoxContainer"]
custom_minimum_size = Vector2(250, 0) custom_minimum_size = Vector2(250, 0)
layout_mode = 2 layout_mode = 2
tooltip_text = "Set an Input Action to trigger a screenshot"
mouse_filter = 1
text = "Input Action" text = "Input Action"
[node name="InputActionLineEdit" type="LineEdit" parent="HSplitContainer/VBoxContainer/ScrollContainer/Settings/Shutter/VBoxContainer/HBoxContainer"] [node name="InputActionLineEdit" type="LineEdit" parent="HSplitContainer/VBoxContainer/ScrollContainer/Settings/Shutter/VBoxContainer/HBoxContainer"]
@@ -146,6 +170,21 @@ unique_name_in_owner = true
layout_mode = 2 layout_mode = 2
size_flags_horizontal = 3 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 = "Toggle shutter Input Action"
[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")] [node name="Resolution" type="FoldableContainer" parent="HSplitContainer/VBoxContainer/ScrollContainer/Settings" node_paths=PackedStringArray("sizes_container")]
unique_name_in_owner = true unique_name_in_owner = true
layout_mode = 2 layout_mode = 2
@@ -195,13 +234,13 @@ layout_mode = 2
[node name="SelectAll" type="Button" parent="HSplitContainer/VBoxContainer/ScrollContainer/Settings/Locales/VBoxContainer/HBoxContainer"] [node name="SelectAll" type="Button" parent="HSplitContainer/VBoxContainer/ScrollContainer/Settings/Locales/VBoxContainer/HBoxContainer"]
layout_mode = 2 layout_mode = 2
text = "Select all" text = "Select all"
icon = SubResource("DPITexture_q8tfr") icon = SubResource("DPITexture_2337e")
flat = true flat = true
[node name="DeselectAll" type="Button" parent="HSplitContainer/VBoxContainer/ScrollContainer/Settings/Locales/VBoxContainer/HBoxContainer"] [node name="DeselectAll" type="Button" parent="HSplitContainer/VBoxContainer/ScrollContainer/Settings/Locales/VBoxContainer/HBoxContainer"]
layout_mode = 2 layout_mode = 2
text = "Deselect all" text = "Deselect all"
icon = SubResource("DPITexture_q8tfr") icon = SubResource("DPITexture_2337e")
flat = true flat = true
[node name="SaveFolder" type="FoldableContainer" parent="HSplitContainer/VBoxContainer/ScrollContainer/Settings" node_paths=PackedStringArray("local_data")] [node name="SaveFolder" type="FoldableContainer" parent="HSplitContainer/VBoxContainer/ScrollContainer/Settings" node_paths=PackedStringArray("local_data")]
@@ -241,7 +280,7 @@ text = "user://screenshots"
[node name="PickFolderButton" type="Button" parent="HSplitContainer/VBoxContainer/ScrollContainer/Settings/SaveFolder/VBoxContainer/HBoxContainer"] [node name="PickFolderButton" type="Button" parent="HSplitContainer/VBoxContainer/ScrollContainer/Settings/SaveFolder/VBoxContainer/HBoxContainer"]
unique_name_in_owner = true unique_name_in_owner = true
layout_mode = 2 layout_mode = 2
icon = SubResource("DPITexture_q8tfr") icon = SubResource("DPITexture_2337e")
[node name="FormatsContainers" type="HFlowContainer" parent="HSplitContainer/VBoxContainer/ScrollContainer/Settings/SaveFolder/VBoxContainer"] [node name="FormatsContainers" type="HFlowContainer" parent="HSplitContainer/VBoxContainer/ScrollContainer/Settings/SaveFolder/VBoxContainer"]
unique_name_in_owner = true unique_name_in_owner = true
@@ -255,7 +294,6 @@ text = "PNG"
[node name="JPGCheckBox" type="CheckBox" parent="HSplitContainer/VBoxContainer/ScrollContainer/Settings/SaveFolder/VBoxContainer/FormatsContainers"] [node name="JPGCheckBox" type="CheckBox" parent="HSplitContainer/VBoxContainer/ScrollContainer/Settings/SaveFolder/VBoxContainer/FormatsContainers"]
layout_mode = 2 layout_mode = 2
button_pressed = true
text = "JPG" text = "JPG"
[node name="WEBPCheckBox" type="CheckBox" parent="HSplitContainer/VBoxContainer/ScrollContainer/Settings/SaveFolder/VBoxContainer/FormatsContainers"] [node name="WEBPCheckBox" type="CheckBox" parent="HSplitContainer/VBoxContainer/ScrollContainer/Settings/SaveFolder/VBoxContainer/FormatsContainers"]
@@ -268,10 +306,13 @@ layout_mode = 2
[node name="Label" type="Label" parent="HSplitContainer/VBoxContainer/ScrollContainer/Settings/SaveFolder/VBoxContainer/HBoxContainer2"] [node name="Label" type="Label" parent="HSplitContainer/VBoxContainer/ScrollContainer/Settings/SaveFolder/VBoxContainer/HBoxContainer2"]
custom_minimum_size = Vector2(250, 0) custom_minimum_size = Vector2(250, 0)
layout_mode = 2 layout_mode = 2
tooltip_text = "Organize bursts into folders with this structure [projectname_timestamp/locale/resolution]"
mouse_filter = 1
text = "Use subfolders" text = "Use subfolders"
[node name="UseSubFoldersCheckBox" type="CheckBox" parent="HSplitContainer/VBoxContainer/ScrollContainer/Settings/SaveFolder/VBoxContainer/HBoxContainer2"] [node name="UseSubFoldersCheckBox" type="CheckBox" parent="HSplitContainer/VBoxContainer/ScrollContainer/Settings/SaveFolder/VBoxContainer/HBoxContainer2"]
layout_mode = 2 layout_mode = 2
button_pressed = true
text = "On" text = "On"
[node name="VBoxContainer2" type="VBoxContainer" parent="HSplitContainer"] [node name="VBoxContainer2" type="VBoxContainer" parent="HSplitContainer"]
@@ -287,7 +328,7 @@ alignment = 1
[node name="CameraRollIcon" type="TextureRect" parent="HSplitContainer/VBoxContainer2/PanelContainer/HBoxContainer"] [node name="CameraRollIcon" type="TextureRect" parent="HSplitContainer/VBoxContainer2/PanelContainer/HBoxContainer"]
unique_name_in_owner = true unique_name_in_owner = true
layout_mode = 2 layout_mode = 2
texture = SubResource("DPITexture_q8tfr") texture = SubResource("DPITexture_2337e")
stretch_mode = 3 stretch_mode = 3
[node name="Label" type="Label" parent="HSplitContainer/VBoxContainer2/PanelContainer/HBoxContainer"] [node name="Label" type="Label" parent="HSplitContainer/VBoxContainer2/PanelContainer/HBoxContainer"]
@@ -316,13 +357,17 @@ unique_name_in_owner = true
layout_mode = 2 layout_mode = 2
size_flags_horizontal = 3 size_flags_horizontal = 3
size_flags_vertical = 3 size_flags_vertical = 3
theme_override_styles/panel = SubResource("StyleBoxFlat_2337e") theme_override_styles/panel = SubResource("StyleBoxFlat_ua4ux")
[node name="RollHFlowContainer" type="HFlowContainer" parent="HSplitContainer/VBoxContainer2/ScrollContainer2/CameraRoll/RollPanelContainer"] [node name="RollHFlowContainer" type="HFlowContainer" parent="HSplitContainer/VBoxContainer2/ScrollContainer2/CameraRoll/RollPanelContainer"]
unique_name_in_owner = true unique_name_in_owner = true
layout_mode = 2 layout_mode = 2
theme_override_constants/v_separation = 20 theme_override_constants/v_separation = 20
[node name="DirectoryWatcher" type="Node" parent="HSplitContainer/VBoxContainer2/ScrollContainer2/CameraRoll"]
unique_name_in_owner = true
script = ExtResource("8_2337e")
[node name="CameraRollBottomButtons" type="HBoxContainer" parent="HSplitContainer/VBoxContainer2"] [node name="CameraRollBottomButtons" type="HBoxContainer" parent="HSplitContainer/VBoxContainer2"]
layout_mode = 2 layout_mode = 2
alignment = 2 alignment = 2
@@ -332,11 +377,11 @@ script = ExtResource("8_epjix")
unique_name_in_owner = true unique_name_in_owner = true
layout_mode = 2 layout_mode = 2
text = "Delete all" text = "Delete all"
icon = SubResource("DPITexture_q8tfr") icon = SubResource("DPITexture_2337e")
[node name="OpenFolderButton" type="Button" parent="HSplitContainer/VBoxContainer2/CameraRollBottomButtons"] [node name="OpenFolderButton" type="Button" parent="HSplitContainer/VBoxContainer2/CameraRollBottomButtons"]
unique_name_in_owner = true unique_name_in_owner = true
layout_mode = 2 layout_mode = 2
size_flags_horizontal = 8 size_flags_horizontal = 8
text = "Open in File Manager" text = "Open in File Manager"
icon = SubResource("DPITexture_q8tfr") icon = SubResource("DPITexture_2337e")
@@ -6,105 +6,47 @@ extends VBoxContainer
const SCREENSHOT_PREVIEW = preload("res://addons/screenshots/debugger/bottom_panel/screenshot_preview/screenshot_preview.tscn") const SCREENSHOT_PREVIEW = preload("res://addons/screenshots/debugger/bottom_panel/screenshot_preview/screenshot_preview.tscn")
var roll_directory: String
func _ready() -> void: func _ready() -> void:
%RollPanelContainer.add_theme_stylebox_override("panel", get_theme_stylebox("panel", "ItemListSecondary")) %RollPanelContainer.add_theme_stylebox_override("panel", get_theme_stylebox("panel", "ItemListSecondary"))
%CameraRollIcon.texture = get_theme_icon("CameraTexture", "EditorIcons") %CameraRollIcon.texture = get_theme_icon("CameraTexture", "EditorIcons")
for filepath in local_data.settings.load_value("misc", "CameraRollPreviews", []): roll_directory = local_data.settings.load_value("misc", "PathLineEdit", "user://screenshots")
var img = Image.new() %DirectoryWatcher.add_scan_directory(roll_directory)
img = img.load_from_file(filepath) local_data.settings.value_changed.connect(_on_local_data_changed)
%DirectoryWatcher.files_deleted.connect(_on_files_deleted)
if img == null:
continue
var s = SCREENSHOT_PREVIEW.instantiate() func _on_files_deleted(files: PackedStringArray) -> void:
s.texture = ImageTexture.create_from_image(img) for file in files:
s.path = filepath
s.locale = ""
previews_container.add_child(s)
local_data.settings.save("misc", "CameraRollPreviews", get_all_previews_paths())
previews_container.child_entered_tree.connect(_on_preview_added)
previews_container.child_exiting_tree.connect(_on_preview_removed)
func _on_preview_added(preview: Node) -> void:
local_data.settings.save("misc", "CameraRollPreviews", get_all_previews_paths())
pass
func _on_preview_removed(preview: Node) -> void:
await preview.tree_exited
local_data.settings.save("misc", "CameraRollPreviews", get_all_previews_paths())
pass
func get_all_previews_paths() -> Array[String]:
var arr : Array[String] = []
for preview in previews_container.get_children(): for preview in previews_container.get_children():
arr.append(preview.path) if ProjectSettings.globalize_path(preview.path) == ProjectSettings.localize_path(file):
return arr preview.queue_free()
func get_unique_filepath(base_path: String) -> String:
if not FileAccess.file_exists(base_path):
return base_path
var dir = base_path.get_base_dir() func _on_local_data_changed(section: String, key: String, new_value) -> void:
var filename = base_path.get_file().get_basename() if not key == "PathLineEdit":
var extension = base_path.get_extension() return
var counter = 1 %DirectoryWatcher.remove_scan_directory(roll_directory)
var new_path = "%s/%s_%d.%s" % [dir, filename, counter, extension] roll_directory = new_value
%DirectoryWatcher.add_scan_directory(roll_directory)
while FileAccess.file_exists(new_path):
counter += 1
new_path = "%s/%s_%d.%s" % [dir, filename, counter, extension]
return new_path
func save_image(image: Image, timestamp: String, locale: String) -> void:
var save_folder: String = %PathLineEdit.text
var project_title = ProjectSettings.get_setting("application/config/name")
var screenshot_size = image.get_size()
# Build the save path with optional subfolders
var target_folder = save_folder
if local_data.settings.load_value("misc", "UseSubFoldersCheckBox", false):
# Create subfolder structure: Project_timestamp/locale/resolution
var timestamp_folder = "%s_%s" % [project_title, timestamp.replace(":", "-")]
var locale_folder = locale
var resolution_folder = "%dx%d" % [screenshot_size.x, screenshot_size.y]
target_folder = save_folder.path_join(timestamp_folder).path_join(locale_folder).path_join(resolution_folder)
# Ensure target folder exists
if not DirAccess.dir_exists_absolute(target_folder):
DirAccess.make_dir_recursive_absolute(target_folder)
var formats = {
"PNGCheckBox": ["png", image.save_png, true],
"JPGCheckBox": ["jpg", image.save_jpg, false],
"WEBPCheckBox": ["webp", image.save_webp, false]
}
for setting_key in formats:
var default = formats[setting_key][2]
if local_data.settings.load_value("misc", setting_key, default):
var extension = formats[setting_key][0]
var save_method = formats[setting_key][1]
var filename: String
if local_data.settings.load_value("misc", "UseSubFoldersCheckBox", false):
filename = "%s_%s" % [project_title, timestamp.replace(":", "-")]
else:
filename = "%s_%s_%s_%dx%d" % [project_title, timestamp.replace(":", "-"), locale, screenshot_size.x, screenshot_size.y]
var file_path = target_folder.path_join("%s.%s" % [filename, extension])
# Get unique filepath to avoid overwriting
file_path = get_unique_filepath(file_path)
save_method.call(file_path)
func add_preview(file_path: String, timestamp: String, locale: String) -> void:
var s = SCREENSHOT_PREVIEW.instantiate() var s = SCREENSHOT_PREVIEW.instantiate()
s.texture = ImageTexture.create_from_image(image) var image = Image.load_from_file(file_path)
var texture = ImageTexture.create_from_image(image)
s.texture = texture
s.path = file_path s.path = file_path
s.locale = locale s.locale = locale
previews_container.add_child(s) previews_container.add_child(s)
print_rich("[Screenshots] Saved at: [url=%s]%s[/url]" % [ProjectSettings.globalize_path(file_path.get_base_dir()), file_path])
func get_all_previews_paths() -> Array[String]:
var arr: Array[String] = []
for preview in previews_container.get_children():
arr.append(preview.path)
return arr
@@ -8,9 +8,11 @@ func _ready() -> void:
%OpenFolderButton.icon = get_theme_icon("Filesystem", "EditorIcons") %OpenFolderButton.icon = get_theme_icon("Filesystem", "EditorIcons")
%OpenFolderButton.pressed.connect(_on_open_folder_button_pressed) %OpenFolderButton.pressed.connect(_on_open_folder_button_pressed)
func _on_open_folder_button_pressed() -> void: func _on_open_folder_button_pressed() -> void:
OS.shell_open(ProjectSettings.globalize_path(%PathLineEdit.text)) OS.shell_open(ProjectSettings.globalize_path(%PathLineEdit.text))
func _on_delete_all_button_pressed() -> void: func _on_delete_all_button_pressed() -> void:
for c in %RollHFlowContainer.get_children(): for c in %RollHFlowContainer.get_children():
var path = c.path var path = c.path
@@ -0,0 +1,152 @@
#============================================================================
# |
#============================================================================
# This file is part of: |
# MIT License |
# https://github.com/KoBeWi/Godot-Directory-Watcher |
#============================================================================
# Copyright (c) 2019 Tomek |
# |
# Permission is hereby granted, free of charge, to any person obtaining |
# a copy of this software and associated documentation files (the |
# "Software"), to deal in the Software without restriction, including |
# without limitation the rights to use, copy, modify, merge, publish, |
# distribute, sublicense, and/or sell copies of the Software, and to |
# permit persons to whom the Software is furnished to do so, subject to |
# the following conditions: |
# |
# The above copyright notice and this permission notice shall be |
# included in all copies or substantial portions of the Software. |
# |
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY |
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, |
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE |
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
#============================================================================
@tool
extends Node
## Scans the provided directory (or directories) and informs about file changes. The scan is done periodically with configurable speed.
class WatchedDirectory:
var first_scan := true
var new: PackedStringArray
var modified: PackedStringArray
var current: Dictionary #[String, int]
var previous: Dictionary #[String, int]
var _directory := DirAccess.open(".")
var _directory_list: Dictionary #[String, WatchedDirectory]
var _directory_cache: Array[String]
var _to_delete: Array
var _current_directory_index: int
var _current_directory_name: String
var _remaining_steps: int
var _current_delay: float
## Delay between directory scans (in seconds).
var scan_delay: float = 1
## Files scanned per frame.
var scan_step := 50
## Emitted when files are created in the scanned directories.
signal files_created(files: PackedStringArray)
## Emitted when files are modified in the scanned directories (based on modified time).
signal files_modified(files: PackedStringArray)
## Emitted when files are deleted in the scanned directories.
signal files_deleted(files: PackedStringArray)
func _ready() -> void:
_current_delay = scan_delay
_remaining_steps = scan_step
_directory.include_hidden = true
## Adds a directory that will be scanned. You can add more than 1. Only supports absolute paths and res://, user://.
func add_scan_directory(directory: String):
directory = ProjectSettings.globalize_path(directory)
_directory_list[directory] = WatchedDirectory.new()
_directory_cache.assign(_directory_list.keys())
## Removes a scanned directory. Does nothing if the directory wasn't added.
func remove_scan_directory(directory: String):
directory = ProjectSettings.globalize_path(directory)
_to_delete.append(directory)
func _process(delta: float) -> void:
if _directory_list.is_empty():
push_error("No directory to watch. Please kill me ;_;")
return
if _current_delay > 0:
_current_delay -= delta
return
while _remaining_steps > 0:
if _current_directory_name.is_empty():
_current_directory_name = _directory_cache[_current_directory_index]
_directory.change_dir(_current_directory_name)
_directory.list_dir_begin()
var directory: WatchedDirectory = _directory_list[_current_directory_name]
var file := _directory.get_next()
if file.is_empty():
_current_directory_index += 1
_current_directory_name = ""
if directory.first_scan:
directory.new.clear()
directory.modified.clear()
directory.first_scan = false
else:
if not directory.new.is_empty():
files_created.emit(directory.new)
directory.new.clear()
if not directory.modified.is_empty():
files_modified.emit(directory.modified)
directory.modified.clear()
var deleted: PackedStringArray
for path in directory.previous:
if not path in directory.current:
deleted.append(_directory.get_current_dir().path_join(path))
if not deleted.is_empty():
files_deleted.emit(deleted)
directory.previous = directory.current
directory.current = { }
if _current_directory_index == _directory_list.size():
if not _to_delete.is_empty():
for dir in _to_delete:
_directory_list.erase(dir)
_current_directory_index = 0
break
else:
if _directory.current_is_dir():
continue
var full_file := _directory.get_current_dir().path_join(file)
directory.current[file] = FileAccess.get_modified_time(full_file)
if directory.previous.get(file, -1) == -1:
directory.new.append(full_file)
elif directory.current[file] > directory.previous[file]:
directory.modified.append(full_file)
_remaining_steps -= 1
_remaining_steps = scan_step
_current_delay = scan_delay
@@ -0,0 +1 @@
uid://x5sotkduu1be
@@ -6,6 +6,7 @@ extends FoldableContainer
@export var select_all_button: Button @export var select_all_button: Button
@export var deselect_all_button: Button @export var deselect_all_button: Button
func _ready() -> void: func _ready() -> void:
var saved_locales = local_data.settings.load_value("misc", "Locales", ["none"]) var saved_locales = local_data.settings.load_value("misc", "Locales", ["none"])
for l in TranslationServer.get_loaded_locales(): for l in TranslationServer.get_loaded_locales():
@@ -15,7 +16,7 @@ func _ready() -> void:
n.button_pressed = true n.button_pressed = true
locales_container.add_child(n) locales_container.add_child(n)
for c : CheckBox in locales_container.get_children(): for c: CheckBox in locales_container.get_children():
c.toggled.connect(_on_locale_toggled) c.toggled.connect(_on_locale_toggled)
select_all_button.pressed.connect(_set_all_locales_pressed.bind(true)) select_all_button.pressed.connect(_set_all_locales_pressed.bind(true))
@@ -23,17 +24,20 @@ func _ready() -> void:
select_all_button.icon = get_theme_icon("ThemeSelectAll", "EditorIcons") select_all_button.icon = get_theme_icon("ThemeSelectAll", "EditorIcons")
deselect_all_button.icon = get_theme_icon("ThemeDeselectAll", "EditorIcons") deselect_all_button.icon = get_theme_icon("ThemeDeselectAll", "EditorIcons")
func get_locales() -> Array[String]: func get_locales() -> Array[String]:
var arr: Array[String] = [] var arr: Array[String] = []
for child : CheckBox in locales_container.get_children(): for child: CheckBox in locales_container.get_children():
if child.button_pressed: if child.button_pressed:
arr.append(child.text) arr.append(child.text)
return arr return arr
func _set_all_locales_pressed(pressed: bool) -> void: func _set_all_locales_pressed(pressed: bool) -> void:
for l : CheckBox in locales_container.get_children(): for l: CheckBox in locales_container.get_children():
l.button_pressed = pressed l.button_pressed = pressed
func _on_locale_toggled(_toggled_on: bool) -> void: func _on_locale_toggled(_toggled_on: bool) -> void:
var has_pressed := false var has_pressed := false
var has_unpressed := false var has_unpressed := false
@@ -53,5 +57,6 @@ func _on_locale_toggled(_toggled_on: bool) -> void:
select_all_button.disabled = not has_unpressed select_all_button.disabled = not has_unpressed
_save_to_config() _save_to_config()
func _save_to_config() -> void: func _save_to_config() -> void:
local_data.settings.save("misc", "Locales", get_locales()) local_data.settings.save("misc", "Locales", get_locales())
@@ -1,5 +1,6 @@
@tool @tool
extends FoldableContainer extends FoldableContainer
const SIZE = preload("res://addons/screenshots/debugger/bottom_panel/size/size.tscn") const SIZE = preload("res://addons/screenshots/debugger/bottom_panel/size/size.tscn")
@onready var local_data = %LocalData @onready var local_data = %LocalData
@export var sizes_container: FlowContainer @export var sizes_container: FlowContainer
@@ -12,7 +13,7 @@ func _ready() -> void:
var def_width = ProjectSettings.get_setting("display/window/size/viewport_width") var def_width = ProjectSettings.get_setting("display/window/size/viewport_width")
var def_height = ProjectSettings.get_setting("display/window/size/viewport_height") var def_height = ProjectSettings.get_setting("display/window/size/viewport_height")
for s in local_data.settings.load_value("misc", "Sizes", [Vector2i(def_width,def_height)]): for s in local_data.settings.load_value("misc", "Sizes", [Vector2i(def_width, def_height)]):
var new_size = SIZE.instantiate() var new_size = SIZE.instantiate()
new_size.set_resolution(s) new_size.set_resolution(s)
sizes_container.add_child(new_size) sizes_container.add_child(new_size)
@@ -42,9 +43,11 @@ func _on_size_added(node: Node) -> void:
_save_to_config() _save_to_config()
sizes_container.get_child(-1).set_add_button_visibility(true) sizes_container.get_child(-1).set_add_button_visibility(true)
func _save_to_config() -> void: func _save_to_config() -> void:
local_data.settings.save("misc", "Sizes", get_sizes()) local_data.settings.save("misc", "Sizes", get_sizes())
func get_sizes() -> Array[Vector2i]: func get_sizes() -> Array[Vector2i]:
var arr: Array[Vector2i] = [] var arr: Array[Vector2i] = []
for child in sizes_container.get_children(): for child in sizes_container.get_children():
@@ -3,6 +3,7 @@ extends FoldableContainer
@export var local_data: Node @export var local_data: Node
func _ready() -> void: func _ready() -> void:
%PickFolderButton.icon = get_theme_icon("FolderBrowse", "EditorIcons") %PickFolderButton.icon = get_theme_icon("FolderBrowse", "EditorIcons")
%PickFolderButton.pressed.connect(func(): %FileDialog.show()) %PickFolderButton.pressed.connect(func(): %FileDialog.show())
@@ -12,9 +13,11 @@ func _ready() -> void:
for c in %FormatsContainers.get_children(): for c in %FormatsContainers.get_children():
c.toggled.connect(_on_format_toggled) c.toggled.connect(_on_format_toggled)
func _on_dir_selected(path: String) -> void: func _on_dir_selected(path: String) -> void:
%PathLineEdit.text = path %PathLineEdit.text = path
func _on_format_toggled(_toggled_on: bool) -> void: func _on_format_toggled(_toggled_on: bool) -> void:
var has_pressed := false var has_pressed := false
var has_unpressed := false var has_unpressed := false
@@ -28,9 +31,10 @@ func _on_format_toggled(_toggled_on: bool) -> void:
if not has_pressed: if not has_pressed:
%PNGCheckBox.button_pressed = true %PNGCheckBox.button_pressed = true
func get_formats() -> Array[String]: func get_formats() -> Array[String]:
var arr: Array[String] = [] var arr: Array[String] = []
for child : CheckBox in %FormatsContainers.get_children(): for child: CheckBox in %FormatsContainers.get_children():
if child.button_pressed: if child.button_pressed:
arr.append(child.text) arr.append(child.text)
return arr return arr
@@ -1,10 +1,11 @@
@tool @tool
extends VBoxContainer extends VBoxContainer
@export var texture : Texture2D @export var texture: Texture2D
@export var locale: String @export var locale: String
@export var path: String @export var path: String
# Called when the node enters the scene tree for the first time. # Called when the node enters the scene tree for the first time.
func _ready() -> void: func _ready() -> void:
$Button.icon = texture $Button.icon = texture
@@ -13,5 +14,5 @@ func _ready() -> void:
var globalized_path = ProjectSettings.globalize_path(path) var globalized_path = ProjectSettings.globalize_path(path)
$Button.pressed.connect(func(): OS.shell_open(globalized_path)) $Button.pressed.connect(func(): OS.shell_open(globalized_path))
for c : Control in get_children(): for c: Control in get_children():
c.tooltip_text = "%s\n%sx%s\nLocale: %s" % [path.get_file(), resolution.x, resolution.y, locale] c.tooltip_text = "%s\n%sx%s\nLocale: %s" % [path.get_file(), resolution.x, resolution.y, locale]
@@ -1,23 +1,24 @@
@tool @tool
extends HBoxContainer extends HBoxContainer
signal resolution_edited signal resolution_edited
@export var preset_option_button: OptionButton @export var preset_option_button: OptionButton
var presets : Dictionary[String, Vector2i] = { var presets: Dictionary[String, Vector2i] = {
"iPhone 6.9\" (portrait)" : Vector2i(1320, 2868), "iPhone 6.9\" (portrait)": Vector2i(1320, 2868),
"iPhone 6.9\" (landscape)" : Vector2i(2868, 1320), "iPhone 6.9\" (landscape)": Vector2i(2868, 1320),
"iPad 13\" (portrait)": Vector2i(2064, 2752),
"iPad 13\" (portrait)" : Vector2i(2064, 2752), "iPad 13\" (landscape)": Vector2i(2752, 2064),
"iPad 13\" (landscape)" : Vector2i(2752, 2064)
} }
func _ready() -> void: func _ready() -> void:
var i = 0 var i = 0
preset_option_button.clear() preset_option_button.clear()
for preset in presets: for preset in presets:
preset_option_button.add_item(preset) preset_option_button.add_item(preset)
preset_option_button.set_item_metadata(i, presets[preset]) preset_option_button.set_item_metadata(i, presets[preset])
i+=1 i += 1
preset_option_button.add_item("Custom") preset_option_button.add_item("Custom")
preset_option_button.item_selected.connect(_on_preset_selected) preset_option_button.item_selected.connect(_on_preset_selected)
@@ -36,22 +37,27 @@ func _ready() -> void:
%TrashButton.pressed.connect(_on_trash_button_pressed) %TrashButton.pressed.connect(_on_trash_button_pressed)
%TrashButton.icon = get_theme_icon("Remove", "EditorIcons") %TrashButton.icon = get_theme_icon("Remove", "EditorIcons")
func _on_trash_button_pressed() -> void: func _on_trash_button_pressed() -> void:
queue_free() queue_free()
func set_trash_button_disabled(p_disabled : bool) -> void:
func set_trash_button_disabled(p_disabled: bool) -> void:
%TrashButton.disabled = p_disabled %TrashButton.disabled = p_disabled
func set_add_button_visibility(p_visible: bool) -> void: func set_add_button_visibility(p_visible: bool) -> void:
%AddButton.visible = p_visible %AddButton.visible = p_visible
func _on_add_button_pressed() -> void: func _on_add_button_pressed() -> void:
var size_panel = load("res://addons/screenshots/debugger/bottom_panel/size/size.tscn") var size_panel = load("res://addons/screenshots/debugger/bottom_panel/size/size.tscn")
get_parent().add_child(size_panel.instantiate()) get_parent().add_child(size_panel.instantiate())
$AddButton.hide() $AddButton.hide()
func _on_preset_selected(idx: int) -> void: func _on_preset_selected(idx: int) -> void:
var resolution : Vector2i = preset_option_button.get_item_metadata(idx) var resolution: Vector2i = preset_option_button.get_item_metadata(idx)
if not resolution: if not resolution:
return return
@@ -59,11 +65,13 @@ func _on_preset_selected(idx: int) -> void:
%YLineEdit.text = str(resolution.y) %YLineEdit.text = str(resolution.y)
resolution_edited.emit() resolution_edited.emit()
func set_resolution(p_resolution: Vector2i) -> void: func set_resolution(p_resolution: Vector2i) -> void:
%XLineEdit.text = str(p_resolution.x) %XLineEdit.text = str(p_resolution.x)
%YLineEdit.text = str(p_resolution.y) %YLineEdit.text = str(p_resolution.y)
select_preset_option(p_resolution) select_preset_option(p_resolution)
func select_preset_option(resolution: Vector2i) -> void: func select_preset_option(resolution: Vector2i) -> void:
if not is_node_ready(): if not is_node_ready():
await ready await ready
@@ -74,12 +82,14 @@ func select_preset_option(resolution: Vector2i) -> void:
idx = i idx = i
preset_option_button.select(idx) preset_option_button.select(idx)
func get_resolution() -> Vector2i: func get_resolution() -> Vector2i:
var res : Vector2i var res: Vector2i
res.x = int(%XLineEdit.text) res.x = int(%XLineEdit.text)
res.y = int(%YLineEdit.text) res.y = int(%YLineEdit.text)
return res return res
func _on_resolution_edited(new_text: String, axis: String) -> void: func _on_resolution_edited(new_text: String, axis: String) -> void:
# Remove all non-digit characters # Remove all non-digit characters
var filtered := "" var filtered := ""
@@ -1,19 +1,22 @@
@tool @tool
extends EditorDebuggerPlugin extends EditorDebuggerPlugin
var session_id_to_editor_panel : Dictionary = {} var session_id_to_editor_panel: Dictionary = { }
func _setup_session(p_session_id : int) -> void:
var editor_panel : Control = preload("res://addons/screenshots/debugger/bottom_panel/bottom_panel.tscn").instantiate()
var editor_debugger_session : EditorDebuggerSession = get_session(p_session_id)
var _success : int = editor_debugger_session.started.connect(editor_panel.on_session_started) func _setup_session(p_session_id: int) -> void:
var editor_panel: Control = preload("res://addons/screenshots/debugger/bottom_panel/bottom_panel.tscn").instantiate()
var editor_debugger_session: EditorDebuggerSession = get_session(p_session_id)
var _success: int = editor_debugger_session.started.connect(editor_panel.on_session_started)
editor_debugger_session.add_session_tab(editor_panel) editor_debugger_session.add_session_tab(editor_panel)
session_id_to_editor_panel[p_session_id] = editor_panel session_id_to_editor_panel[p_session_id] = editor_panel
func _has_capture(p_prefix : String) -> bool:
func _has_capture(p_prefix: String) -> bool:
return p_prefix == "screenshot" return p_prefix == "screenshot"
func _capture(p_message : String, p_data : Array, p_session_id : int) -> bool:
var editor_panel : Control = session_id_to_editor_panel[p_session_id] func _capture(p_message: String, p_data: Array, p_session_id: int) -> bool:
var editor_panel: Control = session_id_to_editor_panel[p_session_id]
return editor_panel.on_editor_debugger_plugin_capture(p_message, p_data) return editor_panel.on_editor_debugger_plugin_capture(p_message, p_data)
+1 -1
View File
@@ -3,5 +3,5 @@
name="Screenshots" name="Screenshots"
description="Takes screenshots of all sizes and locales with a single click." description="Takes screenshots of all sizes and locales with a single click."
author="Davide Di Staso" author="Davide Di Staso"
version="1.0" version="1.2"
script="plugin.gd" script="plugin.gd"
+18 -6
View File
@@ -3,13 +3,25 @@ extends EditorPlugin
const SHUTTER_WINDOW = "res://addons/screenshots/autoload/shutter_window/shutter_window.tscn" const SHUTTER_WINDOW = "res://addons/screenshots/autoload/shutter_window/shutter_window.tscn"
var m_editor_debugger_plugin : EditorDebuggerPlugin = preload("res://addons/screenshots/debugger/editor_debugger_plugin.gd").new() var m_editor_debugger_plugin: EditorDebuggerPlugin = preload("res://addons/screenshots/debugger/editor_debugger_plugin.gd").new()
var bottom_panel : Control var bottom_panel: Control
func _enter_tree():
add_debugger_plugin(m_editor_debugger_plugin) func _enable_plugin() -> void:
add_autoload_singleton("Screenshots", SHUTTER_WINDOW) add_autoload_singleton("Screenshots", SHUTTER_WINDOW)
pass
func _exit_tree():
remove_debugger_plugin(m_editor_debugger_plugin) func _disable_plugin() -> void:
remove_autoload_singleton("Screenshots") remove_autoload_singleton("Screenshots")
pass
func _enter_tree() -> void:
add_debugger_plugin(m_editor_debugger_plugin)
pass
func _exit_tree() -> void:
remove_debugger_plugin(m_editor_debugger_plugin)
pass
+25 -1
View File
@@ -3,18 +3,24 @@ extends Node
var settings: LocalFile var settings: LocalFile
func _ready(): func _ready():
settings = LocalFile.new("res://addons/screenshots/settings.cfg") settings = LocalFile.new("res://addons/screenshots/settings.cfg")
class LocalFile: class LocalFile:
signal value_changed(section: String, key: String, new_value)
var config: ConfigFile var config: ConfigFile
var file_path: String var file_path: String
func _init(path: String): func _init(path: String):
file_path = path file_path = path
config = ConfigFile.new() config = ConfigFile.new()
load_config() load_config()
func load_config(): func load_config():
var err = config.load(file_path) var err = config.load(file_path)
if err != OK: if err != OK:
@@ -22,11 +28,23 @@ class LocalFile:
# We'll create it when we first save # We'll create it when we first save
pass pass
func save(section: String, key: String, value): func save(section: String, key: String, value):
var old_value = null
var has_existing_key = config.has_section_key(section, key)
if has_existing_key:
old_value = config.get_value(section, key)
# Only save and emit if the value is different
if not has_existing_key or old_value != value:
config.set_value(section, key, value) config.set_value(section, key, value)
var err = config.save(file_path) var err = config.save(file_path)
if err != OK: if err != OK:
push_error("Failed to save config file " + file_path + ": " + str(err)) push_error("Failed to save config file " + file_path + ": " + str(err))
else:
value_changed.emit(section, key, value)
func load_value(section: String, key: String, default_value = null): func load_value(section: String, key: String, default_value = null):
# Check if the key exists first to avoid C++ errors # Check if the key exists first to avoid C++ errors
@@ -42,19 +60,23 @@ class LocalFile:
func has_key(section: String, key: String) -> bool: func has_key(section: String, key: String) -> bool:
return config.has_section_key(section, key) return config.has_section_key(section, key)
func has_section(section: String) -> bool: func has_section(section: String) -> bool:
return config.has_section(section) return config.has_section(section)
# Get all values from a section # Get all values from a section
func get_section(section: String) -> Dictionary: func get_section(section: String) -> Dictionary:
if config.has_section(section): if config.has_section(section):
return config.get_section_values(section) return config.get_section_values(section)
return {} return { }
# Get all sections # Get all sections
func get_sections() -> PackedStringArray: func get_sections() -> PackedStringArray:
return config.get_sections() return config.get_sections()
# Remove a key # Remove a key
func remove_key(section: String, key: String): func remove_key(section: String, key: String):
config.erase_section_key(section, key) config.erase_section_key(section, key)
@@ -62,6 +84,7 @@ class LocalFile:
if err != OK: if err != OK:
push_error("Failed to save config file " + file_path + ": " + str(err)) push_error("Failed to save config file " + file_path + ": " + str(err))
# Remove an entire section # Remove an entire section
func remove_section(section: String): func remove_section(section: String):
config.erase_section(section) config.erase_section(section)
@@ -69,6 +92,7 @@ class LocalFile:
if err != OK: if err != OK:
push_error("Failed to save config file " + file_path + ": " + str(err)) push_error("Failed to save config file " + file_path + ": " + str(err))
# Clear entire file # Clear entire file
func clear_all(): func clear_all():
config.clear() config.clear()
+1
View File
@@ -11,6 +11,7 @@ config_version=5
[application] [application]
config/name="Screenshots" config/name="Screenshots"
run/main_scene="uid://dhxwkyejss1af"
config/features=PackedStringArray("4.5", "Forward Plus") config/features=PackedStringArray("4.5", "Forward Plus")
config/icon="res://store_assets/icon.svg" config/icon="res://store_assets/icon.svg"
Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

+40
View File
@@ -0,0 +1,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://db676w16nxng0"
path="res://.godot/imported/icon.png-328cfcb6969469a4250bbb3ec82ff0ac.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://store_assets/icon.png"
dest_files=["res://.godot/imported/icon.png-328cfcb6969469a4250bbb3ec82ff0ac.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1