[gd_scene load_steps=5 format=3 uid="uid://clgu8wb5o6oup"]

[ext_resource type="Script" path="res://src/UI/Dialogs/ExportDialog.gd" id="1"]
[ext_resource type="PackedScene" uid="uid://3pmb60gpst7b" path="res://src/UI/Nodes/TransparentChecker.tscn" id="2"]
[ext_resource type="Script" path="res://src/UI/Nodes/CollapsibleContainer.gd" id="3"]
[ext_resource type="Script" path="res://src/UI/Nodes/ValueSlider.gd" id="4"]

[node name="ExportDialog" type="ConfirmationDialog"]
canvas_item_default_texture_filter = 0
title = "Export..."
position = Vector2i(0, 36)
size = Vector2i(700, 600)
exclusive = false
popup_window = true
dialog_hide_on_ok = false
script = ExtResource("1")

[node name="VBoxContainer" type="VBoxContainer" parent="."]
custom_minimum_size = Vector2(330, 0)
offset_left = 8.0
offset_top = 8.0
offset_right = 692.0
offset_bottom = 551.0
size_flags_vertical = 3

[node name="TabBar" type="TabBar" parent="VBoxContainer"]
layout_mode = 2
size_flags_vertical = 0

[node name="HSeparator" type="HSeparator" parent="VBoxContainer"]
layout_mode = 2

[node name="PreviewLabel" type="Label" parent="VBoxContainer"]
layout_mode = 2
text = "Preview:"

[node name="VSplitContainer" type="VSplitContainer" parent="VBoxContainer"]
layout_mode = 2
size_flags_vertical = 3

[node name="PreviewPanel" type="Panel" parent="VBoxContainer/VSplitContainer"]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 3

[node name="TransparentChecker" parent="VBoxContainer/VSplitContainer/PreviewPanel" instance=ExtResource("2")]
unique_name_in_owner = true
layout_mode = 0
anchors_preset = 0
anchor_right = 1.0
anchor_bottom = 1.0

[node name="PreviewScroll" type="ScrollContainer" parent="VBoxContainer/VSplitContainer/PreviewPanel"]
layout_mode = 0
anchor_right = 1.0
anchor_bottom = 1.0
size_flags_horizontal = 3
size_flags_vertical = 3

[node name="Previews" type="GridContainer" parent="VBoxContainer/VSplitContainer/PreviewPanel/PreviewScroll"]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 3
columns = 3

[node name="VBoxContainer" type="VBoxContainer" parent="VBoxContainer/VSplitContainer"]
layout_mode = 2
size_flags_vertical = 3

[node name="GridContainer" type="GridContainer" parent="VBoxContainer/VSplitContainer/VBoxContainer"]
layout_mode = 2
columns = 2

[node name="OrientationLabel" type="Label" parent="VBoxContainer/VSplitContainer/VBoxContainer/GridContainer" groups=["ExportSpritesheetOptions"]]
layout_mode = 2
text = "Orientation:"

[node name="Orientation" type="OptionButton" parent="VBoxContainer/VSplitContainer/VBoxContainer/GridContainer" groups=["ExportSpritesheetOptions"]]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
mouse_default_cursor_shape = 2
item_count = 2
selected = 0
popup/item_0/text = "Rows"
popup/item_0/id = 0
popup/item_1/text = "Columns"
popup/item_1/id = 1

[node name="LinesCountLabel" type="Label" parent="VBoxContainer/VSplitContainer/VBoxContainer/GridContainer" groups=["ExportSpritesheetOptions"]]
unique_name_in_owner = true
layout_mode = 2
text = "Columns:"

[node name="LinesCount" type="SpinBox" parent="VBoxContainer/VSplitContainer/VBoxContainer/GridContainer" groups=["ExportSpritesheetOptions"]]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
mouse_default_cursor_shape = 2
min_value = 1.0
max_value = 1000.0
value = 1.0

[node name="FramesLabel" type="Label" parent="VBoxContainer/VSplitContainer/VBoxContainer/GridContainer"]
layout_mode = 2
size_flags_horizontal = 3
text = "Frames:"

[node name="Frames" type="OptionButton" parent="VBoxContainer/VSplitContainer/VBoxContainer/GridContainer"]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
mouse_default_cursor_shape = 2
item_count = 2
popup/item_0/text = "All frames"
popup/item_0/id = 0
popup/item_1/text = "Selected frames"
popup/item_1/id = 1

[node name="LayersLabel" type="Label" parent="VBoxContainer/VSplitContainer/VBoxContainer/GridContainer"]
layout_mode = 2
text = "Layers:"

[node name="Layers" type="OptionButton" parent="VBoxContainer/VSplitContainer/VBoxContainer/GridContainer"]
unique_name_in_owner = true
layout_mode = 2
mouse_default_cursor_shape = 2
item_count = 2
popup/item_0/text = "Visible layers"
popup/item_0/id = 0
popup/item_1/text = "Selected layers"
popup/item_1/id = 1

[node name="DirectionLabel" type="Label" parent="VBoxContainer/VSplitContainer/VBoxContainer/GridContainer"]
layout_mode = 2
text = "Direction:"

[node name="Direction" type="OptionButton" parent="VBoxContainer/VSplitContainer/VBoxContainer/GridContainer"]
custom_minimum_size = Vector2(100, 0)
layout_mode = 2
size_flags_horizontal = 3
mouse_default_cursor_shape = 2
item_count = 3
selected = 0
popup/item_0/text = "Forward"
popup/item_0/id = 0
popup/item_1/text = "Backwards"
popup/item_1/id = 1
popup/item_2/text = "Ping-pong"
popup/item_2/id = 2

[node name="ResizeLabel" type="Label" parent="VBoxContainer/VSplitContainer/VBoxContainer/GridContainer"]
custom_minimum_size = Vector2(30, 0)
layout_mode = 2
text = "Resize:"

[node name="Resize" type="TextureProgressBar" parent="VBoxContainer/VSplitContainer/VBoxContainer/GridContainer"]
unique_name_in_owner = true
layout_mode = 2
focus_mode = 2
mouse_default_cursor_shape = 2
theme_type_variation = &"ValueSlider"
min_value = 50.0
max_value = 1000.0
step = 50.0
value = 100.0
nine_patch_stretch = true
stretch_margin_left = 3
stretch_margin_top = 3
stretch_margin_right = 3
stretch_margin_bottom = 3
script = ExtResource("4")
suffix = "%"
snap_step = 100.0

[node name="DimensionLabelText" type="Label" parent="VBoxContainer/VSplitContainer/VBoxContainer/GridContainer"]
layout_mode = 2
size_flags_horizontal = 3
text = "Export dimensions:"

[node name="DimensionLabel" type="Label" parent="VBoxContainer/VSplitContainer/VBoxContainer/GridContainer"]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
text = "64×64"

[node name="HSeparator2" type="HSeparator" parent="VBoxContainer/VSplitContainer/VBoxContainer"]
layout_mode = 2

[node name="FilePath" type="GridContainer" parent="VBoxContainer/VSplitContainer/VBoxContainer"]
layout_mode = 2
columns = 3

[node name="Label" type="Label" parent="VBoxContainer/VSplitContainer/VBoxContainer/FilePath" groups=["NotHTML5"]]
custom_minimum_size = Vector2(30, 0)
layout_mode = 2
text = "Path:"

[node name="PathLineEdit" type="LineEdit" parent="VBoxContainer/VSplitContainer/VBoxContainer/FilePath" groups=["NotHTML5"]]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
caret_blink = true
caret_blink_interval = 0.5

[node name="PathButton" type="Button" parent="VBoxContainer/VSplitContainer/VBoxContainer/FilePath" groups=["NotHTML5"]]
layout_mode = 2
mouse_default_cursor_shape = 2
text = "Browse"

[node name="Label2" type="Label" parent="VBoxContainer/VSplitContainer/VBoxContainer/FilePath"]
custom_minimum_size = Vector2(30, 0)
layout_mode = 2
text = "File:"

[node name="FileLineEdit" type="LineEdit" parent="VBoxContainer/VSplitContainer/VBoxContainer/FilePath"]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
text = "untitled"
caret_blink = true
caret_blink_interval = 0.5

[node name="FileFormat" type="OptionButton" parent="VBoxContainer/VSplitContainer/VBoxContainer/FilePath"]
unique_name_in_owner = true
custom_minimum_size = Vector2(130, 0)
layout_mode = 2
mouse_default_cursor_shape = 2

[node name="HSeparator3" type="HSeparator" parent="VBoxContainer/VSplitContainer/VBoxContainer"]
layout_mode = 2

[node name="GifWarning" type="RichTextLabel" parent="VBoxContainer/VSplitContainer/VBoxContainer"]
unique_name_in_owner = true
visible = false
custom_minimum_size = Vector2(0, 50)
layout_mode = 2
bbcode_enabled = true
text = "[center]If exported GIF is distorted, it is recommended to convert to APNG and then use any online tool like [color=blue][url]https://ezgif.com/apng-to-gif[/url][/color] to turn it to GIF[/center]"

[node name="CollapsibleContainer" type="VBoxContainer" parent="VBoxContainer/VSplitContainer/VBoxContainer"]
layout_mode = 2
theme_type_variation = &"CollapsibleContainer"
script = ExtResource("3")
text = "Advanced options"

[node name="GridContainer" type="GridContainer" parent="VBoxContainer/VSplitContainer/VBoxContainer/CollapsibleContainer"]
visible = false
layout_mode = 2
columns = 2

[node name="InterpolationLabel" type="Label" parent="VBoxContainer/VSplitContainer/VBoxContainer/CollapsibleContainer/GridContainer"]
custom_minimum_size = Vector2(30, 0)
layout_mode = 2
size_flags_horizontal = 3
text = "Interpolation:"

[node name="Interpolation" type="OptionButton" parent="VBoxContainer/VSplitContainer/VBoxContainer/CollapsibleContainer/GridContainer"]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
mouse_default_cursor_shape = 2
item_count = 5
selected = 0
popup/item_0/text = "Nearest"
popup/item_0/id = 0
popup/item_1/text = "Bilinear"
popup/item_1/id = 1
popup/item_2/text = "Cubic"
popup/item_2/id = 2
popup/item_3/text = "Trilinear"
popup/item_3/id = 3
popup/item_4/text = "Lanczos"
popup/item_4/id = 4

[node name="IncludeTagsInFilename" type="CheckBox" parent="VBoxContainer/VSplitContainer/VBoxContainer/CollapsibleContainer/GridContainer" groups=["ExportImageOptions", "ExportMultipleFilesOptions"]]
layout_mode = 2
mouse_default_cursor_shape = 2
text = "Include frame tags in the file name"

[node name="MultipleAnimationsDirectories" type="CheckBox" parent="VBoxContainer/VSplitContainer/VBoxContainer/CollapsibleContainer/GridContainer" groups=["ExportImageOptions", "ExportMultipleFilesOptions"]]
visible = false
layout_mode = 2
tooltip_text = "Creates multiple files but every file is stored in different folder that corresponds to its frame tag"
mouse_default_cursor_shape = 2
text = "Create new folder for each frame tag"

[node name="SeparatorCharacterLabel" type="Label" parent="VBoxContainer/VSplitContainer/VBoxContainer/CollapsibleContainer/GridContainer" groups=["ExportImageOptions"]]
custom_minimum_size = Vector2(30, 0)
layout_mode = 2
size_flags_horizontal = 3
text = "Separator character(s):"

[node name="SeparatorCharacter" type="LineEdit" parent="VBoxContainer/VSplitContainer/VBoxContainer/CollapsibleContainer/GridContainer" groups=["ExportImageOptions", "ExportMultipleFilesEditableOptions"]]
layout_mode = 2
tooltip_text = "The character(s) that separate the file name and the frame number"
text = "_"

[node name="Popups" type="Control" parent="."]
layout_mode = 3
anchors_preset = 0
offset_left = 8.0
offset_top = 8.0
offset_right = 692.0
offset_bottom = 551.0
mouse_filter = 2

[node name="PathDialog" type="FileDialog" parent="Popups"]
mode = 2
title = "Open a Directory"
size = Vector2i(675, 500)
ok_button_text = "Select Current Folder"
file_mode = 2
access = 2
show_hidden_files = true

[node name="PathValidationAlert" type="AcceptDialog" parent="Popups"]
dialog_text = "DirAccess path and file name are not valid!"

[node name="FileExistsAlert" type="AcceptDialog" parent="Popups"]
dialog_text = "File %s already exists. Overwrite?"

[node name="ExportProgressBar" type="Window" parent="Popups"]
visible = false
exclusive = true

[node name="MarginContainer" type="MarginContainer" parent="Popups/ExportProgressBar"]
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
offset_left = 5.0
offset_top = 5.0
offset_right = -5.0
offset_bottom = -5.0

[node name="ProgressBar" type="ProgressBar" parent="Popups/ExportProgressBar/MarginContainer"]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3

[node name="FrameTimer" type="Timer" parent="."]

[connection signal="about_to_popup" from="." to="." method="_on_ExportDialog_about_to_show"]
[connection signal="confirmed" from="." to="." method="_on_ExportDialog_confirmed"]
[connection signal="tab_clicked" from="VBoxContainer/TabBar" to="." method="_on_Tabs_tab_clicked"]
[connection signal="item_selected" from="VBoxContainer/VSplitContainer/VBoxContainer/GridContainer/Orientation" to="." method="_on_Orientation_item_selected"]
[connection signal="value_changed" from="VBoxContainer/VSplitContainer/VBoxContainer/GridContainer/LinesCount" to="." method="_on_LinesCount_value_changed"]
[connection signal="item_selected" from="VBoxContainer/VSplitContainer/VBoxContainer/GridContainer/Frames" to="." method="_on_Frames_item_selected"]
[connection signal="item_selected" from="VBoxContainer/VSplitContainer/VBoxContainer/GridContainer/Layers" to="." method="_on_Layers_item_selected"]
[connection signal="item_selected" from="VBoxContainer/VSplitContainer/VBoxContainer/GridContainer/Direction" to="." method="_on_Direction_item_selected"]
[connection signal="value_changed" from="VBoxContainer/VSplitContainer/VBoxContainer/GridContainer/Resize" to="." method="_on_Resize_value_changed"]
[connection signal="text_changed" from="VBoxContainer/VSplitContainer/VBoxContainer/FilePath/PathLineEdit" to="." method="_on_PathLineEdit_text_changed"]
[connection signal="pressed" from="VBoxContainer/VSplitContainer/VBoxContainer/FilePath/PathButton" to="." method="_on_PathButton_pressed"]
[connection signal="text_changed" from="VBoxContainer/VSplitContainer/VBoxContainer/FilePath/FileLineEdit" to="." method="_on_FileLineEdit_text_changed"]
[connection signal="item_selected" from="VBoxContainer/VSplitContainer/VBoxContainer/FilePath/FileFormat" to="." method="_on_FileFormat_item_selected"]
[connection signal="meta_clicked" from="VBoxContainer/VSplitContainer/VBoxContainer/GifWarning" to="." method="_on_GifWarning_meta_clicked"]
[connection signal="item_selected" from="VBoxContainer/VSplitContainer/VBoxContainer/CollapsibleContainer/GridContainer/Interpolation" to="." method="_on_Interpolation_item_selected"]
[connection signal="toggled" from="VBoxContainer/VSplitContainer/VBoxContainer/CollapsibleContainer/GridContainer/IncludeTagsInFilename" to="." method="_on_IncludeTagsInFilename_toggled"]
[connection signal="toggled" from="VBoxContainer/VSplitContainer/VBoxContainer/CollapsibleContainer/GridContainer/MultipleAnimationsDirectories" to="." method="_on_MultipleAnimationsDirectories_toggled"]
[connection signal="text_changed" from="VBoxContainer/VSplitContainer/VBoxContainer/CollapsibleContainer/GridContainer/SeparatorCharacter" to="." method="_on_SeparatorCharacter_text_changed"]
[connection signal="dir_selected" from="Popups/PathDialog" to="." method="_on_FileDialog_dir_selected"]
[connection signal="confirmed" from="Popups/FileExistsAlert" to="." method="_on_FileExistsAlert_confirmed"]
[connection signal="custom_action" from="Popups/FileExistsAlert" to="." method="_on_FileExistsAlert_custom_action"]
[connection signal="timeout" from="FrameTimer" to="." method="_on_FrameTimer_timeout"]
