[gd_scene load_steps=11 format=3 uid="uid://bjah7k4bxo044"]

[ext_resource type="Script" path="res://src/Main.gd" id="1_2625y"]
[ext_resource type="Script" path="res://src/ImageViewport.gd" id="2_hvo65"]
[ext_resource type="Shader" path="res://src/shader/ivd_outline.gdshader" id="3_6xihe"]
[ext_resource type="Script" path="res://src/ImageViewportDisplay.gd" id="3_n4itb"]
[ext_resource type="Script" path="res://src/UIAppVersion.gd" id="5_o1ggv"]
[ext_resource type="Script" path="res://src/UIWindow.gd" id="6_8k0ha"]
[ext_resource type="Script" path="res://src/Editor.gd" id="7_g8bap"]
[ext_resource type="Script" path="res://src/Camera.gd" id="8_mls06"]

[sub_resource type="ShaderMaterial" id="ShaderMaterial_y2ea0"]
shader = ExtResource("3_6xihe")
shader_parameter/zoom_level = Vector2(1, 1)

[sub_resource type="ViewportTexture" id="ViewportTexture_lct1c"]
viewport_path = NodePath("ImageViewport")

[node name="Main" type="Node2D"]
script = ExtResource("1_2625y")

[node name="ImageViewport" type="SubViewport" parent="."]
unique_name_in_owner = true
disable_3d = true
transparent_bg = true
canvas_item_default_texture_filter = 0
render_target_update_mode = 4
script = ExtResource("2_hvo65")

[node name="ImageSprite" type="Sprite2D" parent="ImageViewport"]
unique_name_in_owner = true

[node name="ImageViewportDisplay" type="Sprite2D" parent="."]
unique_name_in_owner = true
material = SubResource("ShaderMaterial_y2ea0")
texture = SubResource("ViewportTexture_lct1c")
script = ExtResource("3_n4itb")

[node name="Camera" type="Camera2D" parent="."]
unique_name_in_owner = true
script = ExtResource("8_mls06")

[node name="EditorWindow" type="Window" parent="."]
unique_name_in_owner = true
disable_3d = true
position = Vector2i(50, 100)
size = Vector2i(600, 700)
script = ExtResource("6_8k0ha")

[node name="UserInterfaceContainer" type="Control" parent="EditorWindow"]
unique_name_in_owner = true
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2

[node name="AppName" type="Label" parent="EditorWindow/UserInterfaceContainer"]
layout_mode = 0
offset_left = 24.0
offset_top = 16.0
offset_right = 208.0
offset_bottom = 48.0
theme_override_font_sizes/font_size = 20
text = "Fragmented"
vertical_alignment = 2

[node name="AppVersion" type="Label" parent="EditorWindow/UserInterfaceContainer"]
layout_mode = 0
offset_left = 152.0
offset_top = 17.0
offset_right = 208.0
offset_bottom = 47.0
theme_override_font_sizes/font_size = 14
text = "v0
"
vertical_alignment = 2
script = ExtResource("5_o1ggv")

[node name="Editor" type="Control" parent="EditorWindow/UserInterfaceContainer"]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
offset_left = 24.0
offset_top = 64.0
offset_right = -24.0
offset_bottom = -24.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("7_g8bap")

[node name="OpenShaderDialog" type="FileDialog" parent="EditorWindow/UserInterfaceContainer/Editor"]
unique_name_in_owner = true
title = "Load Shader"
size = Vector2i(521, 175)
ok_button_text = "Open"
mode_overrides_title = false
file_mode = 0
access = 2
filters = PackedStringArray("*.gdshader")
use_native_dialog = true

[node name="SaveShaderDialog" type="FileDialog" parent="EditorWindow/UserInterfaceContainer/Editor"]
unique_name_in_owner = true
title = "Save Shader"
size = Vector2i(661, 175)
ok_button_text = "Save"
mode_overrides_title = false
access = 2
filters = PackedStringArray("*.gdshader")
use_native_dialog = true

[node name="SaveImageDialog" type="FileDialog" parent="EditorWindow/UserInterfaceContainer/Editor"]
unique_name_in_owner = true
title = "Export Image"
size = Vector2i(661, 175)
ok_button_text = "Save"
mode_overrides_title = false
access = 2
filters = PackedStringArray("*.png")
use_native_dialog = true

[node name="CodeEdit" type="CodeEdit" parent="EditorWindow/UserInterfaceContainer/Editor"]
unique_name_in_owner = true
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
offset_top = 48.0
grow_horizontal = 2
grow_vertical = 2
theme_override_font_sizes/font_size = 14
placeholder_text = "// Test"
wrap_mode = 1
minimap_draw = true
minimap_width = 40
caret_blink = true
draw_control_chars = true
draw_tabs = true
draw_spaces = true
line_length_guidelines = Array[int]([80])
gutters_draw_line_numbers = true
code_completion_enabled = true
indent_automatic = true
auto_brace_completion_enabled = true
auto_brace_completion_highlight_matching = true

[node name="OpenShaderButton" type="Button" parent="EditorWindow/UserInterfaceContainer/Editor"]
layout_mode = 1
offset_right = 56.0
offset_bottom = 32.0
text = "Open"

[node name="SaveShaderButton" type="Button" parent="EditorWindow/UserInterfaceContainer/Editor"]
layout_mode = 1
offset_left = 64.0
offset_right = 120.0
offset_bottom = 32.0
text = "Save"

[node name="ApplyShaderButton" type="Button" parent="EditorWindow/UserInterfaceContainer/Editor"]
layout_mode = 1
offset_left = 128.0
offset_right = 216.0
offset_bottom = 32.0
text = "Apply (F5)"

[node name="SaveImageButton" type="Button" parent="EditorWindow/UserInterfaceContainer/Editor"]
layout_mode = 1
anchors_preset = 1
anchor_left = 1.0
anchor_right = 1.0
offset_left = -120.0
offset_bottom = 32.0
grow_horizontal = 0
text = "Export Image"

[node name="FitImageButton" type="Button" parent="EditorWindow/UserInterfaceContainer/Editor"]
layout_mode = 1
anchors_preset = 1
anchor_left = 1.0
anchor_right = 1.0
offset_left = -216.0
offset_right = -128.0
offset_bottom = 32.0
grow_horizontal = 0
text = "Fit Image"

[connection signal="close_requested" from="EditorWindow" to="EditorWindow" method="_on_close_requested"]
[connection signal="file_selected" from="EditorWindow/UserInterfaceContainer/Editor/OpenShaderDialog" to="EditorWindow/UserInterfaceContainer/Editor" method="_on_open_shader_dialog_file_selected"]
[connection signal="file_selected" from="EditorWindow/UserInterfaceContainer/Editor/SaveShaderDialog" to="EditorWindow/UserInterfaceContainer/Editor" method="_on_save_shader_dialog_file_selected"]
[connection signal="file_selected" from="EditorWindow/UserInterfaceContainer/Editor/SaveImageDialog" to="EditorWindow/UserInterfaceContainer/Editor" method="_on_save_image_dialog_file_selected"]
[connection signal="code_completion_requested" from="EditorWindow/UserInterfaceContainer/Editor/CodeEdit" to="EditorWindow/UserInterfaceContainer/Editor" method="_on_code_edit_code_completion_requested"]
[connection signal="pressed" from="EditorWindow/UserInterfaceContainer/Editor/OpenShaderButton" to="EditorWindow/UserInterfaceContainer/Editor" method="_on_open_shader_button_pressed"]
[connection signal="pressed" from="EditorWindow/UserInterfaceContainer/Editor/SaveShaderButton" to="EditorWindow/UserInterfaceContainer/Editor" method="_on_save_shader_button_pressed"]
[connection signal="pressed" from="EditorWindow/UserInterfaceContainer/Editor/ApplyShaderButton" to="EditorWindow/UserInterfaceContainer/Editor" method="_on_apply_shader_button_pressed"]
[connection signal="pressed" from="EditorWindow/UserInterfaceContainer/Editor/SaveImageButton" to="EditorWindow/UserInterfaceContainer/Editor" method="_on_save_image_button_pressed"]
[connection signal="pressed" from="EditorWindow/UserInterfaceContainer/Editor/FitImageButton" to="Camera" method="_on_fit_image_button_pressed"]
