diff --git a/godot/.godot/imported/AnonymousPro-Bold.ttf-9d8fef4d357af5b52cd60afbe608aa49.fontdata b/godot/.godot/imported/AnonymousPro-Bold.ttf-9d8fef4d357af5b52cd60afbe608aa49.fontdata index f1d0907..0a686c4 100644 Binary files a/godot/.godot/imported/AnonymousPro-Bold.ttf-9d8fef4d357af5b52cd60afbe608aa49.fontdata and b/godot/.godot/imported/AnonymousPro-Bold.ttf-9d8fef4d357af5b52cd60afbe608aa49.fontdata differ diff --git a/godot/.godot/imported/AnonymousPro-Bold.ttf-9d8fef4d357af5b52cd60afbe608aa49.md5 b/godot/.godot/imported/AnonymousPro-Bold.ttf-9d8fef4d357af5b52cd60afbe608aa49.md5 index eeec8d1..6e19aa3 100644 --- a/godot/.godot/imported/AnonymousPro-Bold.ttf-9d8fef4d357af5b52cd60afbe608aa49.md5 +++ b/godot/.godot/imported/AnonymousPro-Bold.ttf-9d8fef4d357af5b52cd60afbe608aa49.md5 @@ -1,3 +1,3 @@ source_md5="401e77d048b500d714375a77d4ca4326" -dest_md5="e5a412eda16e1d823e7edfffe7460b67" +dest_md5="3dd5c0136c49a94152e320f954261b2e" diff --git a/godot/.godot/imported/AnonymousPro-BoldItalic.ttf-4274bf704d3d6b9cd32c4f0754d8c83d.fontdata b/godot/.godot/imported/AnonymousPro-BoldItalic.ttf-4274bf704d3d6b9cd32c4f0754d8c83d.fontdata index 71b31fe..8215486 100644 Binary files a/godot/.godot/imported/AnonymousPro-BoldItalic.ttf-4274bf704d3d6b9cd32c4f0754d8c83d.fontdata and b/godot/.godot/imported/AnonymousPro-BoldItalic.ttf-4274bf704d3d6b9cd32c4f0754d8c83d.fontdata differ diff --git a/godot/.godot/imported/AnonymousPro-BoldItalic.ttf-4274bf704d3d6b9cd32c4f0754d8c83d.md5 b/godot/.godot/imported/AnonymousPro-BoldItalic.ttf-4274bf704d3d6b9cd32c4f0754d8c83d.md5 index 38e0726..b7f1b26 100644 --- a/godot/.godot/imported/AnonymousPro-BoldItalic.ttf-4274bf704d3d6b9cd32c4f0754d8c83d.md5 +++ b/godot/.godot/imported/AnonymousPro-BoldItalic.ttf-4274bf704d3d6b9cd32c4f0754d8c83d.md5 @@ -1,3 +1,3 @@ source_md5="75a018507317f09d0004b8c1148dd3e5" -dest_md5="679d3767ce4f77408ad994917e598186" +dest_md5="17b170ffcc65bc4f70081e448257cb8f" diff --git a/godot/.godot/imported/AnonymousPro-Italic.ttf-9989590b02137b799e13d570de2a42c1.fontdata b/godot/.godot/imported/AnonymousPro-Italic.ttf-9989590b02137b799e13d570de2a42c1.fontdata index 52be5b0..6725978 100644 Binary files a/godot/.godot/imported/AnonymousPro-Italic.ttf-9989590b02137b799e13d570de2a42c1.fontdata and b/godot/.godot/imported/AnonymousPro-Italic.ttf-9989590b02137b799e13d570de2a42c1.fontdata differ diff --git a/godot/.godot/imported/AnonymousPro-Italic.ttf-9989590b02137b799e13d570de2a42c1.md5 b/godot/.godot/imported/AnonymousPro-Italic.ttf-9989590b02137b799e13d570de2a42c1.md5 index 136b902..62c1663 100644 --- a/godot/.godot/imported/AnonymousPro-Italic.ttf-9989590b02137b799e13d570de2a42c1.md5 +++ b/godot/.godot/imported/AnonymousPro-Italic.ttf-9989590b02137b799e13d570de2a42c1.md5 @@ -1,3 +1,3 @@ source_md5="b3f0e3061651d3bf5c65104a3179e57b" -dest_md5="f7aff71c2f9645f52c2212eb216dc6a5" +dest_md5="5a32fb564648217ac0c89272e6e5140e" diff --git a/godot/.godot/imported/AnonymousPro-Regular.ttf-856c843fd6f89964d2ca8d8ff1724f13.fontdata b/godot/.godot/imported/AnonymousPro-Regular.ttf-856c843fd6f89964d2ca8d8ff1724f13.fontdata index 5f05d69..c5527aa 100644 Binary files a/godot/.godot/imported/AnonymousPro-Regular.ttf-856c843fd6f89964d2ca8d8ff1724f13.fontdata and b/godot/.godot/imported/AnonymousPro-Regular.ttf-856c843fd6f89964d2ca8d8ff1724f13.fontdata differ diff --git a/godot/.godot/imported/AnonymousPro-Regular.ttf-856c843fd6f89964d2ca8d8ff1724f13.md5 b/godot/.godot/imported/AnonymousPro-Regular.ttf-856c843fd6f89964d2ca8d8ff1724f13.md5 index 49ec735..7843487 100644 --- a/godot/.godot/imported/AnonymousPro-Regular.ttf-856c843fd6f89964d2ca8d8ff1724f13.md5 +++ b/godot/.godot/imported/AnonymousPro-Regular.ttf-856c843fd6f89964d2ca8d8ff1724f13.md5 @@ -1,3 +1,3 @@ source_md5="418d6668afcddb7714104f43bfb39657" -dest_md5="833039e4737803291cf2a1b80ded72e8" +dest_md5="2285d871ce78dd567083103f4c89cc0d" diff --git a/godot/.godot/imported/CourierPrime-Bold.ttf-1f003c66d63ebed70964e7756f4fa235.fontdata b/godot/.godot/imported/CourierPrime-Bold.ttf-1f003c66d63ebed70964e7756f4fa235.fontdata index 4dc0694..6bca885 100644 Binary files a/godot/.godot/imported/CourierPrime-Bold.ttf-1f003c66d63ebed70964e7756f4fa235.fontdata and b/godot/.godot/imported/CourierPrime-Bold.ttf-1f003c66d63ebed70964e7756f4fa235.fontdata differ diff --git a/godot/.godot/imported/CourierPrime-Bold.ttf-1f003c66d63ebed70964e7756f4fa235.md5 b/godot/.godot/imported/CourierPrime-Bold.ttf-1f003c66d63ebed70964e7756f4fa235.md5 index 94a8c46..29f5c42 100644 --- a/godot/.godot/imported/CourierPrime-Bold.ttf-1f003c66d63ebed70964e7756f4fa235.md5 +++ b/godot/.godot/imported/CourierPrime-Bold.ttf-1f003c66d63ebed70964e7756f4fa235.md5 @@ -1,3 +1,3 @@ source_md5="696e70ec3151341523d0a1362670d8ad" -dest_md5="66128c4c7d6f88412784bff3d7ec6833" +dest_md5="01c280be7e21eeb9de24ab0dc8d54aac" diff --git a/godot/.godot/imported/CourierPrime-BoldItalic.ttf-65ebcc61dd5e1dfa8f96313da4ad7019.fontdata b/godot/.godot/imported/CourierPrime-BoldItalic.ttf-65ebcc61dd5e1dfa8f96313da4ad7019.fontdata index 8312906..42a887b 100644 Binary files a/godot/.godot/imported/CourierPrime-BoldItalic.ttf-65ebcc61dd5e1dfa8f96313da4ad7019.fontdata and b/godot/.godot/imported/CourierPrime-BoldItalic.ttf-65ebcc61dd5e1dfa8f96313da4ad7019.fontdata differ diff --git a/godot/.godot/imported/CourierPrime-BoldItalic.ttf-65ebcc61dd5e1dfa8f96313da4ad7019.md5 b/godot/.godot/imported/CourierPrime-BoldItalic.ttf-65ebcc61dd5e1dfa8f96313da4ad7019.md5 index f666f99..77f0f11 100644 --- a/godot/.godot/imported/CourierPrime-BoldItalic.ttf-65ebcc61dd5e1dfa8f96313da4ad7019.md5 +++ b/godot/.godot/imported/CourierPrime-BoldItalic.ttf-65ebcc61dd5e1dfa8f96313da4ad7019.md5 @@ -1,3 +1,3 @@ source_md5="15e9706fbc67b38db21e8e963fc1a6c0" -dest_md5="9d42ca86e45e35f527268a50ff3302c1" +dest_md5="39d0d078f220a4199c355494f828e34d" diff --git a/godot/.godot/imported/CourierPrime-Italic.ttf-baa9156a73770735a0f72fb20b907112.fontdata b/godot/.godot/imported/CourierPrime-Italic.ttf-baa9156a73770735a0f72fb20b907112.fontdata index 0408568..76ce7d9 100644 Binary files a/godot/.godot/imported/CourierPrime-Italic.ttf-baa9156a73770735a0f72fb20b907112.fontdata and b/godot/.godot/imported/CourierPrime-Italic.ttf-baa9156a73770735a0f72fb20b907112.fontdata differ diff --git a/godot/.godot/imported/CourierPrime-Italic.ttf-baa9156a73770735a0f72fb20b907112.md5 b/godot/.godot/imported/CourierPrime-Italic.ttf-baa9156a73770735a0f72fb20b907112.md5 index 4117698..8018c01 100644 --- a/godot/.godot/imported/CourierPrime-Italic.ttf-baa9156a73770735a0f72fb20b907112.md5 +++ b/godot/.godot/imported/CourierPrime-Italic.ttf-baa9156a73770735a0f72fb20b907112.md5 @@ -1,3 +1,3 @@ source_md5="ace04e0c254883041bc7effb9d951cf2" -dest_md5="01bbdd6ea5ed5db11c72d6b8ddc09e57" +dest_md5="d30842060c67fa252449f2a2261dc412" diff --git a/godot/.godot/imported/CourierPrime-Regular.ttf-3babe7e4a7a588dfc9a84c14b4f1fe23.fontdata b/godot/.godot/imported/CourierPrime-Regular.ttf-3babe7e4a7a588dfc9a84c14b4f1fe23.fontdata index ba38145..7e39c85 100644 Binary files a/godot/.godot/imported/CourierPrime-Regular.ttf-3babe7e4a7a588dfc9a84c14b4f1fe23.fontdata and b/godot/.godot/imported/CourierPrime-Regular.ttf-3babe7e4a7a588dfc9a84c14b4f1fe23.fontdata differ diff --git a/godot/.godot/imported/CourierPrime-Regular.ttf-3babe7e4a7a588dfc9a84c14b4f1fe23.md5 b/godot/.godot/imported/CourierPrime-Regular.ttf-3babe7e4a7a588dfc9a84c14b4f1fe23.md5 index f78f684..fd97ef5 100644 --- a/godot/.godot/imported/CourierPrime-Regular.ttf-3babe7e4a7a588dfc9a84c14b4f1fe23.md5 +++ b/godot/.godot/imported/CourierPrime-Regular.ttf-3babe7e4a7a588dfc9a84c14b4f1fe23.md5 @@ -1,3 +1,3 @@ source_md5="03ef685b34f3356631c3f60c91917002" -dest_md5="49ab49592f43367f99e411b6beb096bf" +dest_md5="7d5ca5739cab625583e757a89311e37a" diff --git a/godot/.godot/imported/LobsterTwo-Bold.ttf-7c7f734103b58a32491a4788186f3dcb.fontdata b/godot/.godot/imported/LobsterTwo-Bold.ttf-7c7f734103b58a32491a4788186f3dcb.fontdata index ca875d0..a490267 100644 Binary files a/godot/.godot/imported/LobsterTwo-Bold.ttf-7c7f734103b58a32491a4788186f3dcb.fontdata and b/godot/.godot/imported/LobsterTwo-Bold.ttf-7c7f734103b58a32491a4788186f3dcb.fontdata differ diff --git a/godot/.godot/imported/LobsterTwo-Bold.ttf-7c7f734103b58a32491a4788186f3dcb.md5 b/godot/.godot/imported/LobsterTwo-Bold.ttf-7c7f734103b58a32491a4788186f3dcb.md5 index 2924b64..96fcc90 100644 --- a/godot/.godot/imported/LobsterTwo-Bold.ttf-7c7f734103b58a32491a4788186f3dcb.md5 +++ b/godot/.godot/imported/LobsterTwo-Bold.ttf-7c7f734103b58a32491a4788186f3dcb.md5 @@ -1,3 +1,3 @@ source_md5="a39e5778312a715a82d7afe88ebac015" -dest_md5="2ff03d243427673442953485f72ee755" +dest_md5="485a5da882b11c299378bc9c94a16d16" diff --git a/godot/.godot/imported/LobsterTwo-BoldItalic.ttf-227406a33e84448e6aa974176016de19.fontdata b/godot/.godot/imported/LobsterTwo-BoldItalic.ttf-227406a33e84448e6aa974176016de19.fontdata index 670ce47..7e7d4af 100644 Binary files a/godot/.godot/imported/LobsterTwo-BoldItalic.ttf-227406a33e84448e6aa974176016de19.fontdata and b/godot/.godot/imported/LobsterTwo-BoldItalic.ttf-227406a33e84448e6aa974176016de19.fontdata differ diff --git a/godot/.godot/imported/LobsterTwo-BoldItalic.ttf-227406a33e84448e6aa974176016de19.md5 b/godot/.godot/imported/LobsterTwo-BoldItalic.ttf-227406a33e84448e6aa974176016de19.md5 index c115d4e..e50de0c 100644 --- a/godot/.godot/imported/LobsterTwo-BoldItalic.ttf-227406a33e84448e6aa974176016de19.md5 +++ b/godot/.godot/imported/LobsterTwo-BoldItalic.ttf-227406a33e84448e6aa974176016de19.md5 @@ -1,3 +1,3 @@ source_md5="9f56fb2bffbac7662cb53b783248698a" -dest_md5="4095d2e475b73f7e3cfa641bf08a58ee" +dest_md5="76e6ba40e3eb9766efa798435214eda7" diff --git a/godot/.godot/imported/LobsterTwo-Italic.ttf-f93abf6c25390c85ad5fb6c4ee75159e.fontdata b/godot/.godot/imported/LobsterTwo-Italic.ttf-f93abf6c25390c85ad5fb6c4ee75159e.fontdata index f1ff8ac..ff72a6c 100644 Binary files a/godot/.godot/imported/LobsterTwo-Italic.ttf-f93abf6c25390c85ad5fb6c4ee75159e.fontdata and b/godot/.godot/imported/LobsterTwo-Italic.ttf-f93abf6c25390c85ad5fb6c4ee75159e.fontdata differ diff --git a/godot/.godot/imported/LobsterTwo-Italic.ttf-f93abf6c25390c85ad5fb6c4ee75159e.md5 b/godot/.godot/imported/LobsterTwo-Italic.ttf-f93abf6c25390c85ad5fb6c4ee75159e.md5 index a4e8d20..df49276 100644 --- a/godot/.godot/imported/LobsterTwo-Italic.ttf-f93abf6c25390c85ad5fb6c4ee75159e.md5 +++ b/godot/.godot/imported/LobsterTwo-Italic.ttf-f93abf6c25390c85ad5fb6c4ee75159e.md5 @@ -1,3 +1,3 @@ source_md5="40a68e931d9f1c543eac616acb53b2d8" -dest_md5="8227e06ec0fc86a3d61b098543bce7be" +dest_md5="0711b0b264cced887a896c6b362c5432" diff --git a/godot/.godot/imported/LobsterTwo-Regular.ttf-f3fcfa01cd671c8da433dd875d0fe04b.fontdata b/godot/.godot/imported/LobsterTwo-Regular.ttf-f3fcfa01cd671c8da433dd875d0fe04b.fontdata index 4ed88ad..9bcd159 100644 Binary files a/godot/.godot/imported/LobsterTwo-Regular.ttf-f3fcfa01cd671c8da433dd875d0fe04b.fontdata and b/godot/.godot/imported/LobsterTwo-Regular.ttf-f3fcfa01cd671c8da433dd875d0fe04b.fontdata differ diff --git a/godot/.godot/imported/LobsterTwo-Regular.ttf-f3fcfa01cd671c8da433dd875d0fe04b.md5 b/godot/.godot/imported/LobsterTwo-Regular.ttf-f3fcfa01cd671c8da433dd875d0fe04b.md5 index 8584f9c..cbad32c 100644 --- a/godot/.godot/imported/LobsterTwo-Regular.ttf-f3fcfa01cd671c8da433dd875d0fe04b.md5 +++ b/godot/.godot/imported/LobsterTwo-Regular.ttf-f3fcfa01cd671c8da433dd875d0fe04b.md5 @@ -1,3 +1,3 @@ source_md5="fb8c29136b1ee99fe9dd45a6f8bcc9fd" -dest_md5="e4bf8ae34f8a7fee963c13a5edb43c55" +dest_md5="0476ac6f1416d7e9a5f20c1d6194f9d9" diff --git a/godot/.godot/imported/source_code_pro.fnt-042fb383b3c7b4c19e67c852f7fbefca.fontdata b/godot/.godot/imported/source_code_pro.fnt-042fb383b3c7b4c19e67c852f7fbefca.fontdata index 3e6121c..6e92656 100644 Binary files a/godot/.godot/imported/source_code_pro.fnt-042fb383b3c7b4c19e67c852f7fbefca.fontdata and b/godot/.godot/imported/source_code_pro.fnt-042fb383b3c7b4c19e67c852f7fbefca.fontdata differ diff --git a/godot/.godot/imported/source_code_pro.fnt-042fb383b3c7b4c19e67c852f7fbefca.md5 b/godot/.godot/imported/source_code_pro.fnt-042fb383b3c7b4c19e67c852f7fbefca.md5 index 00eb35b..b013c56 100644 --- a/godot/.godot/imported/source_code_pro.fnt-042fb383b3c7b4c19e67c852f7fbefca.md5 +++ b/godot/.godot/imported/source_code_pro.fnt-042fb383b3c7b4c19e67c852f7fbefca.md5 @@ -1,3 +1,3 @@ source_md5="6b13e81eab722af33d424ec5a589068e" -dest_md5="77e111b8cff5ee07c66010f63ca68801" +dest_md5="0e08e30ca3840f7c9c47e91820bd98bb" diff --git a/godot/src/script_editor/button_add.gd b/godot/src/script_editor/button_add.gd index b187982..89c6a46 100644 --- a/godot/src/script_editor/button_add.gd +++ b/godot/src/script_editor/button_add.gd @@ -2,4 +2,4 @@ extends Button func _on_pressed(): - API.insert(200) + API.ast_add(200) diff --git a/godot/src/script_editor/main.tscn b/godot/src/script_editor/main.tscn index e2cc548..41db562 100644 --- a/godot/src/script_editor/main.tscn +++ b/godot/src/script_editor/main.tscn @@ -2,7 +2,7 @@ [ext_resource type="Script" path="res://src/script_editor/button_run.gd" id="1_2l7lb"] [ext_resource type="Script" path="res://src/script_editor/button_add.gd" id="2_vfewj"] -[ext_resource type="Script" path="res://src/script_editor/auto_refresh_fragments.gd" id="3_6u76r"] +[ext_resource type="Script" path="res://src/script_editor/auto_refresh_sprites.gd" id="3_po0h4"] [node name="ScriptEditor" type="Control"] layout_mode = 3 @@ -44,7 +44,7 @@ size_flags_vertical = 3 [node name="AutoRefresh" type="VBoxContainer" parent="VBoxContainer/VScrollContainer"] layout_mode = 2 -script = ExtResource("3_6u76r") +script = ExtResource("3_po0h4") [node name="Code" type="VBoxContainer" parent="VBoxContainer/VScrollContainer/AutoRefresh"] layout_mode = 2 diff --git a/godot/src/sprite_selector/main.gd b/godot/src/sprite_selector/main.gd deleted file mode 100644 index d063791..0000000 --- a/godot/src/sprite_selector/main.gd +++ /dev/null @@ -1,13 +0,0 @@ -extends Control - -var Sprites: Resource = preload("res://src/sprite_selector/sprite.tscn") - - -func _on_add_sprite_button_pressed(): - $FileDialog.popup_centered() - - -func _on_file_dialog_file_selected(path): - var sprite = Sprites.instantiate() - sprite.setup(path) - get_node("VBoxContainer2/VBox/ScrollContainer/VBoxIntems").add_child(sprite) diff --git a/godot/src/sprite_selector/main.tscn b/godot/src/sprite_selector/main.tscn index 48421ba..b01a299 100644 --- a/godot/src/sprite_selector/main.tscn +++ b/godot/src/sprite_selector/main.tscn @@ -1,7 +1,7 @@ [gd_scene load_steps=5 format=3 uid="uid://bs2465qtho3bu"] -[ext_resource type="Script" path="res://src/sprite_selector/main.gd" id="1_w6ncu"] -[ext_resource type="Script" path="res://src/sprite_selector/sprite_list.gd" id="2_y3h1p"] +[ext_resource type="Script" path="res://src/sprite_selector/button_add_sprite.gd" id="2_66054"] +[ext_resource type="Script" path="res://src/sprite_selector/auto_refresh_sprites.gd" id="2_wryc7"] [sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_kefq6"] @@ -16,19 +16,6 @@ grow_horizontal = 2 grow_vertical = 2 size_flags_horizontal = 3 size_flags_vertical = 3 -script = ExtResource("1_w6ncu") - -[node name="FileDialog" type="FileDialog" parent="."] -title = "Open a File" -size = Vector2i(479, 400) -exclusive = false -ok_button_text = "Open" -dialog_hide_on_ok = true -dialog_autowrap = true -file_mode = 0 -access = 2 -filters = PackedStringArray("*.png", "*.jpg", "*.jpeg", "*.svg") -use_native_dialog = true [node name="VBoxContainer2" type="VBoxContainer" parent="."] layout_direction = 2 @@ -63,6 +50,15 @@ size_flags_horizontal = 0 theme_override_styles/pressed = SubResource("StyleBoxEmpty_kefq6") theme_override_styles/focus = SubResource("StyleBoxEmpty_s6hla") text = "Add Sprite" +script = ExtResource("2_66054") + +[node name="FileDialog" type="FileDialog" parent="VBoxContainer2/HBoxContainer/MarginContainer/AddSpriteButton"] +title = "Open a File" +size = Vector2i(511, 159) +ok_button_text = "Open" +file_mode = 0 +access = 2 +use_native_dialog = true [node name="VBox" type="VBoxContainer" parent="VBoxContainer2"] layout_mode = 2 @@ -72,11 +68,14 @@ size_flags_vertical = 3 layout_mode = 2 size_flags_vertical = 3 -[node name="VBoxIntems" type="VBoxContainer" parent="VBoxContainer2/VBox/ScrollContainer"] +[node name="AutoRefresh" type="VBoxContainer" parent="VBoxContainer2/VBox/ScrollContainer"] +layout_mode = 2 +script = ExtResource("2_wryc7") + +[node name="VBoxIntems" type="VBoxContainer" parent="VBoxContainer2/VBox/ScrollContainer/AutoRefresh"] layout_mode = 2 size_flags_horizontal = 3 size_flags_vertical = 3 -script = ExtResource("2_y3h1p") -[connection signal="file_selected" from="FileDialog" to="." method="_on_file_dialog_file_selected"] -[connection signal="pressed" from="VBoxContainer2/HBoxContainer/MarginContainer/AddSpriteButton" to="." method="_on_add_sprite_button_pressed"] +[connection signal="pressed" from="VBoxContainer2/HBoxContainer/MarginContainer/AddSpriteButton" to="VBoxContainer2/HBoxContainer/MarginContainer/AddSpriteButton" method="_on_pressed"] +[connection signal="file_selected" from="VBoxContainer2/HBoxContainer/MarginContainer/AddSpriteButton/FileDialog" to="VBoxContainer2/HBoxContainer/MarginContainer/AddSpriteButton" method="_on_file_dialog_file_selected"] diff --git a/godot/src/sprite_selector/sprite.gd b/godot/src/sprite_selector/sprite.gd index 43642c7..f803d2f 100644 --- a/godot/src/sprite_selector/sprite.gd +++ b/godot/src/sprite_selector/sprite.gd @@ -6,7 +6,6 @@ func setup(path): img.load(path) var tex = ImageTexture.new() tex.set_image(img) - var label = get_node("VBoxContainer/Label") $VBoxContainer/TextureRect.texture = tex $VBoxContainer/Label.text = path self.expand_icon = true diff --git a/godot/src/sprite_selector/sprite_list.gd b/godot/src/sprite_selector/sprite_list.gd deleted file mode 100644 index 1cf6323..0000000 --- a/godot/src/sprite_selector/sprite_list.gd +++ /dev/null @@ -1,12 +0,0 @@ -extends VBoxContainer - -const Sprite: Resource = preload("res://src/sprite_selector/sprite.tscn") - - -func render_ast(ast): - var code_container := get_tree() - for old in code_container.get_children(): - code_container.remove_child(old) - - for fragment in ast: - code_container.add_child(Sprite.instantiate()) diff --git a/rust/Cargo.lock b/rust/Cargo.lock index bb810f7..04066a7 100644 --- a/rust/Cargo.lock +++ b/rust/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "aho-corasick" -version = "1.1.2" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" dependencies = [ "memchr", ] @@ -35,9 +35,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.12" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" +checksum = "94b22e06ecb0110981051723910cbf0b5f5e09a2062dd7663334ee79a9d1286c" dependencies = [ "cfg-if", "libc", @@ -53,7 +53,7 @@ checksum = "9e05e7e6723e3455f4818c7b26e855439f7546cf617ef669d1adedb8669e5cb9" [[package]] name = "godot" version = "0.1.0" -source = "git+https://github.com/godot-rust/gdext?branch=master#7482941eed1637329641bd466e64fc0bacf3f8fc" +source = "git+https://github.com/godot-rust/gdext?branch=master#ca586182f430df3fb4ef8548d43bc756ce92022e" dependencies = [ "godot-core", "godot-macros", @@ -62,7 +62,7 @@ dependencies = [ [[package]] name = "godot-bindings" version = "0.1.0" -source = "git+https://github.com/godot-rust/gdext?branch=master#7482941eed1637329641bd466e64fc0bacf3f8fc" +source = "git+https://github.com/godot-rust/gdext?branch=master#ca586182f430df3fb4ef8548d43bc756ce92022e" dependencies = [ "godot4-prebuilt", ] @@ -70,12 +70,12 @@ dependencies = [ [[package]] name = "godot-cell" version = "0.1.0" -source = "git+https://github.com/godot-rust/gdext?branch=master#7482941eed1637329641bd466e64fc0bacf3f8fc" +source = "git+https://github.com/godot-rust/gdext?branch=master#ca586182f430df3fb4ef8548d43bc756ce92022e" [[package]] name = "godot-codegen" version = "0.1.0" -source = "git+https://github.com/godot-rust/gdext?branch=master#7482941eed1637329641bd466e64fc0bacf3f8fc" +source = "git+https://github.com/godot-rust/gdext?branch=master#ca586182f430df3fb4ef8548d43bc756ce92022e" dependencies = [ "godot-bindings", "godot-fmt", @@ -89,7 +89,7 @@ dependencies = [ [[package]] name = "godot-core" version = "0.1.0" -source = "git+https://github.com/godot-rust/gdext?branch=master#7482941eed1637329641bd466e64fc0bacf3f8fc" +source = "git+https://github.com/godot-rust/gdext?branch=master#ca586182f430df3fb4ef8548d43bc756ce92022e" dependencies = [ "glam", "godot-bindings", @@ -101,7 +101,7 @@ dependencies = [ [[package]] name = "godot-ffi" version = "0.1.0" -source = "git+https://github.com/godot-rust/gdext?branch=master#7482941eed1637329641bd466e64fc0bacf3f8fc" +source = "git+https://github.com/godot-rust/gdext?branch=master#ca586182f430df3fb4ef8548d43bc756ce92022e" dependencies = [ "gensym", "godot-bindings", @@ -113,7 +113,7 @@ dependencies = [ [[package]] name = "godot-fmt" version = "0.1.0" -source = "git+https://github.com/godot-rust/gdext?branch=master#7482941eed1637329641bd466e64fc0bacf3f8fc" +source = "git+https://github.com/godot-rust/gdext?branch=master#ca586182f430df3fb4ef8548d43bc756ce92022e" dependencies = [ "proc-macro2", ] @@ -121,7 +121,7 @@ dependencies = [ [[package]] name = "godot-macros" version = "0.1.0" -source = "git+https://github.com/godot-rust/gdext?branch=master#7482941eed1637329641bd466e64fc0bacf3f8fc" +source = "git+https://github.com/godot-rust/gdext?branch=master#ca586182f430df3fb4ef8548d43bc756ce92022e" dependencies = [ "godot-bindings", "proc-macro2", @@ -156,9 +156,9 @@ checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" [[package]] name = "memchr" -version = "2.7.1" +version = "2.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" +checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" [[package]] name = "nanoserde" @@ -183,27 +183,27 @@ checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" [[package]] name = "proc-macro2" -version = "1.0.79" +version = "1.0.81" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e835ff2298f5721608eb1a980ecaee1aef2c132bf95ecc026a11b7bf3c01c02e" +checksum = "3d1597b0c024618f09a9c3b8655b7e430397a36d23fdafec26d6965e9eec3eba" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.35" +version = "1.0.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" dependencies = [ "proc-macro2", ] [[package]] name = "regex" -version = "1.10.3" +version = "1.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b62dbe01f0b06f9d8dc7d49e05a0785f153b00b2c227856282f671e0318c9b15" +checksum = "c117dbdfde9c8308975b6a18d71f3f385c89461f7b3fb054288ecf2a2058ba4c" dependencies = [ "aho-corasick", "memchr", @@ -224,15 +224,15 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.8.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" +checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56" [[package]] name = "syn" -version = "2.0.52" +version = "2.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b699d15b36d1f02c3e7c69f8ffef53de37aefae075d8488d4ba1a7788d574a07" +checksum = "909518bc7b1c9b779f1bbf07f2929d35af9f0f37e47c6e9ef7f9dddc1e1821f3" dependencies = [ "proc-macro2", "quote", @@ -247,9 +247,9 @@ checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] name = "uuid" -version = "1.7.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f00cc9702ca12d3c81455259621e676d0f7251cec66a21e98fe2e9a37db93b2a" +checksum = "a183cf7feeba97b4dd1c0d46788634f6221d87fa961b305bed08c851829efcc0" dependencies = [ "getrandom", ] diff --git a/rust/compiler/src/ast.rs b/rust/compiler/src/ast.rs index dd07dfd..2d242a1 100644 --- a/rust/compiler/src/ast.rs +++ b/rust/compiler/src/ast.rs @@ -15,7 +15,7 @@ pub struct Commands { commands: Vec, } -#[derive(Clone)] +#[derive(Clone, Debug)] pub enum Statement { Move(), Message(Message), @@ -23,14 +23,14 @@ pub enum Statement { } #[allow(dead_code)] -#[derive(Clone)] +#[derive(Clone, Debug)] pub struct Message { from: String, to: String, contents: Expression, } -#[derive(Clone)] +#[derive(Clone, Debug)] pub enum Expression { Addition(Box, Box), Subtraction(Box, Box), diff --git a/rust/compiler/src/lib.rs b/rust/compiler/src/lib.rs index f15e83c..9231261 100644 --- a/rust/compiler/src/lib.rs +++ b/rust/compiler/src/lib.rs @@ -1,6 +1,6 @@ pub mod ast; -#[derive(Default)] +#[derive(Default, Debug)] pub struct Ast { statements: Vec, } diff --git a/rust/godot-plugin/Cargo.toml b/rust/godot-plugin/Cargo.toml index cfa15c9..6973c07 100644 --- a/rust/godot-plugin/Cargo.toml +++ b/rust/godot-plugin/Cargo.toml @@ -9,5 +9,5 @@ edition = "2021" crate-type = ["cdylib"] [dependencies] -godot = { git = "https://github.com/godot-rust/gdext", branch = "master" } compiler = { path = "../compiler"} +godot = { git = "https://github.com/godot-rust/gdext", branch = "master" } diff --git a/rust/godot-plugin/src/lib.rs b/rust/godot-plugin/src/lib.rs index d94e553..277bf08 100644 --- a/rust/godot-plugin/src/lib.rs +++ b/rust/godot-plugin/src/lib.rs @@ -52,32 +52,51 @@ struct Api { #[godot_api] impl Api { #[func] - fn insert(&self, _x: i64) { - ast().lock().unwrap().append(); + fn ast_add(&self, _x: i64) { + { + let mut state = editor_state().lock().unwrap(); + let sprite_id: SpriteID = state.get_current_sprite(); + state.project[sprite_id].ast.append(); + } // End Lock + global_notify(GlobalSignals::ScriptUpdated); } #[func] fn get_ast() -> Array { - let ast = ast().lock().unwrap(); - ast.to_godot_ast() + let state = editor_state().lock().unwrap(); + let sprite_id: SpriteID = state.get_current_sprite(); + state.project[sprite_id].ast.to_godot_ast() + } + + #[func] + fn sprite_add(&self, path: GString) { + { + let mut state = editor_state().lock().unwrap(); + state.project.push(Sprite::new(&path.to_string())); + } // End Lock + + global_notify(GlobalSignals::ScriptUpdated); } #[func] - fn get_all_sprites() -> Array { - todo!("not implemented") + fn sprite_get_all() -> Array { + let state = editor_state().try_lock().expect("could not lockie lockie"); + state.project.iter().map(|x| x.path.to_godot()).collect() } #[func] fn set_current_sprite(id: i64) { let mut state = editor_state().lock().unwrap(); - state.set_current_sprite(id); + state.set_current_sprite(id as SpriteID); } #[func] fn compile() -> GString { - let ast = ast().lock().unwrap(); - ast.compile().into() + let state = editor_state().lock().unwrap(); + // + // TODO: Properly compile all the sprites + state.project[0].ast.compile().into() } } diff --git a/rust/godot-plugin/src/signals.rs b/rust/godot-plugin/src/signals.rs index 23abb1b..67f7645 100644 --- a/rust/godot-plugin/src/signals.rs +++ b/rust/godot-plugin/src/signals.rs @@ -8,11 +8,21 @@ use godot::engine::Engine; use godot::prelude::*; +use crate::state::editor_state; + pub enum GlobalSignals { ScriptUpdated, } pub fn global_notify(signal: GlobalSignals) { + { + // NOTE: This is to aid debugging, not needed for functionality + let _lock = editor_state() + .lock() + .expect("You can't send a signal while holding a lock!!!"); + // Intentionally unlocks here + } + let mut global_signals = get_autoload("/root/GlobalSignals"); let signal_name = match signal { diff --git a/rust/godot-plugin/src/state.rs b/rust/godot-plugin/src/state.rs index 38bee48..9beea9e 100644 --- a/rust/godot-plugin/src/state.rs +++ b/rust/godot-plugin/src/state.rs @@ -3,7 +3,7 @@ // Keeps a hold of the currently selected project, // script, etc. // -// TODO: Rethink wheter this is really the best way to do this, +// TODO: Rethink whether this is really the best way to do this, // or whether we should just send the full selector down with // every call from the GDScript side. @@ -11,21 +11,52 @@ use std::sync::{Mutex, OnceLock}; use compiler::Ast; -pub fn ast() -> &'static Mutex { - static AST: OnceLock> = OnceLock::new(); - AST.get_or_init(|| Mutex::new(Ast::default())) +// TODO: Move this to the compiler infra. +pub type Project = Vec; + +#[derive(Debug)] +pub struct Sprite { + pub name: String, + pub path: String, + pub ast: Ast, } -#[derive(Default)] +impl Sprite { + pub fn new(path: &str) -> Self { + Self { + name: path.to_owned(), + path: path.to_owned(), + ast: Ast::default(), + } + } +} + +pub type SpriteID = usize; + +#[derive(Default, Debug)] pub struct EditorState { - current_sprite: Option, + pub project: Project, + current_sprite: Option, } impl EditorState { - pub fn set_current_sprite(&mut self, id: i64) { - // TODO: Validate whether sprite_id is valid! + pub fn set_current_sprite(&mut self, id: SpriteID) { + if id >= self.project.len() { + panic!("Invalid sprite id provided!"); + } + self.current_sprite = Some(id); } + + pub fn get_current_sprite(&self) -> SpriteID { + let id = self.current_sprite.unwrap(); // NOTE: Is this OK, or should we pass the option out? + + if id >= self.project.len() { + panic!("Invalid sprite id provided!"); + } + + id + } } pub fn editor_state() -> &'static Mutex {