First commit

This commit is contained in:
Davide Di Staso committed 2025-10-05 18:13:56 +02:00
1 parent 3016a8f489
commit cc9e7b1c40
44 files changed
+1413 -2

No files matched your search

@@ -0,0 +1,51 @@
@tool
extends Control
@export var nodes_to_save: Array[Node]
func _ready() -> void:
load_nodes_from_config(nodes_to_save)
setup_auto_save(nodes_to_save)
func save_nodes_to_config(p_nodes_to_save: Array[Node]) -> void:
for node in p_nodes_to_save:
var key = node.name
var value = null
if node is CheckBox:
value = node.button_pressed
%LocalData.settings.save("misc", key, value)
if node is LineEdit:
value = node.text
%LocalData.settings.save("misc", key, value)
func load_nodes_from_config(p_nodes_to_load: Array[Node]) -> void:
for node in p_nodes_to_load:
var value = %LocalData.settings.load_value("misc", node.name)
if value != null:
if node is CheckBox:
node.button_pressed = value
if node is LineEdit:
node.text = value
func setup_auto_save(nodes: Array[Node]) -> void:
for node in nodes:
if node is CheckBox:
node.toggled.connect(func(_toggled): save_nodes_to_config([node]))
if node is LineEdit:
node.text_changed.connect(func(_new_text): save_nodes_to_config([node]))
func on_session_started() -> void:
pass
func on_editor_debugger_plugin_capture(p_message, p_data) -> bool:
if p_message == "screenshot:take":
var buffer: PackedByteArray = p_data[0]
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 false
@@ -0,0 +1 @@
uid://culd18vnvt4ej
@@ -0,0 +1,342 @@
[gd_scene load_steps=11 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://bq5amyoktrfo4" path="res://addons/screenshots/debugger/bottom_panel/settings.gd" id="2_ivg3g"]
[ext_resource type="Script" uid="uid://y1mw5tn3rmxj" path="res://addons/screenshots/debugger/bottom_panel/resolution.gd" id="4_v0ol1"]
[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://cvvxb0tom0wc" path="res://addons/screenshots/debugger/bottom_panel/camera_roll.gd" id="8_6oft3"]
[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"]
[sub_resource type="DPITexture" id="DPITexture_q8tfr"]
_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"]
content_margin_left = 4.0
content_margin_top = 4.0
content_margin_right = 4.0
content_margin_bottom = 4.0
bg_color = Color(1, 0.365, 0.365, 1)
draw_center = false
border_width_left = 2
border_width_top = 2
border_width_right = 2
border_width_bottom = 2
corner_detail = 1
[node name="Screenshots" type="Control" node_paths=PackedStringArray("nodes_to_save")]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
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")]
[node name="LocalData" type="Node" parent="."]
unique_name_in_owner = true
script = ExtResource("9_ke0xa")
[node name="HSplitContainer" type="HSplitContainer" parent="."]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="VBoxContainer" type="VBoxContainer" parent="HSplitContainer"]
layout_mode = 2
[node name="PanelContainer" type="PanelContainer" parent="HSplitContainer/VBoxContainer"]
layout_mode = 2
[node name="HBoxContainer" type="HBoxContainer" parent="HSplitContainer/VBoxContainer/PanelContainer"]
layout_mode = 2
alignment = 1
[node name="SettingsIcon" type="TextureRect" parent="HSplitContainer/VBoxContainer/PanelContainer/HBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
texture = SubResource("DPITexture_q8tfr")
stretch_mode = 3
[node name="Label" type="Label" parent="HSplitContainer/VBoxContainer/PanelContainer/HBoxContainer"]
layout_mode = 2
text = "Settings"
horizontal_alignment = 1
[node name="ScrollContainer" type="ScrollContainer" parent="HSplitContainer/VBoxContainer"]
custom_minimum_size = Vector2(400, 0)
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 3
horizontal_scroll_mode = 0
[node name="Settings" type="VBoxContainer" parent="HSplitContainer/VBoxContainer/ScrollContainer"]
layout_mode = 2
size_flags_horizontal = 3
script = ExtResource("2_ivg3g")
[node name="Shutter" type="FoldableContainer" parent="HSplitContainer/VBoxContainer/ScrollContainer/Settings"]
layout_mode = 2
folded = true
title = "Shutter"
[node name="VBoxContainer" type="VBoxContainer" parent="HSplitContainer/VBoxContainer/ScrollContainer/Settings/Shutter"]
visible = false
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"]
layout_mode = 2
[node name="Label" type="Label" parent="HSplitContainer/VBoxContainer/ScrollContainer/Settings/Shutter/VBoxContainer/HBoxContainer2"]
custom_minimum_size = Vector2(250, 0)
layout_mode = 2
text = "Show shutter"
[node name="ShowShutterCheckBox" type="CheckBox" parent="HSplitContainer/VBoxContainer/ScrollContainer/Settings/Shutter/VBoxContainer/HBoxContainer2"]
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"]
layout_mode = 2
[node name="Label" type="Label" parent="HSplitContainer/VBoxContainer/ScrollContainer/Settings/Shutter/VBoxContainer/HBoxContainer3"]
custom_minimum_size = Vector2(250, 0)
layout_mode = 2
text = "Shutter sounds"
[node name="ShutterSoundsCheckBox" type="CheckBox" parent="HSplitContainer/VBoxContainer/ScrollContainer/Settings/Shutter/VBoxContainer/HBoxContainer3"]
layout_mode = 2
button_pressed = true
text = "On"
[node name="HBoxContainer" type="HBoxContainer" parent="HSplitContainer/VBoxContainer/ScrollContainer/Settings/Shutter/VBoxContainer"]
layout_mode = 2
[node name="Label" type="Label" parent="HSplitContainer/VBoxContainer/ScrollContainer/Settings/Shutter/VBoxContainer/HBoxContainer"]
custom_minimum_size = Vector2(250, 0)
layout_mode = 2
text = "Input Action"
[node name="InputActionLineEdit" type="LineEdit" parent="HSplitContainer/VBoxContainer/ScrollContainer/Settings/Shutter/VBoxContainer/HBoxContainer"]
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
title = "Resolution"
script = ExtResource("4_v0ol1")
sizes_container = NodePath("HBoxContainer/SizesContainer")
[node name="HBoxContainer" type="HBoxContainer" parent="HSplitContainer/VBoxContainer/ScrollContainer/Settings/Resolution"]
layout_mode = 2
[node name="Label" type="Label" parent="HSplitContainer/VBoxContainer/ScrollContainer/Settings/Resolution/HBoxContainer"]
layout_mode = 2
size_flags_vertical = 0
text = "Sizes"
[node name="SizesContainer" type="HFlowContainer" parent="HSplitContainer/VBoxContainer/ScrollContainer/Settings/Resolution/HBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
[node name="Locales" type="FoldableContainer" parent="HSplitContainer/VBoxContainer/ScrollContainer/Settings" node_paths=PackedStringArray("local_data", "select_all_button", "deselect_all_button")]
unique_name_in_owner = true
layout_mode = 2
folded = true
title = "Locales"
script = ExtResource("6_m7syr")
local_data = NodePath("../../../../../LocalData")
select_all_button = NodePath("VBoxContainer/HBoxContainer/SelectAll")
deselect_all_button = NodePath("VBoxContainer/HBoxContainer/DeselectAll")
[node name="VBoxContainer" type="VBoxContainer" parent="HSplitContainer/VBoxContainer/ScrollContainer/Settings/Locales"]
visible = false
layout_mode = 2
[node name="HFlowContainer" type="HFlowContainer" parent="HSplitContainer/VBoxContainer/ScrollContainer/Settings/Locales/VBoxContainer"]
layout_mode = 2
[node name="NoneLocaleCheckBox" type="CheckBox" parent="HSplitContainer/VBoxContainer/ScrollContainer/Settings/Locales/VBoxContainer/HFlowContainer"]
unique_name_in_owner = true
layout_mode = 2
button_pressed = true
text = "none"
[node name="HBoxContainer" type="HBoxContainer" parent="HSplitContainer/VBoxContainer/ScrollContainer/Settings/Locales/VBoxContainer"]
layout_mode = 2
[node name="SelectAll" type="Button" parent="HSplitContainer/VBoxContainer/ScrollContainer/Settings/Locales/VBoxContainer/HBoxContainer"]
layout_mode = 2
text = "Select all"
icon = SubResource("DPITexture_q8tfr")
flat = true
[node name="DeselectAll" type="Button" parent="HSplitContainer/VBoxContainer/ScrollContainer/Settings/Locales/VBoxContainer/HBoxContainer"]
layout_mode = 2
text = "Deselect all"
icon = SubResource("DPITexture_q8tfr")
flat = true
[node name="SaveFolder" type="FoldableContainer" parent="HSplitContainer/VBoxContainer/ScrollContainer/Settings" node_paths=PackedStringArray("local_data")]
layout_mode = 2
folded = true
title = "Save"
script = ExtResource("7_q2ypf")
local_data = NodePath("../../../../../LocalData")
[node name="FileDialog" type="FileDialog" parent="HSplitContainer/VBoxContainer/ScrollContainer/Settings/SaveFolder"]
unique_name_in_owner = true
oversampling_override = 1.0
title = "Open a Directory"
initial_position = 1
size = Vector2i(1991, 1200)
file_mode = 2
access = 2
[node name="VBoxContainer" type="VBoxContainer" parent="HSplitContainer/VBoxContainer/ScrollContainer/Settings/SaveFolder"]
visible = false
layout_mode = 2
[node name="HBoxContainer" type="HBoxContainer" parent="HSplitContainer/VBoxContainer/ScrollContainer/Settings/SaveFolder/VBoxContainer"]
layout_mode = 2
[node name="Label" type="Label" parent="HSplitContainer/VBoxContainer/ScrollContainer/Settings/SaveFolder/VBoxContainer/HBoxContainer"]
custom_minimum_size = Vector2(250, 0)
layout_mode = 2
text = "Path"
[node name="PathLineEdit" type="LineEdit" parent="HSplitContainer/VBoxContainer/ScrollContainer/Settings/SaveFolder/VBoxContainer/HBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
text = "user://screenshots"
[node name="PickFolderButton" type="Button" parent="HSplitContainer/VBoxContainer/ScrollContainer/Settings/SaveFolder/VBoxContainer/HBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
icon = SubResource("DPITexture_q8tfr")
[node name="FormatsContainers" type="HFlowContainer" parent="HSplitContainer/VBoxContainer/ScrollContainer/Settings/SaveFolder/VBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
[node name="PNGCheckBox" type="CheckBox" parent="HSplitContainer/VBoxContainer/ScrollContainer/Settings/SaveFolder/VBoxContainer/FormatsContainers"]
unique_name_in_owner = true
layout_mode = 2
button_pressed = true
text = "PNG"
[node name="JPGCheckBox" type="CheckBox" parent="HSplitContainer/VBoxContainer/ScrollContainer/Settings/SaveFolder/VBoxContainer/FormatsContainers"]
layout_mode = 2
button_pressed = true
text = "JPG"
[node name="WEBPCheckBox" type="CheckBox" parent="HSplitContainer/VBoxContainer/ScrollContainer/Settings/SaveFolder/VBoxContainer/FormatsContainers"]
layout_mode = 2
text = "WEBP"
[node name="HBoxContainer2" type="HBoxContainer" parent="HSplitContainer/VBoxContainer/ScrollContainer/Settings/SaveFolder/VBoxContainer"]
layout_mode = 2
[node name="Label" type="Label" parent="HSplitContainer/VBoxContainer/ScrollContainer/Settings/SaveFolder/VBoxContainer/HBoxContainer2"]
custom_minimum_size = Vector2(250, 0)
layout_mode = 2
text = "Use subfolders"
[node name="UseSubFoldersCheckBox" type="CheckBox" parent="HSplitContainer/VBoxContainer/ScrollContainer/Settings/SaveFolder/VBoxContainer/HBoxContainer2"]
layout_mode = 2
text = "On"
[node name="VBoxContainer2" type="VBoxContainer" parent="HSplitContainer"]
layout_mode = 2
[node name="PanelContainer" type="PanelContainer" parent="HSplitContainer/VBoxContainer2"]
layout_mode = 2
[node name="HBoxContainer" type="HBoxContainer" parent="HSplitContainer/VBoxContainer2/PanelContainer"]
layout_mode = 2
alignment = 1
[node name="CameraRollIcon" type="TextureRect" parent="HSplitContainer/VBoxContainer2/PanelContainer/HBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
texture = SubResource("DPITexture_q8tfr")
stretch_mode = 3
[node name="Label" type="Label" parent="HSplitContainer/VBoxContainer2/PanelContainer/HBoxContainer"]
layout_mode = 2
text = "Camera Roll"
horizontal_alignment = 1
[node name="ScrollContainer2" type="ScrollContainer" parent="HSplitContainer/VBoxContainer2"]
custom_minimum_size = Vector2(400, 0)
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 3
horizontal_scroll_mode = 0
[node name="CameraRoll" type="VBoxContainer" parent="HSplitContainer/VBoxContainer2/ScrollContainer2" node_paths=PackedStringArray("local_data", "previews_container")]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 3
script = ExtResource("8_6oft3")
local_data = NodePath("../../../../LocalData")
previews_container = NodePath("RollPanelContainer/RollHFlowContainer")
[node name="RollPanelContainer" type="PanelContainer" parent="HSplitContainer/VBoxContainer2/ScrollContainer2/CameraRoll"]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 3
theme_override_styles/panel = SubResource("StyleBoxFlat_2337e")
[node name="RollHFlowContainer" type="HFlowContainer" parent="HSplitContainer/VBoxContainer2/ScrollContainer2/CameraRoll/RollPanelContainer"]
unique_name_in_owner = true
layout_mode = 2
theme_override_constants/v_separation = 20
[node name="CameraRollBottomButtons" type="HBoxContainer" parent="HSplitContainer/VBoxContainer2"]
layout_mode = 2
alignment = 2
script = ExtResource("8_epjix")
[node name="DeleteAllButton" type="Button" parent="HSplitContainer/VBoxContainer2/CameraRollBottomButtons"]
unique_name_in_owner = true
layout_mode = 2
text = "Delete all"
icon = SubResource("DPITexture_q8tfr")
[node name="OpenFolderButton" type="Button" parent="HSplitContainer/VBoxContainer2/CameraRollBottomButtons"]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 8
text = "Open in File Manager"
icon = SubResource("DPITexture_q8tfr")
@@ -0,0 +1,110 @@
@tool
extends VBoxContainer
@export var local_data: Node
@export var previews_container: Control
const SCREENSHOT_PREVIEW = preload("res://addons/screenshots/debugger/bottom_panel/screenshot_preview/screenshot_preview.tscn")
func _ready() -> void:
%RollPanelContainer.add_theme_stylebox_override("panel", get_theme_stylebox("panel", "ItemListSecondary"))
%CameraRollIcon.texture = get_theme_icon("CameraTexture", "EditorIcons")
for filepath in local_data.settings.load_value("misc", "CameraRollPreviews", []):
var img = Image.new()
img = img.load_from_file(filepath)
if img == null:
continue
var s = SCREENSHOT_PREVIEW.instantiate()
s.texture = ImageTexture.create_from_image(img)
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():
arr.append(preview.path)
return arr
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
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)
var s = SCREENSHOT_PREVIEW.instantiate()
s.texture = ImageTexture.create_from_image(image)
s.path = file_path
s.locale = locale
previews_container.add_child(s)
print_rich("[Screenshots] Saved at: [url=%s]%s[/url]" % [ProjectSettings.globalize_path(file_path.get_base_dir()), file_path])
@@ -0,0 +1 @@
uid://cvvxb0tom0wc
@@ -0,0 +1,19 @@
@tool
extends HBoxContainer
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
%DeleteAllButton.icon = get_theme_icon("Remove", "EditorIcons")
%DeleteAllButton.pressed.connect(_on_delete_all_button_pressed)
%OpenFolderButton.icon = get_theme_icon("Filesystem", "EditorIcons")
%OpenFolderButton.pressed.connect(_on_open_folder_button_pressed)
func _on_open_folder_button_pressed() -> void:
OS.shell_open(ProjectSettings.globalize_path(%PathLineEdit.text))
func _on_delete_all_button_pressed() -> void:
for c in %RollHFlowContainer.get_children():
var path = c.path
var err = OS.move_to_trash(ProjectSettings.globalize_path(path))
if not err:
c.queue_free()
@@ -0,0 +1 @@
uid://c5poruw4iu2ve
@@ -0,0 +1,57 @@
@tool
extends FoldableContainer
@onready var locales_container = $VBoxContainer/HFlowContainer
@export var local_data: Node
@export var select_all_button: Button
@export var deselect_all_button: Button
func _ready() -> void:
var saved_locales = local_data.settings.load_value("misc", "Locales", ["none"])
for l in TranslationServer.get_loaded_locales():
var n = CheckBox.new()
n.text = l
if saved_locales.has(l):
n.button_pressed = true
locales_container.add_child(n)
for c : CheckBox in locales_container.get_children():
c.toggled.connect(_on_locale_toggled)
select_all_button.pressed.connect(_set_all_locales_pressed.bind(true))
deselect_all_button.pressed.connect(_set_all_locales_pressed.bind(false))
select_all_button.icon = get_theme_icon("ThemeSelectAll", "EditorIcons")
deselect_all_button.icon = get_theme_icon("ThemeDeselectAll", "EditorIcons")
func get_locales() -> Array[String]:
var arr: Array[String] = []
for child : CheckBox in locales_container.get_children():
if child.button_pressed:
arr.append(child.text)
return arr
func _set_all_locales_pressed(pressed: bool) -> void:
for l : CheckBox in locales_container.get_children():
l.button_pressed = pressed
func _on_locale_toggled(_toggled_on: bool) -> void:
var has_pressed := false
var has_unpressed := false
for l: CheckBox in locales_container.get_children():
if l.button_pressed:
has_pressed = true
else:
has_unpressed = true
# "Deselect all" should only be enabled if at least one is pressed
deselect_all_button.disabled = not has_pressed
if not has_pressed:
%NoneLocaleCheckBox.button_pressed = true
# "Select all" should only be enabled if at least one is unpressed
select_all_button.disabled = not has_unpressed
_save_to_config()
func _save_to_config() -> void:
local_data.settings.save("misc", "Locales", get_locales())
@@ -0,0 +1 @@
uid://c034i367kogf6
@@ -0,0 +1,52 @@
@tool
extends FoldableContainer
const SIZE = preload("res://addons/screenshots/debugger/bottom_panel/size/size.tscn")
@onready var local_data = %LocalData
@export var sizes_container: FlowContainer
func _ready() -> void:
sizes_container.child_exiting_tree.connect(_on_size_removed)
sizes_container.child_entered_tree.connect(_on_size_added)
var def_width = ProjectSettings.get_setting("display/window/size/viewport_width")
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)]):
var new_size = SIZE.instantiate()
new_size.set_resolution(s)
sizes_container.add_child(new_size)
func _on_size_removed(node: Node) -> void:
await node.tree_exited
if not sizes_container:
return
if sizes_container.get_child_count() == 1:
sizes_container.get_child(0).set_trash_button_disabled(true)
_save_to_config()
sizes_container.get_child(-1).set_add_button_visibility(true)
func _on_size_added(node: Node) -> void:
if not node.resolution_edited.is_connected(_save_to_config):
node.resolution_edited.connect(_save_to_config)
if sizes_container.get_child_count() >= 1:
for c in sizes_container.get_children():
c.set_trash_button_disabled(false)
c.set_add_button_visibility(false)
_save_to_config()
sizes_container.get_child(-1).set_add_button_visibility(true)
func _save_to_config() -> void:
local_data.settings.save("misc", "Sizes", get_sizes())
func get_sizes() -> Array[Vector2i]:
var arr: Array[Vector2i] = []
for child in sizes_container.get_children():
arr.append(child.get_resolution())
return arr
@@ -0,0 +1 @@
uid://y1mw5tn3rmxj
@@ -0,0 +1,36 @@
@tool
extends FoldableContainer
@export var local_data: Node
func _ready() -> void:
%PickFolderButton.icon = get_theme_icon("FolderBrowse", "EditorIcons")
%PickFolderButton.pressed.connect(func(): %FileDialog.show())
%FileDialog.dir_selected.connect(_on_dir_selected)
%FileDialog.current_dir = %PathLineEdit.text
for c in %FormatsContainers.get_children():
c.toggled.connect(_on_format_toggled)
func _on_dir_selected(path: String) -> void:
%PathLineEdit.text = path
func _on_format_toggled(_toggled_on: bool) -> void:
var has_pressed := false
var has_unpressed := false
for l: CheckBox in %FormatsContainers.get_children():
if l.button_pressed:
has_pressed = true
else:
has_unpressed = true
if not has_pressed:
%PNGCheckBox.button_pressed = true
func get_formats() -> Array[String]:
var arr: Array[String] = []
for child : CheckBox in %FormatsContainers.get_children():
if child.button_pressed:
arr.append(child.text)
return arr
@@ -0,0 +1 @@
uid://jfpjg1put47h
@@ -0,0 +1,17 @@
@tool
extends VBoxContainer
@export var texture : Texture2D
@export var locale: String
@export var path: String
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
$Button.icon = texture
var resolution = Vector2i(texture.get_size())
$Label.text = path.get_file()
var globalized_path = ProjectSettings.globalize_path(path)
$Button.pressed.connect(func(): OS.shell_open(globalized_path))
for c : Control in get_children():
c.tooltip_text = "%s\n%sx%s\nLocale: %s" % [path.get_file(), resolution.x, resolution.y, locale]
@@ -0,0 +1 @@
uid://ch82dtfcsnlrg
@@ -0,0 +1,19 @@
[gd_scene load_steps=2 format=3 uid="uid://fpvnsu6fxqfe"]
[ext_resource type="Script" uid="uid://ch82dtfcsnlrg" path="res://addons/screenshots/debugger/bottom_panel/screenshot_preview/screenshot_preview.gd" id="1_lqc0r"]
[node name="ScreenshotPreview" type="VBoxContainer"]
script = ExtResource("1_lqc0r")
locale = null
[node name="Button" type="Button" parent="."]
custom_minimum_size = Vector2(300, 300)
layout_mode = 2
flat = true
icon_alignment = 1
expand_icon = true
[node name="Label" type="Label" parent="."]
layout_mode = 2
horizontal_alignment = 1
text_overrun_behavior = 5
@@ -0,0 +1,5 @@
@tool
extends VBoxContainer
func _ready() -> void:
%SettingsIcon.texture = get_theme_icon("Tools", "EditorIcons")
@@ -0,0 +1 @@
uid://bq5amyoktrfo4
@@ -0,0 +1,99 @@
@tool
extends HBoxContainer
signal resolution_edited
@export var preset_option_button: OptionButton
var presets : Dictionary[String, Vector2i] = {
"iPhone 6.9\" (portrait)" : Vector2i(1320, 2868),
"iPhone 6.9\" (landscape)" : Vector2i(2868, 1320),
"iPad 13\" (portrait)" : Vector2i(2064, 2752),
"iPad 13\" (landscape)" : Vector2i(2752, 2064)
}
func _ready() -> void:
var i = 0
preset_option_button.clear()
for preset in presets:
preset_option_button.add_item(preset)
preset_option_button.set_item_metadata(i, presets[preset])
i+=1
preset_option_button.add_item("Custom")
preset_option_button.item_selected.connect(_on_preset_selected)
if preset_option_button.selected == -1:
preset_option_button.select(0)
_on_preset_selected(0)
%XLineEdit.text_changed.connect(_on_resolution_edited.bind("x"))
%YLineEdit.text_changed.connect(_on_resolution_edited.bind("y"))
%AddButton.pressed.connect(_on_add_button_pressed)
%AddButton.icon = get_theme_icon("Add", "EditorIcons")
%XLabel.add_theme_color_override("font_color", get_theme_color("property_color_x", "Editor"))
%YLabel.add_theme_color_override("font_color", get_theme_color("property_color_y", "Editor"))
%PixelsLabel.add_theme_color_override("font_color", get_theme_color("disabled_font_color", "Editor"))
%PixelsLabel2.add_theme_color_override("font_color", get_theme_color("disabled_font_color", "Editor"))
%TrashButton.pressed.connect(_on_trash_button_pressed)
%TrashButton.icon = get_theme_icon("Remove", "EditorIcons")
func _on_trash_button_pressed() -> void:
queue_free()
func set_trash_button_disabled(p_disabled : bool) -> void:
%TrashButton.disabled = p_disabled
func set_add_button_visibility(p_visible: bool) -> void:
%AddButton.visible = p_visible
func _on_add_button_pressed() -> void:
var size_panel = load("res://addons/screenshots/debugger/bottom_panel/size/size.tscn")
get_parent().add_child(size_panel.instantiate())
$AddButton.hide()
func _on_preset_selected(idx: int) -> void:
var resolution : Vector2i = preset_option_button.get_item_metadata(idx)
if not resolution:
return
%XLineEdit.text = str(resolution.x)
%YLineEdit.text = str(resolution.y)
resolution_edited.emit()
func set_resolution(p_resolution: Vector2i) -> void:
%XLineEdit.text = str(p_resolution.x)
%YLineEdit.text = str(p_resolution.y)
select_preset_option(p_resolution)
func select_preset_option(resolution: Vector2i) -> void:
if not is_node_ready():
await ready
var idx = preset_option_button.item_count - 1
for i in range(0, preset_option_button.item_count):
var button_res = preset_option_button.get_item_metadata(i)
if button_res == resolution:
idx = i
preset_option_button.select(idx)
func get_resolution() -> Vector2i:
var res : Vector2i
res.x = int(%XLineEdit.text)
res.y = int(%YLineEdit.text)
return res
func _on_resolution_edited(new_text: String, axis: String) -> void:
# Remove all non-digit characters
var filtered := ""
for c in new_text:
if c.is_valid_int():
filtered += c
# Update the correct line edit only if text was modified
if axis == "x":
if %XLineEdit.text != filtered:
%XLineEdit.text = filtered
elif axis == "y":
if %YLineEdit.text != filtered:
%YLineEdit.text = filtered
select_preset_option(get_resolution())
resolution_edited.emit()
@@ -0,0 +1 @@
uid://dgo7yugttb2sl
@@ -0,0 +1,94 @@
[gd_scene load_steps=3 format=3 uid="uid://dbrgvcn8hvchs"]
[ext_resource type="Script" uid="uid://dgo7yugttb2sl" path="res://addons/screenshots/debugger/bottom_panel/size/size.gd" id="1_7ypgp"]
[sub_resource type="DPITexture" id="DPITexture_v8sxj"]
_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>
"
[node name="Size" type="HBoxContainer" node_paths=PackedStringArray("preset_option_button")]
script = ExtResource("1_7ypgp")
preset_option_button = NodePath("VBoxContainer2/HBoxContainer/OptionButton")
[node name="VBoxContainer2" type="VBoxContainer" parent="."]
layout_mode = 2
[node name="VBoxContainer" type="VBoxContainer" parent="VBoxContainer2"]
layout_mode = 2
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer2/VBoxContainer"]
layout_mode = 2
[node name="XLabel" type="Label" parent="VBoxContainer2/VBoxContainer/HBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
theme_override_colors/font_color = Color(0, 0, 0, 1)
text = "x"
[node name="XLineEdit" type="LineEdit" parent="VBoxContainer2/VBoxContainer/HBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
text = "1320"
virtual_keyboard_type = 2
[node name="PixelsLabel" type="Label" parent="VBoxContainer2/VBoxContainer/HBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
theme_override_colors/font_color = Color(0, 0, 0, 1)
text = "px"
[node name="HBoxContainer2" type="HBoxContainer" parent="VBoxContainer2/VBoxContainer"]
layout_mode = 2
[node name="YLabel" type="Label" parent="VBoxContainer2/VBoxContainer/HBoxContainer2"]
unique_name_in_owner = true
layout_mode = 2
theme_override_colors/font_color = Color(0, 0, 0, 1)
text = "y"
[node name="YLineEdit" type="LineEdit" parent="VBoxContainer2/VBoxContainer/HBoxContainer2"]
unique_name_in_owner = true
layout_mode = 2
text = "2868"
virtual_keyboard_type = 2
[node name="PixelsLabel2" type="Label" parent="VBoxContainer2/VBoxContainer/HBoxContainer2"]
unique_name_in_owner = true
layout_mode = 2
theme_override_colors/font_color = Color(0, 0, 0, 1)
text = "px"
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer2"]
layout_mode = 2
[node name="OptionButton" type="OptionButton" parent="VBoxContainer2/HBoxContainer"]
custom_minimum_size = Vector2(300, 0)
layout_mode = 2
flat = true
text_overrun_behavior = 3
selected = 0
fit_to_longest_item = false
item_count = 5
popup/item_0/text = "iPhone 6.9\" (portrait)"
popup/item_0/id = 0
popup/item_1/text = "iPhone 6.9\" (landscape)"
popup/item_1/id = 1
popup/item_2/text = "iPad 13\" (portrait)"
popup/item_2/id = 2
popup/item_3/text = "iPad 13\" (landscape)"
popup/item_3/id = 3
popup/item_4/text = "Custom"
popup/item_4/id = 4
[node name="TrashButton" type="Button" parent="VBoxContainer2/HBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
disabled = true
icon = SubResource("DPITexture_v8sxj")
flat = true
[node name="AddButton" type="Button" parent="."]
unique_name_in_owner = true
visible = false
layout_mode = 2
icon = SubResource("DPITexture_v8sxj")
@@ -0,0 +1,19 @@
@tool
extends EditorDebuggerPlugin
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)
editor_debugger_session.add_session_tab(editor_panel)
session_id_to_editor_panel[p_session_id] = editor_panel
func _has_capture(p_prefix : String) -> bool:
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]
return editor_panel.on_editor_debugger_plugin_capture(p_message, p_data)
@@ -0,0 +1 @@
uid://4gwlpfnuylnv