First commit
This commit is contained in:
1 parent
3016a8f489
commit
cc9e7b1c40
44 files changed
+1413
-2
No files matched your search
@@ -0,0 +1,4 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="black" class="bi bi-camera-fill" viewBox="0 0 16 16">
|
||||
<path d="M10.5 8.5a2.5 2.5 0 1 1-5 0 2.5 2.5 0 0 1 5 0"/>
|
||||
<path d="M2 4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2h-1.172a2 2 0 0 1-1.414-.586l-.828-.828A2 2 0 0 0 9.172 2H6.828a2 2 0 0 0-1.414.586l-.828.828A2 2 0 0 1 3.172 4zm.5 2a.5.5 0 1 1 0-1 .5.5 0 0 1 0 1m9 2.5a3.5 3.5 0 1 1-7 0 3.5 3.5 0 0 1 7 0"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 460 B |
@@ -0,0 +1,20 @@
|
||||
[remap]
|
||||
|
||||
importer="svg"
|
||||
type="DPITexture"
|
||||
uid="uid://dycxybqgtxc2w"
|
||||
path="res://.godot/imported/camera-fill.svg-e9198903bce487e974bcb588c9f9f7a6.dpitex"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://addons/screenshots/autoload/assets/camera-fill.svg"
|
||||
dest_files=["res://.godot/imported/camera-fill.svg-e9198903bce487e974bcb588c9f9f7a6.dpitex"]
|
||||
|
||||
[params]
|
||||
|
||||
base_scale=10.0
|
||||
saturation=1.0
|
||||
color_map={
|
||||
Color(0, 0, 0, 1): Color(1, 1, 1, 1)
|
||||
}
|
||||
compress=true
|
||||
Binary file not shown.
@@ -0,0 +1,19 @@
|
||||
[remap]
|
||||
|
||||
importer="mp3"
|
||||
type="AudioStreamMP3"
|
||||
uid="uid://dhtbqkl7tqwaa"
|
||||
path="res://.godot/imported/camera-shutter.mp3-eb59fb1826b5f14720d352b51e4ce6a4.mp3str"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://addons/screenshots/autoload/assets/camera-shutter.mp3"
|
||||
dest_files=["res://.godot/imported/camera-shutter.mp3-eb59fb1826b5f14720d352b51e4ce6a4.mp3str"]
|
||||
|
||||
[params]
|
||||
|
||||
loop=false
|
||||
loop_offset=0
|
||||
bpm=0
|
||||
beat_count=0
|
||||
bar_beats=4
|
||||
@@ -0,0 +1,82 @@
|
||||
extends Window
|
||||
|
||||
## Godot addon that lets you rapidly take screenshots. Supports taking bursts in multiple resolutions, locales, and formats.
|
||||
|
||||
@export var _local_data: Node
|
||||
|
||||
## Fires before capture. Use this to hide debug UI elements.
|
||||
signal burst_starting
|
||||
|
||||
## Fires after capture with metadata and image data.
|
||||
signal image_captured(image: Image)
|
||||
|
||||
## Fires after the burst is completed. Use it to unhide debug UI elements.
|
||||
signal burst_ended
|
||||
|
||||
var _input_action: String
|
||||
|
||||
func _ready() -> void:
|
||||
visible = _local_data.settings.load_value("misc", "ShowShutterCheckBox", true)
|
||||
_input_action = _local_data.settings.load_value("misc", "InputActionLineEdit", "")
|
||||
%ShutterButton.pressed.connect(take_burst)
|
||||
close_requested.connect(_on_close_requested)
|
||||
|
||||
func _on_close_requested() -> void:
|
||||
hide()
|
||||
|
||||
func _input(event: InputEvent) -> void:
|
||||
if not InputMap.has_action(_input_action):
|
||||
return
|
||||
if event.is_action_pressed(_input_action):
|
||||
take_burst()
|
||||
|
||||
## Takes one or more screenshots (a burst) using settings specified in the Debugger panel
|
||||
func take_burst() -> void:
|
||||
_local_data.settings.load_config()
|
||||
burst_starting.emit()
|
||||
var pause_game = _local_data.settings.load_value("misc", "PausesGameCheckBox", true)
|
||||
var shutter_was_visible = visible
|
||||
var sizes = _local_data.settings.load_value("misc", "Sizes", [])
|
||||
var locales = _local_data.settings.load_value("misc", "Locales", ["none"])
|
||||
var previous_locale = TranslationServer.get_locale()
|
||||
hide()
|
||||
|
||||
var tree = get_tree()
|
||||
var game_was_paused = tree.paused
|
||||
if pause_game:
|
||||
tree.paused = true
|
||||
var prev_size = DisplayServer.window_get_size()
|
||||
var timestamp = Time.get_time_string_from_system()
|
||||
|
||||
|
||||
# Take screenshots for each configured size
|
||||
for s in sizes:
|
||||
DisplayServer.window_set_size(s)
|
||||
await get_tree().create_timer(0.01).timeout
|
||||
|
||||
for locale in locales:
|
||||
if not locale == "none":
|
||||
TranslationServer.set_locale(locale)
|
||||
await get_tree().process_frame
|
||||
|
||||
_send_viewport_texture_to_debugger(timestamp, TranslationServer.get_locale())
|
||||
|
||||
TranslationServer.set_locale(previous_locale)
|
||||
DisplayServer.window_set_size(prev_size)
|
||||
|
||||
# Print clickable paths
|
||||
print_rich("[color=green][Screenshots] Done! (%s)[/color]" % timestamp)
|
||||
|
||||
tree.paused = game_was_paused
|
||||
visible = shutter_was_visible
|
||||
burst_ended.emit()
|
||||
|
||||
func _send_viewport_texture_to_debugger(timestamp: String, locale: String) -> void:
|
||||
var play_shutter_sounds = _local_data.settings.load_value("misc", "ShutterSoundsCheckBox", true)
|
||||
# Save the screenshot
|
||||
var image = get_parent().get_viewport().get_texture().get_image()
|
||||
EngineDebugger.send_message("screenshot:take", [image.save_png_to_buffer(), timestamp, locale])
|
||||
image_captured.emit(image)
|
||||
|
||||
if play_shutter_sounds:
|
||||
%AudioStreamPlayer.play()
|
||||
@@ -0,0 +1 @@
|
||||
uid://bw4haikxxwnq
|
||||
@@ -0,0 +1,49 @@
|
||||
[gd_scene load_steps=5 format=3 uid="uid://bljdk7ctqona7"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://bw4haikxxwnq" path="res://addons/screenshots/autoload/shutter_window/shutter_window.gd" id="1_iuwdj"]
|
||||
[ext_resource type="Texture2D" uid="uid://dycxybqgtxc2w" path="res://addons/screenshots/autoload/assets/camera-fill.svg" id="2_nd08q"]
|
||||
[ext_resource type="AudioStream" uid="uid://dhtbqkl7tqwaa" path="res://addons/screenshots/autoload/assets/camera-shutter.mp3" id="3_og3rn"]
|
||||
[ext_resource type="Script" uid="uid://cx82rfmwl8gk0" path="res://addons/screenshots/screenshots_local_data.gd" id="4_nd08q"]
|
||||
|
||||
[node name="ShutterWindow" type="Window" node_paths=PackedStringArray("local_data")]
|
||||
transparent_bg = true
|
||||
oversampling_override = 1.0
|
||||
title = "Shutter"
|
||||
initial_position = 1
|
||||
size = Vector2i(300, 200)
|
||||
always_on_top = true
|
||||
transparent = true
|
||||
exclude_from_capture = true
|
||||
maximize_disabled = true
|
||||
script = ExtResource("1_iuwdj")
|
||||
local_data = NodePath("LocalData")
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="."]
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
theme_override_constants/margin_left = 10
|
||||
theme_override_constants/margin_top = 10
|
||||
theme_override_constants/margin_right = 10
|
||||
theme_override_constants/margin_bottom = 10
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="ShutterButton" type="Button" parent="MarginContainer/VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
icon = ExtResource("2_nd08q")
|
||||
icon_alignment = 1
|
||||
expand_icon = true
|
||||
|
||||
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="MarginContainer/VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
stream = ExtResource("3_og3rn")
|
||||
|
||||
[node name="LocalData" type="Node" parent="."]
|
||||
unique_name_in_owner = true
|
||||
script = ExtResource("4_nd08q")
|
||||
Reference in new issue
Block a user