mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-01-18 09:09:47 +00:00
Some recorder UI improvements
Removed the fps option completely as it doesn't have any effects to exported static images. Should be re-introduced once we add video exporting with ffmpeg though.
This commit is contained in:
parent
5297fe6a80
commit
f0a5637d8a
|
@ -13,13 +13,15 @@ var frame_captured := 0 ## Used to visualize frames captured
|
|||
var skip_amount := 1 ## Number of "do" actions after which a frame can be captured
|
||||
var current_frame_no := 0 ## Used to compare with skip_amount to see if it can be captured
|
||||
|
||||
var resize := 100
|
||||
var resize_percent := 100
|
||||
|
||||
@onready var captured_label := %CapturedLabel as Label
|
||||
@onready var project_list := $"%TargetProjectOption" as OptionButton
|
||||
@onready var folder_button := $"%Folder" as Button
|
||||
@onready var start_button := $"%Start" as Button
|
||||
@onready var size_label := $"%Size" as Label
|
||||
@onready var path_field := $"%Path" as LineEdit
|
||||
@onready var options_dialog := $Dialogs/OptionsDialog as AcceptDialog
|
||||
@onready var options_container := %OptionsContainer as VBoxContainer
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
|
@ -40,10 +42,9 @@ func initialize_recording() -> void:
|
|||
current_frame_no = skip_amount - 1
|
||||
|
||||
# disable some options that are not required during recording
|
||||
folder_button.visible = true
|
||||
project_list.visible = false
|
||||
$ScrollContainer/CenterContainer/GridContainer/Captured.visible = true
|
||||
for child in $Dialogs/Options/PanelContainer/VBoxContainer.get_children():
|
||||
captured_label.visible = true
|
||||
for child in options_container.get_children():
|
||||
if !child.is_in_group("visible during recording"):
|
||||
child.visible = false
|
||||
|
||||
|
@ -77,11 +78,10 @@ func capture_frame() -> void:
|
|||
DrawingAlgos.blend_layers(image, frame, Vector2i.ZERO, project)
|
||||
|
||||
if mode == Mode.CANVAS:
|
||||
if resize != 100:
|
||||
if resize_percent != 100:
|
||||
var resize := resize_percent / 100
|
||||
image.resize(
|
||||
image.get_size().x * resize / 100,
|
||||
image.get_size().y * resize / 100,
|
||||
Image.INTERPOLATE_NEAREST
|
||||
image.get_width() * resize, image.get_height() * resize, Image.INTERPOLATE_NEAREST
|
||||
)
|
||||
|
||||
cache.append(image)
|
||||
|
@ -102,7 +102,7 @@ func save_frame(img: Image) -> void:
|
|||
|
||||
func _on_frame_saved() -> void:
|
||||
frame_captured += 1
|
||||
$ScrollContainer/CenterContainer/GridContainer/Captured.text = str("Saved: ", frame_captured)
|
||||
captured_label.text = str("Saved: ", frame_captured)
|
||||
|
||||
|
||||
func finalize_recording() -> void:
|
||||
|
@ -111,10 +111,9 @@ func finalize_recording() -> void:
|
|||
save_frame(img)
|
||||
cache.clear()
|
||||
disconnect_undo()
|
||||
folder_button.visible = false
|
||||
project_list.visible = true
|
||||
$ScrollContainer/CenterContainer/GridContainer/Captured.visible = false
|
||||
for child in $Dialogs/Options/PanelContainer/VBoxContainer.get_children():
|
||||
captured_label.visible = false
|
||||
for child in options_container.get_children():
|
||||
child.visible = true
|
||||
if mode == Mode.PIXELORAMA:
|
||||
size_label.get_parent().visible = false
|
||||
|
@ -152,9 +151,7 @@ func _on_Start_toggled(button_pressed: bool) -> void:
|
|||
|
||||
|
||||
func _on_Settings_pressed() -> void:
|
||||
var settings := $Dialogs/Options as Window
|
||||
var pos := position
|
||||
settings.popup(Rect2(pos, settings.size))
|
||||
options_dialog.popup(Rect2(position, options_dialog.size))
|
||||
|
||||
|
||||
func _on_SkipAmount_value_changed(value: float) -> void:
|
||||
|
@ -171,8 +168,8 @@ func _on_Mode_toggled(button_pressed: bool) -> void:
|
|||
|
||||
|
||||
func _on_SpinBox_value_changed(value: float) -> void:
|
||||
resize = value
|
||||
var new_size: Vector2 = project.size * (resize / 100.0)
|
||||
resize_percent = value
|
||||
var new_size: Vector2 = project.size * (resize_percent / 100.0)
|
||||
size_label.text = str("(", new_size.x, "×", new_size.y, ")")
|
||||
|
||||
|
||||
|
@ -181,7 +178,7 @@ func _on_Choose_pressed() -> void:
|
|||
$Dialogs/Path.current_dir = chosen_dir
|
||||
|
||||
|
||||
func _on_Open_pressed() -> void:
|
||||
func _on_open_folder_pressed() -> void:
|
||||
OS.shell_open(path_field.text)
|
||||
|
||||
|
||||
|
@ -189,13 +186,3 @@ func _on_Path_dir_selected(dir: String) -> void:
|
|||
chosen_dir = dir
|
||||
path_field.text = chosen_dir
|
||||
start_button.disabled = false
|
||||
|
||||
|
||||
func _on_Fps_value_changed(value: float) -> void:
|
||||
var dur_label := $Dialogs/Options/PanelContainer/VBoxContainer/Fps/Duration as Label
|
||||
var duration := snappedf(1.0 / value, 0.0001)
|
||||
dur_label.text = str("= ", duration, " sec")
|
||||
|
||||
|
||||
func _on_options_close_requested() -> void:
|
||||
$Dialogs/Options.hide()
|
||||
|
|
|
@ -26,7 +26,8 @@ layout_mode = 2
|
|||
size_flags_vertical = 0
|
||||
columns = 4
|
||||
|
||||
[node name="Captured" type="Label" parent="ScrollContainer/CenterContainer/GridContainer"]
|
||||
[node name="CapturedLabel" type="Label" parent="ScrollContainer/CenterContainer/GridContainer"]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
|
||||
|
@ -80,16 +81,14 @@ offset_bottom = 10.5
|
|||
texture = ExtResource("3")
|
||||
stretch_mode = 6
|
||||
|
||||
[node name="Folder" type="Button" parent="ScrollContainer/CenterContainer/GridContainer"]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
[node name="OpenFolder" type="Button" parent="ScrollContainer/CenterContainer/GridContainer"]
|
||||
custom_minimum_size = Vector2(32, 32)
|
||||
layout_mode = 2
|
||||
tooltip_text = "Open Folder"
|
||||
mouse_default_cursor_shape = 2
|
||||
toggle_mode = true
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="ScrollContainer/CenterContainer/GridContainer/Folder"]
|
||||
[node name="TextureRect" type="TextureRect" parent="ScrollContainer/CenterContainer/GridContainer/OpenFolder"]
|
||||
layout_mode = 0
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
|
@ -104,110 +103,95 @@ stretch_mode = 6
|
|||
layout_mode = 2
|
||||
mouse_filter = 2
|
||||
|
||||
[node name="Options" type="Window" parent="Dialogs"]
|
||||
[node name="OptionsDialog" type="AcceptDialog" parent="Dialogs"]
|
||||
position = Vector2i(0, 36)
|
||||
size = Vector2i(400, 300)
|
||||
visible = false
|
||||
exclusive = false
|
||||
popup_window = true
|
||||
|
||||
[node name="PanelContainer" type="PanelContainer" parent="Dialogs/Options"]
|
||||
[node name="PanelContainer" type="MarginContainer" parent="Dialogs/OptionsDialog"]
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_left = 9.0
|
||||
offset_top = 9.0
|
||||
offset_right = -9.0
|
||||
offset_bottom = -9.0
|
||||
offset_left = 8.0
|
||||
offset_top = 8.0
|
||||
offset_right = -8.0
|
||||
offset_bottom = -49.0
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="Dialogs/Options/PanelContainer"]
|
||||
[node name="OptionsContainer" type="VBoxContainer" parent="Dialogs/OptionsDialog/PanelContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
|
||||
[node name="IntervalHeader" type="HBoxContainer" parent="Dialogs/Options/PanelContainer/VBoxContainer"]
|
||||
[node name="IntervalHeader" type="HBoxContainer" parent="Dialogs/OptionsDialog/PanelContainer/OptionsContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 0
|
||||
|
||||
[node name="Label" type="Label" parent="Dialogs/Options/PanelContainer/VBoxContainer/IntervalHeader"]
|
||||
[node name="Label" type="Label" parent="Dialogs/OptionsDialog/PanelContainer/OptionsContainer/IntervalHeader"]
|
||||
layout_mode = 2
|
||||
theme_type_variation = &"HeaderSmall"
|
||||
text = "Interval"
|
||||
|
||||
[node name="HSeparator" type="HSeparator" parent="Dialogs/Options/PanelContainer/VBoxContainer/IntervalHeader"]
|
||||
[node name="HSeparator" type="HSeparator" parent="Dialogs/OptionsDialog/PanelContainer/OptionsContainer/IntervalHeader"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="ActionGap" type="HBoxContainer" parent="Dialogs/Options/PanelContainer/VBoxContainer"]
|
||||
[node name="ActionGap" type="HBoxContainer" parent="Dialogs/OptionsDialog/PanelContainer/OptionsContainer"]
|
||||
layout_mode = 2
|
||||
alignment = 1
|
||||
|
||||
[node name="Label" type="Label" parent="Dialogs/Options/PanelContainer/VBoxContainer/ActionGap"]
|
||||
[node name="Label" type="Label" parent="Dialogs/OptionsDialog/PanelContainer/OptionsContainer/ActionGap"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "Capture frame every"
|
||||
|
||||
[node name="SkipAmount" type="SpinBox" parent="Dialogs/Options/PanelContainer/VBoxContainer/ActionGap"]
|
||||
[node name="SkipAmount" type="SpinBox" parent="Dialogs/OptionsDialog/PanelContainer/OptionsContainer/ActionGap"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
suffix = "actions"
|
||||
|
||||
[node name="Label2" type="Label" parent="Dialogs/Options/PanelContainer/VBoxContainer/ActionGap"]
|
||||
layout_mode = 2
|
||||
text = "Actions"
|
||||
|
||||
[node name="Fps" type="HBoxContainer" parent="Dialogs/Options/PanelContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
alignment = 1
|
||||
|
||||
[node name="Label" type="Label" parent="Dialogs/Options/PanelContainer/VBoxContainer/Fps"]
|
||||
layout_mode = 2
|
||||
text = "Fps:"
|
||||
|
||||
[node name="Fps" type="SpinBox" parent="Dialogs/Options/PanelContainer/VBoxContainer/Fps"]
|
||||
layout_mode = 2
|
||||
min_value = 1.0
|
||||
value = 30.0
|
||||
allow_greater = true
|
||||
|
||||
[node name="Duration" type="Label" parent="Dialogs/Options/PanelContainer/VBoxContainer/Fps"]
|
||||
layout_mode = 2
|
||||
text = "= 0.0333 sec"
|
||||
|
||||
[node name="ModeHeader" type="HBoxContainer" parent="Dialogs/Options/PanelContainer/VBoxContainer" groups=["visible during recording"]]
|
||||
[node name="ModeHeader" type="HBoxContainer" parent="Dialogs/OptionsDialog/PanelContainer/OptionsContainer" groups=["visible during recording"]]
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 0
|
||||
|
||||
[node name="Label" type="Label" parent="Dialogs/Options/PanelContainer/VBoxContainer/ModeHeader"]
|
||||
[node name="Label" type="Label" parent="Dialogs/OptionsDialog/PanelContainer/OptionsContainer/ModeHeader"]
|
||||
layout_mode = 2
|
||||
theme_type_variation = &"HeaderSmall"
|
||||
text = "Mode"
|
||||
|
||||
[node name="HSeparator" type="HSeparator" parent="Dialogs/Options/PanelContainer/VBoxContainer/ModeHeader"]
|
||||
[node name="HSeparator" type="HSeparator" parent="Dialogs/OptionsDialog/PanelContainer/OptionsContainer/ModeHeader"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="ModeType" type="HBoxContainer" parent="Dialogs/Options/PanelContainer/VBoxContainer" groups=["visible during recording"]]
|
||||
[node name="ModeType" type="HBoxContainer" parent="Dialogs/OptionsDialog/PanelContainer/OptionsContainer" groups=["visible during recording"]]
|
||||
layout_mode = 2
|
||||
alignment = 1
|
||||
|
||||
[node name="Label" type="Label" parent="Dialogs/Options/PanelContainer/VBoxContainer/ModeType"]
|
||||
[node name="Label" type="Label" parent="Dialogs/OptionsDialog/PanelContainer/OptionsContainer/ModeType"]
|
||||
layout_mode = 2
|
||||
text = "Canvas Only"
|
||||
size_flags_horizontal = 3
|
||||
text = "Record canvas only"
|
||||
|
||||
[node name="Mode" type="CheckButton" parent="Dialogs/Options/PanelContainer/VBoxContainer/ModeType"]
|
||||
[node name="Mode" type="CheckButton" parent="Dialogs/OptionsDialog/PanelContainer/OptionsContainer/ModeType"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
mouse_default_cursor_shape = 2
|
||||
|
||||
[node name="Label2" type="Label" parent="Dialogs/Options/PanelContainer/VBoxContainer/ModeType"]
|
||||
layout_mode = 2
|
||||
text = "Pixelorama"
|
||||
|
||||
[node name="OutputScale" type="HBoxContainer" parent="Dialogs/Options/PanelContainer/VBoxContainer"]
|
||||
[node name="OutputScale" type="HBoxContainer" parent="Dialogs/OptionsDialog/PanelContainer/OptionsContainer"]
|
||||
layout_mode = 2
|
||||
alignment = 1
|
||||
|
||||
[node name="Label" type="Label" parent="Dialogs/Options/PanelContainer/VBoxContainer/OutputScale"]
|
||||
[node name="Label" type="Label" parent="Dialogs/OptionsDialog/PanelContainer/OptionsContainer/OutputScale"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "Output Scale:"
|
||||
|
||||
[node name="Size" type="Label" parent="Dialogs/Options/PanelContainer/VBoxContainer/OutputScale"]
|
||||
[node name="Size" type="Label" parent="Dialogs/OptionsDialog/PanelContainer/OptionsContainer/OutputScale"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Resize" type="SpinBox" parent="Dialogs/Options/PanelContainer/VBoxContainer/OutputScale"]
|
||||
[node name="Resize" type="SpinBox" parent="Dialogs/OptionsDialog/PanelContainer/OptionsContainer/OutputScale"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
mouse_default_cursor_shape = 2
|
||||
min_value = 50.0
|
||||
max_value = 1000.0
|
||||
|
@ -216,49 +200,34 @@ value = 100.0
|
|||
allow_greater = true
|
||||
suffix = "%"
|
||||
|
||||
[node name="PathHeader" type="HBoxContainer" parent="Dialogs/Options/PanelContainer/VBoxContainer"]
|
||||
[node name="PathHeader" type="HBoxContainer" parent="Dialogs/OptionsDialog/PanelContainer/OptionsContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 0
|
||||
|
||||
[node name="Label" type="Label" parent="Dialogs/Options/PanelContainer/VBoxContainer/PathHeader"]
|
||||
[node name="Label" type="Label" parent="Dialogs/OptionsDialog/PanelContainer/OptionsContainer/PathHeader"]
|
||||
layout_mode = 2
|
||||
theme_type_variation = &"HeaderSmall"
|
||||
text = "Path"
|
||||
|
||||
[node name="HSeparator" type="HSeparator" parent="Dialogs/Options/PanelContainer/VBoxContainer/PathHeader"]
|
||||
[node name="HSeparator" type="HSeparator" parent="Dialogs/OptionsDialog/PanelContainer/OptionsContainer/PathHeader"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="PathContainer" type="HBoxContainer" parent="Dialogs/Options/PanelContainer/VBoxContainer"]
|
||||
[node name="PathContainer" type="HBoxContainer" parent="Dialogs/OptionsDialog/PanelContainer/OptionsContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Path" type="LineEdit" parent="Dialogs/Options/PanelContainer/VBoxContainer/PathContainer"]
|
||||
[node name="Path" type="LineEdit" parent="Dialogs/OptionsDialog/PanelContainer/OptionsContainer/PathContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
placeholder_text = "Choose Destination --->"
|
||||
placeholder_text = "Choose destination"
|
||||
editable = false
|
||||
|
||||
[node name="Open" type="Button" parent="Dialogs/Options/PanelContainer/VBoxContainer/PathContainer"]
|
||||
custom_minimum_size = Vector2(25, 25)
|
||||
layout_mode = 2
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="Dialogs/Options/PanelContainer/VBoxContainer/PathContainer/Open"]
|
||||
layout_mode = 0
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_left = 2.0
|
||||
offset_top = 2.0
|
||||
offset_right = -2.0
|
||||
offset_bottom = -2.0
|
||||
texture = ExtResource("4")
|
||||
stretch_mode = 6
|
||||
|
||||
[node name="Choose" type="Button" parent="Dialogs/Options/PanelContainer/VBoxContainer/PathContainer"]
|
||||
[node name="Choose" type="Button" parent="Dialogs/OptionsDialog/PanelContainer/OptionsContainer/PathContainer"]
|
||||
layout_mode = 2
|
||||
text = "Choose"
|
||||
|
||||
[node name="Path" type="FileDialog" parent="Dialogs"]
|
||||
[node name="Path" type="FileDialog" parent="Dialogs" groups=["FileDialogs"]]
|
||||
mode = 2
|
||||
exclusive = false
|
||||
popup_window = true
|
||||
|
@ -270,13 +239,10 @@ access = 2
|
|||
[connection signal="pressed" from="ScrollContainer/CenterContainer/GridContainer/TargetProjectOption" to="." method="_on_TargetProjectOption_pressed"]
|
||||
[connection signal="toggled" from="ScrollContainer/CenterContainer/GridContainer/Start" to="." method="_on_Start_toggled"]
|
||||
[connection signal="pressed" from="ScrollContainer/CenterContainer/GridContainer/Settings" to="." method="_on_Settings_pressed"]
|
||||
[connection signal="pressed" from="ScrollContainer/CenterContainer/GridContainer/Folder" to="." method="_on_Open_pressed"]
|
||||
[connection signal="close_requested" from="Dialogs/Options" to="." method="_on_options_close_requested"]
|
||||
[connection signal="value_changed" from="Dialogs/Options/PanelContainer/VBoxContainer/ActionGap/SkipAmount" to="." method="_on_SkipAmount_value_changed"]
|
||||
[connection signal="value_changed" from="Dialogs/Options/PanelContainer/VBoxContainer/Fps/Fps" to="." method="_on_Fps_value_changed"]
|
||||
[connection signal="toggled" from="Dialogs/Options/PanelContainer/VBoxContainer/ModeType/Mode" to="." method="_on_Mode_toggled"]
|
||||
[connection signal="value_changed" from="Dialogs/Options/PanelContainer/VBoxContainer/OutputScale/Resize" to="." method="_on_SpinBox_value_changed"]
|
||||
[connection signal="pressed" from="Dialogs/Options/PanelContainer/VBoxContainer/PathContainer/Open" to="." method="_on_Open_pressed"]
|
||||
[connection signal="pressed" from="Dialogs/Options/PanelContainer/VBoxContainer/PathContainer/Choose" to="." method="_on_Choose_pressed"]
|
||||
[connection signal="pressed" from="ScrollContainer/CenterContainer/GridContainer/OpenFolder" to="." method="_on_open_folder_pressed"]
|
||||
[connection signal="value_changed" from="Dialogs/OptionsDialog/PanelContainer/OptionsContainer/ActionGap/SkipAmount" to="." method="_on_SkipAmount_value_changed"]
|
||||
[connection signal="toggled" from="Dialogs/OptionsDialog/PanelContainer/OptionsContainer/ModeType/Mode" to="." method="_on_Mode_toggled"]
|
||||
[connection signal="value_changed" from="Dialogs/OptionsDialog/PanelContainer/OptionsContainer/OutputScale/Resize" to="." method="_on_SpinBox_value_changed"]
|
||||
[connection signal="pressed" from="Dialogs/OptionsDialog/PanelContainer/OptionsContainer/PathContainer/Choose" to="." method="_on_Choose_pressed"]
|
||||
[connection signal="dir_selected" from="Dialogs/Path" to="." method="_on_Path_dir_selected"]
|
||||
[connection signal="timeout" from="Timer" to="." method="_on_Timer_timeout"]
|
||||
|
|
Loading…
Reference in a new issue