diff options
| author | radiohotline <radoihotline@disroot.rg> | 2026-08-25 16:33:56 +0300 |
|---|---|---|
| committer | radiohotline <radoihotline@disroot.rg> | 2026-08-25 16:33:56 +0300 |
| commit | a89e744ed0e8c759caf041a580112365bbfe4303 (patch) | |
| tree | dd61e320904176995727e86a857d00c90d4933ba /addons/escoria-wizard | |
| parent | 6d53d8cac78250dc888aa49d5f9d4175c6652feb (diff) | |
Diffstat (limited to 'addons/escoria-wizard')
| -rw-r--r-- | addons/escoria-wizard/CharacterCreator.gd | 17 | ||||
| -rw-r--r-- | addons/escoria-wizard/CharacterCreator.tscn | 80 | ||||
| -rw-r--r-- | addons/escoria-wizard/ItemCreator.tscn | 139 | ||||
| -rw-r--r-- | addons/escoria-wizard/RoomCreator.gd | 115 | ||||
| -rw-r--r-- | addons/escoria-wizard/RoomCreator.tscn | 120 | ||||
| -rw-r--r-- | addons/escoria-wizard/item_creator.gd | 45 |
6 files changed, 265 insertions, 251 deletions
diff --git a/addons/escoria-wizard/CharacterCreator.gd b/addons/escoria-wizard/CharacterCreator.gd index 3404cd5..7281728 100644 --- a/addons/escoria-wizard/CharacterCreator.gd +++ b/addons/escoria-wizard/CharacterCreator.gd @@ -428,9 +428,9 @@ func draw_frame_outlines() -> void: # When given a frame number, this calculates the pixel coordinates that frame in the spritesheet # based on the number of horizontal/vertical frames configured for this spritesheet -func calc_frame_coords(Frame: int) -> Vector2: - var column = (Frame - 1) % int(get_node(ANIM_CONTROLS_NODE).get_node("h_frames_spin_box").value) * frame_size.x - var row = int((Frame - 1) / get_node(ANIM_CONTROLS_NODE).get_node("h_frames_spin_box").value) * frame_size.y +func calc_frame_coords(frame: int) -> Vector2: + var column = (frame - 1) % int(get_node(ANIM_CONTROLS_NODE).get_node("h_frames_spin_box").value) * frame_size.x + var row = int((frame - 1) / get_node(ANIM_CONTROLS_NODE).get_node("h_frames_spin_box").value) * frame_size.y return Vector2(column, row) @@ -823,7 +823,7 @@ func controls_on_v_frames_spin_box_value_changed(value: float) -> void: # Load a spritesheet when selected in the file browser -func controls_on_FileDialog_file_selected(path: String) -> void: +func controls_on_file_dialog_file_selected(path: String) -> void: get_node(NO_SPRITESHEET_NODE).visible = false load_spritesheet(path) @@ -1268,13 +1268,6 @@ func export_player(scene_name) -> void: var animations_resource = ESCAnimationResource.new() - # This is necessary to avoid a Godot bug when appending to one array - # appends to all arrays in the same class (possibly for resources only). - animations_resource.dir_angles = [] - animations_resource.directions = [] - animations_resource.idles = [] - animations_resource.speaks = [] - if get_node(DIR_COUNT_NODE).get_node("four_directions").button_pressed: num_directions = 4 start_angle_array = [315, 45, 135, 225] @@ -1532,7 +1525,7 @@ func spritesheet_on_reset_confirmed() -> void: character_creator_reset() -func spritesheet_on_MainMenuConfirmation_confirmed() -> void: +func spritesheet_on_main_menu_confirmation_confirmed() -> void: get_node("../Menu").visible = true get_node(".").visible = false diff --git a/addons/escoria-wizard/CharacterCreator.tscn b/addons/escoria-wizard/CharacterCreator.tscn index 23d41c8..e2bc78d 100644 --- a/addons/escoria-wizard/CharacterCreator.tscn +++ b/addons/escoria-wizard/CharacterCreator.tscn @@ -1,40 +1,40 @@ [gd_scene load_steps=40 format=3 uid="uid://cmd72pi6txw2v"] -[ext_resource type="Texture2D" uid="uid://4e5o0jygjpmv" path="res://addons/escoria-wizard/graphics/darkgreenarrow_down.png" id="1"] -[ext_resource type="Texture2D" uid="uid://bhtllcrcfgi2l" path="res://addons/escoria-wizard/graphics/greyarrow_r.png" id="2"] -[ext_resource type="Texture2D" uid="uid://bf8hvhitupl4x" path="res://addons/escoria-wizard/graphics/darkgreenarrow_right.png" id="3"] -[ext_resource type="Texture2D" uid="uid://c108mcii2pnd2" path="res://addons/escoria-wizard/graphics/greenarrow_right.png" id="4"] -[ext_resource type="Texture2D" uid="uid://c56jk51hra2ad" path="res://addons/escoria-wizard/graphics/greenarrow_down.png" id="5"] -[ext_resource type="Texture2D" uid="uid://dd1kynxpr5kp7" path="res://addons/escoria-wizard/graphics/greyarrow_ul.png" id="6"] -[ext_resource type="Texture2D" uid="uid://db0x28tf68ra4" path="res://addons/escoria-wizard/graphics/greyarrow_dl.png" id="7"] -[ext_resource type="Texture2D" uid="uid://cta81hch2hfbb" path="res://addons/escoria-wizard/graphics/darkgreyarrow_d.png" id="8"] -[ext_resource type="Texture2D" uid="uid://bm8l75biydrpy" path="res://addons/escoria-wizard/graphics/no_animation.png" id="9"] -[ext_resource type="Texture2D" uid="uid://cvbadwfv44b31" path="res://addons/escoria-wizard/graphics/greenarrow_downleft.png" id="10"] -[ext_resource type="Texture2D" uid="uid://c66yr3xxyocgf" path="res://addons/escoria-wizard/graphics/darkgreenarrow_downleft.png" id="11"] -[ext_resource type="Texture2D" uid="uid://etvk6ieq08d8" path="res://addons/escoria-wizard/graphics/darkgreenarrow_left.png" id="12"] -[ext_resource type="Texture2D" uid="uid://r35l3buu5y1c" path="res://addons/escoria-wizard/graphics/greyarrow_l.png" id="13"] -[ext_resource type="Texture2D" uid="uid://bkhd38cvci0o6" path="res://addons/escoria-wizard/graphics/darkgreyarrow_ur.png" id="14"] -[ext_resource type="Texture2D" uid="uid://v431ykg6an0r" path="res://addons/escoria-wizard/graphics/darkgreyarrow_ul.png" id="15"] -[ext_resource type="Texture2D" uid="uid://cbam52s6amdah" path="res://addons/escoria-wizard/graphics/darkgreenarrow_upright.png" id="16"] -[ext_resource type="Texture2D" uid="uid://cadthv31wt2lr" path="res://addons/escoria-wizard/graphics/greyarrow_ur.png" id="17"] -[ext_resource type="Texture2D" uid="uid://bu2yu64fio8re" path="res://addons/escoria-wizard/graphics/greyarrow_u.png" id="18"] -[ext_resource type="Texture2D" uid="uid://cfewua8ben82l" path="res://addons/escoria-wizard/graphics/darkgreyarrow_r.png" id="19"] -[ext_resource type="Texture2D" uid="uid://bng28oph8rshy" path="res://addons/escoria-wizard/graphics/darkgreyarrow_u.png" id="20"] -[ext_resource type="Texture2D" uid="uid://dknfjhmw4ulgx" path="res://addons/escoria-wizard/graphics/darkgreyarrow_l.png" id="21"] -[ext_resource type="Texture2D" uid="uid://cooshd11j6mme" path="res://addons/escoria-wizard/graphics/greyarrow_dr.png" id="22"] -[ext_resource type="Texture2D" uid="uid://yhgaqrufthbd" path="res://addons/escoria-wizard/graphics/greenarrow_up.png" id="23"] -[ext_resource type="Texture2D" uid="uid://blgnjkqah3tux" path="res://addons/escoria-wizard/graphics/greenarrow_upright.png" id="24"] -[ext_resource type="Texture2D" uid="uid://bag4myopmjamd" path="res://addons/escoria-wizard/graphics/darkgreenarrow_downright.png" id="25"] -[ext_resource type="Texture2D" uid="uid://dkv2avtnxqov1" path="res://addons/escoria-wizard/graphics/greenarrow_left.png" id="26"] -[ext_resource type="Texture2D" uid="uid://b4chlwkmru1aj" path="res://addons/escoria-wizard/graphics/darkgreenarrow_upleft.png" id="27"] -[ext_resource type="Texture2D" uid="uid://dfk2rb1g2b4gl" path="res://addons/escoria-wizard/graphics/darkgreenarrow_up.png" id="28"] -[ext_resource type="Texture2D" uid="uid://bnxd0blo12sdc" path="res://addons/escoria-wizard/graphics/no_spritesheet.png" id="29"] -[ext_resource type="Texture2D" uid="uid://c7hp4rcgl7v5k" path="res://addons/escoria-wizard/graphics/greenarrow_upleft.png" id="30"] -[ext_resource type="Texture2D" uid="uid://bxfeqwi1hmjxl" path="res://addons/escoria-wizard/graphics/greenarrow_downright.png" id="31"] -[ext_resource type="Texture2D" uid="uid://c3ohia3wlf1y7" path="res://addons/escoria-wizard/graphics/icon.png" id="32"] -[ext_resource type="Texture2D" uid="uid://co12gknvv3u8u" path="res://addons/escoria-wizard/graphics/greyarrow_d.png" id="33"] -[ext_resource type="Texture2D" uid="uid://cbydni2j81n0l" path="res://addons/escoria-wizard/graphics/darkgreyarrow_dr.png" id="34"] -[ext_resource type="Texture2D" uid="uid://s7i1hfxl2dnm" path="res://addons/escoria-wizard/graphics/darkgreyarrow_dl.png" id="35"] +[ext_resource type="Texture2D" uid="uid://bvmhh70ekt6kg" path="res://addons/escoria-wizard/graphics/darkgreenarrow_down.png" id="1"] +[ext_resource type="Texture2D" uid="uid://trnlbw7phxmu" path="res://addons/escoria-wizard/graphics/greyarrow_r.png" id="2"] +[ext_resource type="Texture2D" uid="uid://byldowv8jurga" path="res://addons/escoria-wizard/graphics/darkgreenarrow_right.png" id="3"] +[ext_resource type="Texture2D" uid="uid://cssjxrowx4o4d" path="res://addons/escoria-wizard/graphics/greenarrow_right.png" id="4"] +[ext_resource type="Texture2D" uid="uid://b57lcbtjt323p" path="res://addons/escoria-wizard/graphics/greenarrow_down.png" id="5"] +[ext_resource type="Texture2D" uid="uid://kthnuv0ul2vl" path="res://addons/escoria-wizard/graphics/greyarrow_ul.png" id="6"] +[ext_resource type="Texture2D" uid="uid://bqyafr0bavow4" path="res://addons/escoria-wizard/graphics/greyarrow_dl.png" id="7"] +[ext_resource type="Texture2D" uid="uid://bghsxc7dmhcfl" path="res://addons/escoria-wizard/graphics/darkgreyarrow_d.png" id="8"] +[ext_resource type="Texture2D" uid="uid://b7tr6x6ubkam2" path="res://addons/escoria-wizard/graphics/no_animation.png" id="9"] +[ext_resource type="Texture2D" uid="uid://duuyiir8btchr" path="res://addons/escoria-wizard/graphics/greenarrow_downleft.png" id="10"] +[ext_resource type="Texture2D" uid="uid://dq5q8mmk8qof2" path="res://addons/escoria-wizard/graphics/darkgreenarrow_downleft.png" id="11"] +[ext_resource type="Texture2D" uid="uid://cvfj6jmsvx2dc" path="res://addons/escoria-wizard/graphics/darkgreenarrow_left.png" id="12"] +[ext_resource type="Texture2D" uid="uid://cw1iq5w8e7jut" path="res://addons/escoria-wizard/graphics/greyarrow_l.png" id="13"] +[ext_resource type="Texture2D" uid="uid://dmksuj3d4xm2r" path="res://addons/escoria-wizard/graphics/darkgreyarrow_ur.png" id="14"] +[ext_resource type="Texture2D" uid="uid://rxcxkfkesarh" path="res://addons/escoria-wizard/graphics/darkgreyarrow_ul.png" id="15"] +[ext_resource type="Texture2D" uid="uid://bnro12s7njjv0" path="res://addons/escoria-wizard/graphics/darkgreenarrow_upright.png" id="16"] +[ext_resource type="Texture2D" uid="uid://bjf4n3n448rak" path="res://addons/escoria-wizard/graphics/greyarrow_ur.png" id="17"] +[ext_resource type="Texture2D" uid="uid://c2yfth8d3cwqy" path="res://addons/escoria-wizard/graphics/greyarrow_u.png" id="18"] +[ext_resource type="Texture2D" uid="uid://ckvsgvp6704ss" path="res://addons/escoria-wizard/graphics/darkgreyarrow_r.png" id="19"] +[ext_resource type="Texture2D" uid="uid://cn7r214st2vlp" path="res://addons/escoria-wizard/graphics/darkgreyarrow_u.png" id="20"] +[ext_resource type="Texture2D" uid="uid://ruc171bdoukl" path="res://addons/escoria-wizard/graphics/darkgreyarrow_l.png" id="21"] +[ext_resource type="Texture2D" uid="uid://c1cxiw7vp3mo3" path="res://addons/escoria-wizard/graphics/greyarrow_dr.png" id="22"] +[ext_resource type="Texture2D" uid="uid://c1ni1pr30kk0t" path="res://addons/escoria-wizard/graphics/greenarrow_up.png" id="23"] +[ext_resource type="Texture2D" uid="uid://ddj7s5rlqkpep" path="res://addons/escoria-wizard/graphics/greenarrow_upright.png" id="24"] +[ext_resource type="Texture2D" uid="uid://dw0f3ebq3e7om" path="res://addons/escoria-wizard/graphics/darkgreenarrow_downright.png" id="25"] +[ext_resource type="Texture2D" uid="uid://dck3k2wchcs7o" path="res://addons/escoria-wizard/graphics/greenarrow_left.png" id="26"] +[ext_resource type="Texture2D" uid="uid://d1s12l2v0xdh3" path="res://addons/escoria-wizard/graphics/darkgreenarrow_upleft.png" id="27"] +[ext_resource type="Texture2D" uid="uid://7j3s0t8uxygg" path="res://addons/escoria-wizard/graphics/darkgreenarrow_up.png" id="28"] +[ext_resource type="Texture2D" uid="uid://c3uyhfc1pejdu" path="res://addons/escoria-wizard/graphics/no_spritesheet.png" id="29"] +[ext_resource type="Texture2D" uid="uid://dv3341fxi36co" path="res://addons/escoria-wizard/graphics/greenarrow_upleft.png" id="30"] +[ext_resource type="Texture2D" uid="uid://bg772rhiihpya" path="res://addons/escoria-wizard/graphics/greenarrow_downright.png" id="31"] +[ext_resource type="Texture2D" uid="uid://cmrcg0wijr8ki" path="res://addons/escoria-wizard/graphics/icon.png" id="32"] +[ext_resource type="Texture2D" uid="uid://cx0d71n50vnrr" path="res://addons/escoria-wizard/graphics/greyarrow_d.png" id="33"] +[ext_resource type="Texture2D" uid="uid://8i208uv8vj31" path="res://addons/escoria-wizard/graphics/darkgreyarrow_dr.png" id="34"] +[ext_resource type="Texture2D" uid="uid://hgoiognpxbm1" path="res://addons/escoria-wizard/graphics/darkgreyarrow_dl.png" id="35"] [ext_resource type="Script" uid="uid://ihbrgvupidxn" path="res://addons/escoria-wizard/draw_frame_rects.gd" id="36"] [ext_resource type="Script" uid="uid://bwbxhkbjuggxq" path="res://addons/escoria-wizard/CharacterCreator.gd" id="37"] [ext_resource type="PackedScene" uid="uid://b1mr4ghmqeyo" path="res://addons/escoria-wizard/help_window.tscn" id="38"] @@ -985,6 +985,7 @@ layout_mode = 2 [node name="unstored_changes_window" type="Window" parent="InformationWindows"] position = Vector2i(0, 36) +size = Vector2i(775, 300) visible = false exclusive = true @@ -1023,8 +1024,11 @@ text = "Cancel and keep editing" [node name="unstored_changes_window_anim_change" type="Window" parent="InformationWindows"] position = Vector2i(0, 36) +size = Vector2i(775, 300) visible = false exclusive = true +unresizable = true +popup_window = true [node name="Label" type="Label" parent="InformationWindows/unstored_changes_window_anim_change"] offset_left = 86.0 @@ -1060,6 +1064,7 @@ offset_bottom = 270.0 text = "Cancel and keep editing" [node name="generic_error_window" type="AcceptDialog" parent="InformationWindows"] +size = Vector2i(280, 100) dialog_text = "Please load a spritesheet to begin." [node name="export_progress" type="Window" parent="InformationWindows"] @@ -1118,6 +1123,7 @@ position = Vector2i(0, 36) visible = false [node name="ConfirmationDialog" type="ConfirmationDialog" parent="InformationWindows"] +size = Vector2i(405, 132) dialog_text = "WARNING! If you continue you will lose the current character." @@ -1167,7 +1173,7 @@ you will lose your current character. [connection signal="pressed" from="VBoxContainer/HBoxContainer/spritesheet_controls/VBoxContainer/MarginContainer3/HBoxContainer/help_button" to="." method="spritesheet_on_help_button_pressed"] [connection signal="pressed" from="VBoxContainer/HBoxContainer/spritesheet_controls/VBoxContainer/MarginContainer3/HBoxContainer/reset_button" to="." method="spritesheet_on_reset_button_pressed"] [connection signal="button_up" from="VBoxContainer/HBoxContainer/spritesheet_controls/VBoxContainer/MarginContainer3/HBoxContainer/main_menu" to="." method="spritesheet_on_main_menu_button_up"] -[connection signal="file_selected" from="ImageFileDialog" to="." method="controls_on_FileDialog_file_selected"] +[connection signal="file_selected" from="ImageFileDialog" to="." method="controls_on_file_dialog_file_selected"] [connection signal="dir_selected" from="CharacterPathFileDialog" to="." method="_on_CharacterPathFileDialog_dir_selected"] [connection signal="pressed" from="InformationWindows/unstored_changes_window/commit_button" to="." method="unstored_warning_on_commit_button_pressed"] [connection signal="pressed" from="InformationWindows/unstored_changes_window/lose_button" to="." method="unstored_warning_on_lose_button_pressed"] @@ -1176,4 +1182,4 @@ you will lose your current character. [connection signal="pressed" from="InformationWindows/unstored_changes_window_anim_change/lose_button" to="." method="unstored_animchange_warning_on_lose_button_pressed"] [connection signal="pressed" from="InformationWindows/unstored_changes_window_anim_change/cancel_button" to="." method="unstored_animchange_warning_on_cancel_button_pressed"] [connection signal="confirmed" from="InformationWindows/ConfirmationDialog" to="." method="spritesheet_on_reset_confirmed"] -[connection signal="confirmed" from="InformationWindows/MainMenuConfirmation" to="." method="spritesheet_on_MainMenuConfirmation_confirmed"] +[connection signal="confirmed" from="InformationWindows/MainMenuConfirmation" to="." method="spritesheet_on_main_menu_confirmation_confirmed"] diff --git a/addons/escoria-wizard/ItemCreator.tscn b/addons/escoria-wizard/ItemCreator.tscn index 22d735a..dabd4db 100644 --- a/addons/escoria-wizard/ItemCreator.tscn +++ b/addons/escoria-wizard/ItemCreator.tscn @@ -1,10 +1,10 @@ -[gd_scene load_steps=4 format=3 uid="uid://beawklamapteq"] +[gd_scene format=3 uid="uid://beawklamapteq"] [ext_resource type="Script" uid="uid://bxj8cgfbk5r8f" path="res://addons/escoria-wizard/item_creator.gd" id="1"] -[ext_resource type="Texture2D" uid="uid://b7ax2phlsg1x6" path="res://addons/escoria-wizard/graphics/inventory_preview.png" id="2"] -[ext_resource type="Texture2D" uid="uid://bf47xbq6w4hou" path="res://addons/escoria-wizard/graphics/object_preview.png" id="3"] +[ext_resource type="Texture2D" uid="uid://mxyijpemwkkg" path="res://addons/escoria-wizard/graphics/inventory_preview.png" id="2"] +[ext_resource type="Texture2D" uid="uid://d2chqmjr3qq3m" path="res://addons/escoria-wizard/graphics/object_preview.png" id="3"] -[node name="ItemCreator" type="MarginContainer"] +[node name="ItemCreator" type="MarginContainer" unique_id=691174334] custom_minimum_size = Vector2(500, 500) offset_left = 395.0 offset_top = 50.0 @@ -14,50 +14,50 @@ size_flags_horizontal = 4 size_flags_vertical = 4 script = ExtResource("1") -[node name="window_background_colour" type="ColorRect" parent="."] +[node name="window_background_colour" type="ColorRect" parent="." unique_id=1006540274] custom_minimum_size = Vector2(500, 800) layout_mode = 2 color = Color(0.235294, 0.341176, 0.290196, 1) -[node name="VBoxContainer" type="VBoxContainer" parent="."] +[node name="VBoxContainer" type="VBoxContainer" parent="." unique_id=1556992828] layout_mode = 2 -[node name="Control" type="CenterContainer" parent="VBoxContainer"] +[node name="Control" type="CenterContainer" parent="VBoxContainer" unique_id=272720985] custom_minimum_size = Vector2(0, 60) layout_mode = 2 -[node name="CenterContainer" type="CenterContainer" parent="VBoxContainer/Control"] +[node name="CenterContainer" type="CenterContainer" parent="VBoxContainer/Control" unique_id=1294587700] layout_mode = 2 -[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer/Control/CenterContainer"] +[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer/Control/CenterContainer" unique_id=1459294672] layout_mode = 2 -[node name="BackgroundObjectCheckBox" type="CheckBox" parent="VBoxContainer/Control/CenterContainer/HBoxContainer"] +[node name="BackgroundObjectCheckBox" type="CheckBox" parent="VBoxContainer/Control/CenterContainer/HBoxContainer" unique_id=1733794135] layout_mode = 2 text = "Create background object" -[node name="InventoryItemCheckBox" type="CheckBox" parent="VBoxContainer/Control/CenterContainer/HBoxContainer"] +[node name="InventoryItemCheckBox" type="CheckBox" parent="VBoxContainer/Control/CenterContainer/HBoxContainer" unique_id=1237062721] layout_mode = 2 text = "Create inventory item" -[node name="HSeparator" type="HSeparator" parent="VBoxContainer"] +[node name="HSeparator" type="HSeparator" parent="VBoxContainer" unique_id=1468681635] layout_mode = 2 -[node name="HelperHeading" type="MarginContainer" parent="VBoxContainer"] +[node name="HelperHeading" type="MarginContainer" parent="VBoxContainer" unique_id=1282537158] custom_minimum_size = Vector2(0, 40) layout_mode = 2 -[node name="CenterContainer" type="CenterContainer" parent="VBoxContainer/HelperHeading"] +[node name="CenterContainer" type="CenterContainer" parent="VBoxContainer/HelperHeading" unique_id=407105498] layout_mode = 2 -[node name="ObjectHeading" type="Label" parent="VBoxContainer/HelperHeading/CenterContainer"] +[node name="ObjectHeading" type="Label" parent="VBoxContainer/HelperHeading/CenterContainer" unique_id=1913640739] layout_mode = 2 theme_override_colors/font_color = Color(0.592157, 0.87451, 0.533333, 1) theme_override_colors/font_shadow_color = Color(0, 0, 0, 1) text = "Object Creator" uppercase = true -[node name="InventoryHeading" type="Label" parent="VBoxContainer/HelperHeading/CenterContainer"] +[node name="InventoryHeading" type="Label" parent="VBoxContainer/HelperHeading/CenterContainer" unique_id=1615178370] visible = false layout_mode = 2 theme_override_colors/font_color = Color(0.592157, 0.87451, 0.533333, 1) @@ -65,10 +65,10 @@ theme_override_colors/font_shadow_color = Color(0, 0, 0, 1) text = "Inventory Item Creator" uppercase = true -[node name="Description" type="MarginContainer" parent="VBoxContainer"] +[node name="Description" type="MarginContainer" parent="VBoxContainer" unique_id=348444932] layout_mode = 2 -[node name="ObjectDescription" type="Label" parent="VBoxContainer/Description"] +[node name="ObjectDescription" type="Label" parent="VBoxContainer/Description" unique_id=1367984222] layout_mode = 2 text = "The object creator is used to create background objects that the player can interact with, but that will not become @@ -79,7 +79,7 @@ is currently selected in the scene tree. " horizontal_alignment = 1 -[node name="InventoryDescription" type="Label" parent="VBoxContainer/Description"] +[node name="InventoryDescription" type="Label" parent="VBoxContainer/Description" unique_id=609879510] visible = false layout_mode = 2 text = "The inventory item creator is used to create objects @@ -92,88 +92,91 @@ game must live in the same folder. " horizontal_alignment = 1 -[node name="Content" type="MarginContainer" parent="VBoxContainer"] +[node name="Content" type="MarginContainer" parent="VBoxContainer" unique_id=990904092] custom_minimum_size = Vector2(0, 500) layout_mode = 2 theme_override_constants/margin_left = 20 theme_override_constants/margin_top = 0 theme_override_constants/margin_right = 20 -[node name="GridContainer" type="GridContainer" parent="VBoxContainer/Content"] +[node name="GridContainer" type="GridContainer" parent="VBoxContainer/Content" unique_id=158727013] custom_minimum_size = Vector2(460, 500) layout_mode = 2 columns = 3 -[node name="ItemNameLabel" type="Label" parent="VBoxContainer/Content/GridContainer"] +[node name="ItemNameLabel" type="Label" parent="VBoxContainer/Content/GridContainer" unique_id=364727612] layout_mode = 2 text = "Item name:" -[node name="ItemName" type="LineEdit" parent="VBoxContainer/Content/GridContainer"] +[node name="ItemName" type="LineEdit" parent="VBoxContainer/Content/GridContainer" unique_id=331794259] custom_minimum_size = Vector2(200, 0) layout_mode = 2 text = "replace_me" -[node name="BlankItem" type="Control" parent="VBoxContainer/Content/GridContainer"] +[node name="BlankItem" type="Control" parent="VBoxContainer/Content/GridContainer" unique_id=63798475] layout_mode = 2 -[node name="ItemGlobalIDLabel" type="Label" parent="VBoxContainer/Content/GridContainer"] +[node name="ItemGlobalIDLabel" type="Label" parent="VBoxContainer/Content/GridContainer" unique_id=1865740109] layout_mode = 2 text = "Global ID:" -[node name="ItemGlobalID" type="LineEdit" parent="VBoxContainer/Content/GridContainer"] +[node name="ItemGlobalID" type="LineEdit" parent="VBoxContainer/Content/GridContainer" unique_id=2143247033] layout_mode = 2 -[node name="BlankItem2" type="Control" parent="VBoxContainer/Content/GridContainer"] +[node name="BlankItem2" type="Control" parent="VBoxContainer/Content/GridContainer" unique_id=264709736] layout_mode = 2 -[node name="StartsInteractiveLabel" type="Label" parent="VBoxContainer/Content/GridContainer"] +[node name="StartsInteractiveLabel" type="Label" parent="VBoxContainer/Content/GridContainer" unique_id=479125211] custom_minimum_size = Vector2(110, 0) layout_mode = 2 text = "Is 'Interactive':" -[node name="StartsInteractiveCheckBox" type="CheckBox" parent="VBoxContainer/Content/GridContainer"] +[node name="StartsInteractiveCheckBox" type="CheckBox" parent="VBoxContainer/Content/GridContainer" unique_id=247353906] layout_mode = 2 tooltip_text = "When the room first loads, can the player interact with this?" button_pressed = true -[node name="BlankItem3" type="Control" parent="VBoxContainer/Content/GridContainer"] +[node name="BlankItem3" type="Control" parent="VBoxContainer/Content/GridContainer" unique_id=107820231] layout_mode = 2 -[node name="DefaultActionLabel" type="Label" parent="VBoxContainer/Content/GridContainer"] +[node name="DefaultActionLabel" type="Label" parent="VBoxContainer/Content/GridContainer" unique_id=732630412] layout_mode = 2 text = "Default action: " vertical_alignment = 1 -[node name="DefaultActionOption" type="OptionButton" parent="VBoxContainer/Content/GridContainer"] +[node name="DefaultActionOption" type="OptionButton" parent="VBoxContainer/Content/GridContainer" unique_id=606279851] custom_minimum_size = Vector2(200, 31) layout_mode = 2 +selected = 0 +item_count = 1 +popup/item_0/id = 0 -[node name="BlankItem4" type="Control" parent="VBoxContainer/Content/GridContainer"] +[node name="BlankItem4" type="Control" parent="VBoxContainer/Content/GridContainer" unique_id=433328003] layout_mode = 2 -[node name="ImagePathLabel" type="Label" parent="VBoxContainer/Content/GridContainer"] +[node name="ImagePathLabel" type="Label" parent="VBoxContainer/Content/GridContainer" unique_id=398723320] layout_mode = 2 text = "Item graphic:" -[node name="ImagePath" type="LineEdit" parent="VBoxContainer/Content/GridContainer"] +[node name="ImagePath" type="LineEdit" parent="VBoxContainer/Content/GridContainer" unique_id=938646351] layout_mode = 2 editable = false -[node name="ChangeImageButton" type="Button" parent="VBoxContainer/Content/GridContainer"] +[node name="ChangeImageButton" type="Button" parent="VBoxContainer/Content/GridContainer" unique_id=1854196443] layout_mode = 2 text = "Change Image" -[node name="PreviewLabel" type="Label" parent="VBoxContainer/Content/GridContainer"] +[node name="PreviewLabel" type="Label" parent="VBoxContainer/Content/GridContainer" unique_id=44519053] layout_mode = 2 text = "Preview:" -[node name="Preview" type="ColorRect" parent="VBoxContainer/Content/GridContainer"] +[node name="Preview" type="ColorRect" parent="VBoxContainer/Content/GridContainer" unique_id=92417030] custom_minimum_size = Vector2(240, 240) layout_mode = 2 color = Color(0.121569, 0.196078, 0.0823529, 1) -[node name="BackgroundColour" type="ColorRect" parent="VBoxContainer/Content/GridContainer/Preview"] +[node name="BackgroundColour" type="ColorRect" parent="VBoxContainer/Content/GridContainer/Preview" unique_id=1329101639] custom_minimum_size = Vector2(232, 232) layout_mode = 0 offset_left = 4.0 @@ -182,7 +185,7 @@ offset_right = 236.0 offset_bottom = 236.0 color = Color(0.254902, 0.231373, 0.231373, 1) -[node name="InventoryPreview" type="TextureRect" parent="VBoxContainer/Content/GridContainer/Preview"] +[node name="InventoryPreview" type="TextureRect" parent="VBoxContainer/Content/GridContainer/Preview" unique_id=1373748569] visible = false layout_mode = 0 offset_left = 4.0 @@ -191,7 +194,7 @@ offset_right = 236.0 offset_bottom = 236.0 texture = ExtResource("2") -[node name="ObjectPreview" type="TextureRect" parent="VBoxContainer/Content/GridContainer/Preview"] +[node name="ObjectPreview" type="TextureRect" parent="VBoxContainer/Content/GridContainer/Preview" unique_id=134323334] layout_mode = 0 offset_left = 4.0 offset_top = 4.0 @@ -199,7 +202,7 @@ offset_right = 236.0 offset_bottom = 236.0 texture = ExtResource("3") -[node name="Preview" type="TextureRect" parent="VBoxContainer/Content/GridContainer/Preview"] +[node name="Preview" type="TextureRect" parent="VBoxContainer/Content/GridContainer/Preview" unique_id=776503273] custom_minimum_size = Vector2(232, 232) layout_mode = 0 offset_left = 4.0 @@ -207,92 +210,96 @@ offset_top = 4.0 offset_right = 236.0 offset_bottom = 236.0 -[node name="BlankItem5" type="Control" parent="VBoxContainer/Content/GridContainer"] +[node name="BlankItem5" type="Control" parent="VBoxContainer/Content/GridContainer" unique_id=1394861351] layout_mode = 2 -[node name="ImageSizeLabel" type="Label" parent="VBoxContainer/Content/GridContainer"] +[node name="ImageSizeLabel" type="Label" parent="VBoxContainer/Content/GridContainer" unique_id=212608889] layout_mode = 2 text = "Image size:" -[node name="ImageSize" type="Label" parent="VBoxContainer/Content/GridContainer"] +[node name="ImageSize" type="Label" parent="VBoxContainer/Content/GridContainer" unique_id=1613836739] layout_mode = 2 text = "(0, 0)" -[node name="BlankItem6" type="Control" parent="VBoxContainer/Content/GridContainer"] +[node name="BlankItem6" type="Control" parent="VBoxContainer/Content/GridContainer" unique_id=1884527510] layout_mode = 2 -[node name="InventoryPathLabel" type="Label" parent="VBoxContainer/Content/GridContainer"] +[node name="InventoryPathLabel" type="Label" parent="VBoxContainer/Content/GridContainer" unique_id=1516523054] visible = false layout_mode = 2 text = "Inventory path:" -[node name="InventoryPath" type="Label" parent="VBoxContainer/Content/GridContainer"] +[node name="InventoryPath" type="Label" parent="VBoxContainer/Content/GridContainer" unique_id=692354482] visible = false layout_mode = 2 text = "res://" -[node name="ChangePathButton" type="Button" parent="VBoxContainer/Content/GridContainer"] +[node name="ChangePathButton" type="Button" parent="VBoxContainer/Content/GridContainer" unique_id=216018542] visible = false layout_mode = 2 -text = "Change Path3D" +text = "Change Inventory Path" -[node name="BlankItem7" type="Control" parent="VBoxContainer/Content/GridContainer"] +[node name="BlankItem7" type="Control" parent="VBoxContainer/Content/GridContainer" unique_id=816977697] visible = false layout_mode = 2 -[node name="Buttons" type="MarginContainer" parent="VBoxContainer"] +[node name="Buttons" type="MarginContainer" parent="VBoxContainer" unique_id=317694956] layout_mode = 2 mouse_filter = 2 theme_override_constants/margin_bottom = 10 -[node name="CenterContainer" type="CenterContainer" parent="VBoxContainer/Buttons"] +[node name="CenterContainer" type="CenterContainer" parent="VBoxContainer/Buttons" unique_id=832093664] layout_mode = 2 -[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer/Buttons/CenterContainer"] +[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer/Buttons/CenterContainer" unique_id=308534454] layout_mode = 2 -[node name="CreateButton" type="Button" parent="VBoxContainer/Buttons/CenterContainer/HBoxContainer"] +[node name="CreateButton" type="Button" parent="VBoxContainer/Buttons/CenterContainer/HBoxContainer" unique_id=103034756] layout_mode = 2 text = "Create Object" -[node name="Spacer" type="Control" parent="VBoxContainer/Buttons/CenterContainer/HBoxContainer"] +[node name="Spacer" type="Control" parent="VBoxContainer/Buttons/CenterContainer/HBoxContainer" unique_id=635434229] custom_minimum_size = Vector2(20, 0) layout_mode = 2 -[node name="ClearButton" type="Button" parent="VBoxContainer/Buttons/CenterContainer/HBoxContainer"] +[node name="ClearButton" type="Button" parent="VBoxContainer/Buttons/CenterContainer/HBoxContainer" unique_id=1557616416] layout_mode = 2 text = "Clear All" -[node name="Spacer2" type="Control" parent="VBoxContainer/Buttons/CenterContainer/HBoxContainer"] +[node name="Spacer2" type="Control" parent="VBoxContainer/Buttons/CenterContainer/HBoxContainer" unique_id=959146374] custom_minimum_size = Vector2(20, 0) layout_mode = 2 -[node name="ExitButton" type="Button" parent="VBoxContainer/Buttons/CenterContainer/HBoxContainer"] +[node name="ExitButton" type="Button" parent="VBoxContainer/Buttons/CenterContainer/HBoxContainer" unique_id=1012963769] layout_mode = 2 text = "Main Menu" -[node name="LoadObjectGraphic" type="CenterContainer" parent="."] +[node name="LoadObjectGraphic" type="CenterContainer" parent="." unique_id=2039551690] visible = false layout_mode = 2 mouse_filter = 2 -[node name="LoadObjectFileDialog" type="FileDialog" parent="LoadObjectGraphic"] +[node name="LoadObjectFileDialog" type="FileDialog" parent="LoadObjectGraphic" unique_id=183617470] +oversampling_override = 1.0 +title = "Open a File" +position = Vector2i(0, 36) +file_mode = 0 filters = PackedStringArray("*.png", "*.bmp", "*.jpg", "*.jpeg", "*.webp", "*.tga") -[node name="Windows" type="CenterContainer" parent="."] +[node name="Windows" type="CenterContainer" parent="." unique_id=353631974] visible = false layout_mode = 2 -[node name="ConfirmationDialog" type="ConfirmationDialog" parent="Windows"] +[node name="ConfirmationDialog" type="ConfirmationDialog" parent="Windows" unique_id=739679800] dialog_text = "WARNING! If you continue you will lose the current object." -[node name="ErrorDialog" type="AcceptDialog" parent="Windows"] +[node name="ErrorDialog" type="AcceptDialog" parent="Windows" unique_id=1922609345] -[node name="CreateCompleteDialog" type="AcceptDialog" parent="Windows"] +[node name="CreateCompleteDialog" type="AcceptDialog" parent="Windows" unique_id=605735600] -[node name="FileDialog" type="FileDialog" parent="Windows"] +[node name="FileDialog" type="FileDialog" parent="Windows" unique_id=1161118336] mode = 2 position = Vector2i(0, 36) diff --git a/addons/escoria-wizard/RoomCreator.gd b/addons/escoria-wizard/RoomCreator.gd index aadda0e..8ca7c8f 100644 --- a/addons/escoria-wizard/RoomCreator.gd +++ b/addons/escoria-wizard/RoomCreator.gd @@ -31,16 +31,16 @@ var settings_modified: bool func _ready() -> void: - $"InformationWindows/PlayerSceneFileDialog".get_cancel_button().connect("pressed", Callable(self, "PlayerSceneCancelled")) - $"InformationWindows/BackgroundImageFileDialog".get_cancel_button().connect("pressed", Callable(self, "BackgroundFileCancelled")) + $"InformationWindows/PlayerSceneFileDialog".get_cancel_button().connect("pressed", Callable(self, "player_scene_cancelled")) + $"InformationWindows/BackgroundImageFileDialog".get_cancel_button().connect("pressed", Callable(self, "background_file_cancelled")) -func PlayerSceneCancelled() -> void: +func player_scene_cancelled() -> void: if get_node(PLAYER_SCENE).text == PLAYER_SELECT_TEXT: get_node(USE_EMPTY_PLAYER_BUTTON).button_pressed = true -func BackgroundFileCancelled() -> void: +func background_file_cancelled() -> void: if get_node(BACKGROUND_IMAGE).text == BACKGROUND_SELECT_TEXT: get_node(USE_EMPTY_BACKGROUND).button_pressed = true @@ -73,7 +73,7 @@ func _on_RoomName_text_changed(new_text: String) -> void: settings_modified = true -func _on_GlobalID_text_changed(new_text: String) -> void: +func _on_GlobalID_text_changed(_new_text: String) -> void: settings_modified = true @@ -167,13 +167,11 @@ func set_preview_scale() -> void: # Calculate the scale to make the preview as big as possible in the preview window depending on # the height to width ratio of the frame var preview_size = get_node(ROOM_BACKGROUND).get_size() -# get_node(BACKGROUND_PREVIEW).rect_scale = Vector2.ONE var image_size = get_node(BACKGROUND_PREVIEW).texture.get_size() - preview_scale.x = preview_size.x / image_size.x - preview_scale.y = preview_size.y / image_size.y + preview_scale.x = clampf(preview_size.x/ image_size.x, 0, 1) + preview_scale.y = clampf(preview_size.y/ image_size.y, 0, 1) -# print("scale = "+str(preview_scale)+", preview size = "+str(preview_size)+", image_size = "+str(image_size)) if preview_scale.y > preview_scale.x: get_node(BACKGROUND_PREVIEW).scale = Vector2(preview_scale.x, preview_scale.x) else: @@ -218,17 +216,17 @@ func _on_RoomFolderDialog_dir_selected(dir: String) -> void: func _on_CreateButton_pressed() -> void: - var RoomName = get_node(ROOM_NAME).text + var room_name = get_node(ROOM_NAME).text - if RoomName.length() < 1: + if room_name.length() < 1: $"InformationWindows/GenericErrorDialog".dialog_text = "Error!\n\nRoom name must be specified." $"InformationWindows/GenericErrorDialog".popup_centered() return - var ScriptName = get_node(ESC_SCRIPT).text + var script_name = get_node(ESC_SCRIPT).text if get_node(USE_EMPTY_ROOM_SCRIPT).button_pressed == false: - if ScriptName.length() < 5 or ! ScriptName.substr(ScriptName.length() - 4) == ".esc": + if script_name.length() < 5 or ! script_name.substr(script_name.length() - 4) == ".esc": $"InformationWindows/GenericErrorDialog".dialog_text = "Error!\n\n" \ + "Room ESC script must be a filename ending in '.esc'" $"InformationWindows/GenericErrorDialog".popup_centered() @@ -240,82 +238,79 @@ func _on_CreateButton_pressed() -> void: $"InformationWindows/GenericErrorDialog".popup_centered() return - var BaseDir = ProjectSettings.get_setting(ROOM_PATH_SETTING) - var ImageSize = Vector2(1,1) - var NewRoom = ESCRoom.new() + var base_dir = ProjectSettings.get_setting(ROOM_PATH_SETTING) + var new_room = ESCRoom.new() - NewRoom.name = RoomName - NewRoom.global_id = get_node(GLOBAL_ID).text + new_room.name = room_name + new_room.global_id = get_node(GLOBAL_ID).text if ! get_node(ESC_SCRIPT).text == SCRIPT_SELECT_TEXT and ! get_node(ESC_SCRIPT).text == SCRIPT_BLANK_TEXT: - NewRoom.esc_script = "%s/%s/scripts/%s" % [BaseDir, RoomName, get_node(ESC_SCRIPT).text] + new_room.esc_script = "%s/%s/scripts/%s" % [base_dir, room_name, get_node(ESC_SCRIPT).text] if ! get_node(PLAYER_SCENE).text == PLAYER_SELECT_TEXT and ! get_node(PLAYER_SCENE).text == PLAYER_BLANK_TEXT: var player_scene = load(get_node(PLAYER_SCENE).text) - NewRoom.player_scene = player_scene + new_room.player_scene = player_scene - var Background = ESCBackground.new() - Background.name = "Background" + var background = ESCBackground.new() + background.name = "Background" - var BackgroundSize = Vector2.ONE + var background_size = Vector2.ONE if ! get_node(BACKGROUND_IMAGE).text == BACKGROUND_SELECT_TEXT and ! get_node(BACKGROUND_IMAGE).text == BACKGROUND_BLANK_TEXT: - Background.texture = get_node(BACKGROUND_PREVIEW).texture - BackgroundSize = Background.texture.get_size() + background.texture = get_node(BACKGROUND_PREVIEW).texture + background_size = background.texture.get_size() else: # Set TextureRect to have the same size as the Viewport so that the room # works even if no texture is set in the TextureRect - BackgroundSize = Vector2(ProjectSettings.get_setting("display/window/size/viewport_width"), \ + background_size = Vector2(ProjectSettings.get_setting("display/window/size/viewport_width"), \ ProjectSettings.get_setting("display/window/size/viewport_height")) - Background.size = BackgroundSize + background.size = background_size - NewRoom.add_child(Background) + new_room.add_child(background) + background.set_owner(new_room) - var NewTerrain = ESCTerrain.new() - NewTerrain.name = "WalkableArea" - var NewNavigationPolygonInstance = NavigationRegion2D.new() + var new_terrain = ESCTerrain.new() + new_terrain.name = "WalkableArea" + var new_navigation_polygon_instance = NavigationRegion2D.new() + var new_navigation_polygon = NavigationPolygon.new() + new_navigation_polygon_instance.navigation_polygon = new_navigation_polygon + new_terrain.add_child(new_navigation_polygon_instance) + new_navigation_polygon_instance.set_owner(new_terrain) + new_room.add_child(new_terrain) - var NewNavigationPolygon = NavigationPolygon.new() - NewNavigationPolygonInstance.navigation_polygon = NewNavigationPolygon - NewRoom.add_child(NewTerrain) + new_terrain.set_owner(new_room) - NewTerrain.add_child(NewNavigationPolygonInstance) + var objects = Node2D.new() + objects.name = "RoomObjects" + new_room.add_child(objects) + objects.set_owner(new_room) - var Objects = Node2D.new() - Objects.name = "RoomObjects" - NewRoom.add_child(Objects) + var start_pos = ESCLocation.new() + start_pos.name = "StartPos" + start_pos.is_start_location = true + start_pos.global_id = "%s_start_pos" % room_name + start_pos.position = Vector2(int(background_size.x / 2), int(background_size.y / 2)) + new_room.add_child(start_pos) + start_pos.set_owner(new_room) - var StartPos = ESCLocation.new() - StartPos.name = "StartPos" - StartPos.is_start_location = true - StartPos.global_id = "%s_start_pos" % RoomName - StartPos.position = Vector2(int(BackgroundSize.x / 2), int(BackgroundSize.y / 2)) - NewRoom.add_child(StartPos) - - get_tree().edited_scene_root.add_child(NewRoom) - NewRoom.set_owner(get_tree().edited_scene_root) - NewNavigationPolygonInstance.set_owner(NewRoom) - NewTerrain.set_owner(NewRoom) - Background.set_owner(NewRoom) - Objects.set_owner(NewRoom) - StartPos.set_owner(NewRoom) - - DirAccess.make_dir_recursive_absolute("%s/%s/scripts" % [BaseDir, RoomName]) - DirAccess.make_dir_recursive_absolute("%s/%s/objects" % [BaseDir, RoomName]) + DirAccess.make_dir_recursive_absolute("%s/%s/scripts" % [base_dir, room_name]) + DirAccess.make_dir_recursive_absolute("%s/%s/objects" % [base_dir, room_name]) DirAccess.copy_absolute("res://addons/escoria-wizard/room_script_template.esc", "%s/%s/scripts/%s" % \ - [BaseDir, RoomName, get_node(ESC_SCRIPT).text]) + [base_dir, room_name, get_node(ESC_SCRIPT).text]) # Export scene var packed_scene = PackedScene.new() - packed_scene.pack(get_tree().edited_scene_root.get_node(NewRoom.name)) + packed_scene.pack(new_room) # Flag suggestions from https://godotengine.org/qa/50437/how-to-turn-a-node-into-a-packedscene-via-gdscript - ResourceSaver.save(packed_scene, "%s/%s/%s.tscn" % [BaseDir, RoomName, RoomName], \ + var error = ResourceSaver.save(packed_scene, "%s/%s/%s.tscn" % [base_dir, room_name, room_name], \ ResourceSaver.FLAG_CHANGE_PATH|ResourceSaver.FLAG_REPLACE_SUBRESOURCE_PATHS) + if error != OK: + push_error("An error occurred while saving the scene to disk.") + + new_room.queue_free() - NewRoom.queue_free() - get_tree().edited_scene_root.get_node(NewRoom.name).queue_free() # Scan the filesystem so that the new folders show up in the file browser. # Without this you might not see the objects/scripts folders in the filetree. var ep = EditorPlugin.new() diff --git a/addons/escoria-wizard/RoomCreator.tscn b/addons/escoria-wizard/RoomCreator.tscn index b7a4210..3828236 100644 --- a/addons/escoria-wizard/RoomCreator.tscn +++ b/addons/escoria-wizard/RoomCreator.tscn @@ -1,117 +1,117 @@ -[gd_scene load_steps=3 format=3 uid="uid://b72fr6t0ed4s0"] +[gd_scene format=3 uid="uid://b72fr6t0ed4s0"] [ext_resource type="Script" uid="uid://bqxah4gdmfyu6" path="res://addons/escoria-wizard/RoomCreator.gd" id="1"] -[ext_resource type="Texture2D" uid="uid://clm4n1qg8fidx" path="res://addons/escoria-wizard/graphics/background_preview.png" id="2"] +[ext_resource type="Texture2D" uid="uid://b3wba8cg2si2b" path="res://addons/escoria-wizard/graphics/background_preview.png" id="2"] -[node name="CenterContainer" type="CenterContainer"] +[node name="CenterContainer" type="CenterContainer" unique_id=443476480] clip_contents = true anchors_preset = 15 anchor_right = 1.0 anchor_bottom = 1.0 script = ExtResource("1") -[node name="MarginContainer" type="MarginContainer" parent="."] +[node name="MarginContainer" type="MarginContainer" parent="." unique_id=1524949415] layout_mode = 2 -[node name="ColorRect" type="ColorRect" parent="MarginContainer"] +[node name="ColorRect" type="ColorRect" parent="MarginContainer" unique_id=2096681083] layout_mode = 2 color = Color(0.235294, 0.341176, 0.290196, 1) -[node name="MarginContainer" type="MarginContainer" parent="MarginContainer"] +[node name="MarginContainer" type="MarginContainer" parent="MarginContainer" unique_id=1109497573] layout_mode = 2 theme_override_constants/margin_left = 5 theme_override_constants/margin_top = 5 theme_override_constants/margin_right = 5 theme_override_constants/margin_bottom = 5 -[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/MarginContainer"] +[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/MarginContainer" unique_id=1940588931] layout_mode = 2 -[node name="CenterContainer" type="CenterContainer" parent="MarginContainer/MarginContainer/VBoxContainer"] +[node name="CenterContainer" type="CenterContainer" parent="MarginContainer/MarginContainer/VBoxContainer" unique_id=85037514] custom_minimum_size = Vector2(0, 40) layout_mode = 2 -[node name="Label" type="Label" parent="MarginContainer/MarginContainer/VBoxContainer/CenterContainer"] +[node name="Label" type="Label" parent="MarginContainer/MarginContainer/VBoxContainer/CenterContainer" unique_id=1156009861] layout_mode = 2 theme_override_colors/font_color = Color(0.921569, 1, 0, 1) theme_override_colors/font_shadow_color = Color(0, 0, 0, 1) text = "Room Creator" uppercase = true -[node name="MarginContainer" type="MarginContainer" parent="MarginContainer/MarginContainer/VBoxContainer"] +[node name="MarginContainer" type="MarginContainer" parent="MarginContainer/MarginContainer/VBoxContainer" unique_id=1511603618] custom_minimum_size = Vector2(460, 200) layout_mode = 2 -[node name="GridContainer" type="GridContainer" parent="MarginContainer/MarginContainer/VBoxContainer/MarginContainer"] +[node name="GridContainer" type="GridContainer" parent="MarginContainer/MarginContainer/VBoxContainer/MarginContainer" unique_id=2053595885] custom_minimum_size = Vector2(300, 200) layout_mode = 2 theme_override_constants/h_separation = 10 columns = 4 -[node name="RoomNameLabel" type="Label" parent="MarginContainer/MarginContainer/VBoxContainer/MarginContainer/GridContainer"] +[node name="RoomNameLabel" type="Label" parent="MarginContainer/MarginContainer/VBoxContainer/MarginContainer/GridContainer" unique_id=190169202] layout_mode = 2 text = "Room name:" -[node name="RoomName" type="LineEdit" parent="MarginContainer/MarginContainer/VBoxContainer/MarginContainer/GridContainer"] +[node name="RoomName" type="LineEdit" parent="MarginContainer/MarginContainer/VBoxContainer/MarginContainer/GridContainer" unique_id=606912093] custom_minimum_size = Vector2(400, 0) layout_mode = 2 caret_blink = true caret_blink_interval = 0.5 -[node name="Spacer3" type="Control" parent="MarginContainer/MarginContainer/VBoxContainer/MarginContainer/GridContainer"] +[node name="Spacer3" type="Control" parent="MarginContainer/MarginContainer/VBoxContainer/MarginContainer/GridContainer" unique_id=2009043994] custom_minimum_size = Vector2(40, 0) layout_mode = 2 -[node name="Spacer6" type="Control" parent="MarginContainer/MarginContainer/VBoxContainer/MarginContainer/GridContainer"] +[node name="Spacer6" type="Control" parent="MarginContainer/MarginContainer/VBoxContainer/MarginContainer/GridContainer" unique_id=2034489688] custom_minimum_size = Vector2(200, 0) layout_mode = 2 -[node name="GlobalIDLabel" type="Label" parent="MarginContainer/MarginContainer/VBoxContainer/MarginContainer/GridContainer"] +[node name="GlobalIDLabel" type="Label" parent="MarginContainer/MarginContainer/VBoxContainer/MarginContainer/GridContainer" unique_id=1440682867] layout_mode = 2 text = "Global ID:" -[node name="GlobalID" type="LineEdit" parent="MarginContainer/MarginContainer/VBoxContainer/MarginContainer/GridContainer"] +[node name="GlobalID" type="LineEdit" parent="MarginContainer/MarginContainer/VBoxContainer/MarginContainer/GridContainer" unique_id=1379464115] layout_mode = 2 caret_blink = true caret_blink_interval = 0.5 -[node name="Spacer4" type="Control" parent="MarginContainer/MarginContainer/VBoxContainer/MarginContainer/GridContainer"] +[node name="Spacer4" type="Control" parent="MarginContainer/MarginContainer/VBoxContainer/MarginContainer/GridContainer" unique_id=1668260232] custom_minimum_size = Vector2(40, 0) layout_mode = 2 -[node name="Spacer7" type="Control" parent="MarginContainer/MarginContainer/VBoxContainer/MarginContainer/GridContainer"] +[node name="Spacer7" type="Control" parent="MarginContainer/MarginContainer/VBoxContainer/MarginContainer/GridContainer" unique_id=166896264] custom_minimum_size = Vector2(40, 0) layout_mode = 2 -[node name="PlayerSceneLabel" type="Label" parent="MarginContainer/MarginContainer/VBoxContainer/MarginContainer/GridContainer"] +[node name="PlayerSceneLabel" type="Label" parent="MarginContainer/MarginContainer/VBoxContainer/MarginContainer/GridContainer" unique_id=992585730] layout_mode = 2 text = "Player scene:" -[node name="PlayerScene" type="LineEdit" parent="MarginContainer/MarginContainer/VBoxContainer/MarginContainer/GridContainer"] +[node name="PlayerScene" type="LineEdit" parent="MarginContainer/MarginContainer/VBoxContainer/MarginContainer/GridContainer" unique_id=1764680015] layout_mode = 2 text = "Scene will be left blank." editable = false caret_blink = true caret_blink_interval = 0.5 -[node name="UseEmptyPlayerButton" type="CheckButton" parent="MarginContainer/MarginContainer/VBoxContainer/MarginContainer/GridContainer"] +[node name="UseEmptyPlayerButton" type="CheckButton" parent="MarginContainer/MarginContainer/VBoxContainer/MarginContainer/GridContainer" unique_id=1137816360] layout_mode = 2 text = "Use empty player scene" -[node name="SelectPlayerScene" type="Button" parent="MarginContainer/MarginContainer/VBoxContainer/MarginContainer/GridContainer"] +[node name="SelectPlayerScene" type="Button" parent="MarginContainer/MarginContainer/VBoxContainer/MarginContainer/GridContainer" unique_id=1850650331] visible = false layout_mode = 2 text = "Select Player Scene" -[node name="SelectPlayerSceneSpacer" type="Control" parent="MarginContainer/MarginContainer/VBoxContainer/MarginContainer/GridContainer"] +[node name="SelectPlayerSceneSpacer" type="Control" parent="MarginContainer/MarginContainer/VBoxContainer/MarginContainer/GridContainer" unique_id=1158438388] custom_minimum_size = Vector2(40, 0) layout_mode = 2 -[node name="ESCScriptLabel" type="Label" parent="MarginContainer/MarginContainer/VBoxContainer/MarginContainer/GridContainer"] +[node name="ESCScriptLabel" type="Label" parent="MarginContainer/MarginContainer/VBoxContainer/MarginContainer/GridContainer" unique_id=1226139985] layout_mode = 2 text = "Room ESC script:" -[node name="ESCScript" type="LineEdit" parent="MarginContainer/MarginContainer/VBoxContainer/MarginContainer/GridContainer"] +[node name="ESCScript" type="LineEdit" parent="MarginContainer/MarginContainer/VBoxContainer/MarginContainer/GridContainer" unique_id=94388860] layout_mode = 2 tooltip_text = "In the room's scripts folder an empty file will be created @@ -121,43 +121,43 @@ editable = false caret_blink = true caret_blink_interval = 0.5 -[node name="UseEmptyRoomScript" type="CheckButton" parent="MarginContainer/MarginContainer/VBoxContainer/MarginContainer/GridContainer"] +[node name="UseEmptyRoomScript" type="CheckButton" parent="MarginContainer/MarginContainer/VBoxContainer/MarginContainer/GridContainer" unique_id=2089004824] layout_mode = 2 text = "No script" -[node name="UseEmptyRoomSpacer" type="Control" parent="MarginContainer/MarginContainer/VBoxContainer/MarginContainer/GridContainer"] +[node name="UseEmptyRoomSpacer" type="Control" parent="MarginContainer/MarginContainer/VBoxContainer/MarginContainer/GridContainer" unique_id=170754280] custom_minimum_size = Vector2(40, 0) layout_mode = 2 -[node name="BackgroundImageLabel" type="Label" parent="MarginContainer/MarginContainer/VBoxContainer/MarginContainer/GridContainer"] +[node name="BackgroundImageLabel" type="Label" parent="MarginContainer/MarginContainer/VBoxContainer/MarginContainer/GridContainer" unique_id=2118551006] layout_mode = 2 text = "Background image:" -[node name="BackgroundImage" type="LineEdit" parent="MarginContainer/MarginContainer/VBoxContainer/MarginContainer/GridContainer"] +[node name="BackgroundImage" type="LineEdit" parent="MarginContainer/MarginContainer/VBoxContainer/MarginContainer/GridContainer" unique_id=1361723740] layout_mode = 2 text = "Image will be left blank." editable = false caret_blink = true caret_blink_interval = 0.5 -[node name="UseEmptyBackground" type="CheckButton" parent="MarginContainer/MarginContainer/VBoxContainer/MarginContainer/GridContainer"] +[node name="UseEmptyBackground" type="CheckButton" parent="MarginContainer/MarginContainer/VBoxContainer/MarginContainer/GridContainer" unique_id=434839193] layout_mode = 2 text = "Use empty background" -[node name="SelectBackground" type="Button" parent="MarginContainer/MarginContainer/VBoxContainer/MarginContainer/GridContainer"] +[node name="SelectBackground" type="Button" parent="MarginContainer/MarginContainer/VBoxContainer/MarginContainer/GridContainer" unique_id=123588015] visible = false layout_mode = 2 text = "Select Background" -[node name="SelectBackgroundSpacer" type="Control" parent="MarginContainer/MarginContainer/VBoxContainer/MarginContainer/GridContainer"] +[node name="SelectBackgroundSpacer" type="Control" parent="MarginContainer/MarginContainer/VBoxContainer/MarginContainer/GridContainer" unique_id=96857991] custom_minimum_size = Vector2(40, 0) layout_mode = 2 -[node name="RoomFolderLabel" type="Label" parent="MarginContainer/MarginContainer/VBoxContainer/MarginContainer/GridContainer"] +[node name="RoomFolderLabel" type="Label" parent="MarginContainer/MarginContainer/VBoxContainer/MarginContainer/GridContainer" unique_id=1807096131] layout_mode = 2 text = "Room folder parent:" -[node name="RoomFolder" type="LineEdit" parent="MarginContainer/MarginContainer/VBoxContainer/MarginContainer/GridContainer"] +[node name="RoomFolder" type="LineEdit" parent="MarginContainer/MarginContainer/VBoxContainer/MarginContainer/GridContainer" unique_id=1262301674] layout_mode = 2 tooltip_text = "A folder (<Global ID>) for your room will be created inside this parent folder." text = "res://game/rooms" @@ -165,99 +165,101 @@ editable = false caret_blink = true caret_blink_interval = 0.5 -[node name="ChangeRoomFolderButton" type="Button" parent="MarginContainer/MarginContainer/VBoxContainer/MarginContainer/GridContainer"] +[node name="ChangeRoomFolderButton" type="Button" parent="MarginContainer/MarginContainer/VBoxContainer/MarginContainer/GridContainer" unique_id=1061137733] layout_mode = 2 text = "Change Room Folder" -[node name="Spacer8" type="Control" parent="MarginContainer/MarginContainer/VBoxContainer/MarginContainer/GridContainer"] +[node name="Spacer8" type="Control" parent="MarginContainer/MarginContainer/VBoxContainer/MarginContainer/GridContainer" unique_id=371909358] custom_minimum_size = Vector2(40, 0) layout_mode = 2 -[node name="PreviewSection" type="MarginContainer" parent="MarginContainer/MarginContainer/VBoxContainer"] +[node name="PreviewSection" type="MarginContainer" parent="MarginContainer/MarginContainer/VBoxContainer" unique_id=544658158] custom_minimum_size = Vector2(1000, 400) layout_mode = 2 -[node name="PreviewFrame" type="ColorRect" parent="MarginContainer/MarginContainer/VBoxContainer/PreviewSection"] +[node name="PreviewFrame" type="ColorRect" parent="MarginContainer/MarginContainer/VBoxContainer/PreviewSection" unique_id=427730384] custom_minimum_size = Vector2(1000, 400) layout_mode = 2 color = Color(0, 0, 0, 1) -[node name="CenterContainer" type="MarginContainer" parent="MarginContainer/MarginContainer/VBoxContainer/PreviewSection"] +[node name="CenterContainer" type="MarginContainer" parent="MarginContainer/MarginContainer/VBoxContainer/PreviewSection" unique_id=360840181] layout_mode = 2 -[node name="RoomBackground" type="TextureRect" parent="MarginContainer/MarginContainer/VBoxContainer/PreviewSection/CenterContainer"] +[node name="RoomBackground" type="TextureRect" parent="MarginContainer/MarginContainer/VBoxContainer/PreviewSection/CenterContainer" unique_id=1552477363] custom_minimum_size = Vector2(990, 390) layout_mode = 2 texture = ExtResource("2") expand_mode = 1 stretch_mode = 7 -[node name="Control" type="Control" parent="MarginContainer/MarginContainer/VBoxContainer/PreviewSection"] +[node name="Control" type="Control" parent="MarginContainer/MarginContainer/VBoxContainer/PreviewSection" unique_id=1150908173] layout_mode = 2 -[node name="BackgroundPreview" type="TextureRect" parent="MarginContainer/MarginContainer/VBoxContainer/PreviewSection/Control"] +[node name="BackgroundPreview" type="TextureRect" parent="MarginContainer/MarginContainer/VBoxContainer/PreviewSection/Control" unique_id=1507500464] layout_mode = 0 offset_right = 1000.0 offset_bottom = 400.0 -[node name="MarginContainer2" type="MarginContainer" parent="MarginContainer/MarginContainer/VBoxContainer"] +[node name="MarginContainer2" type="MarginContainer" parent="MarginContainer/MarginContainer/VBoxContainer" unique_id=91854857] custom_minimum_size = Vector2(0, 80) layout_mode = 2 -[node name="CenterContainer" type="CenterContainer" parent="MarginContainer/MarginContainer/VBoxContainer/MarginContainer2"] +[node name="CenterContainer" type="CenterContainer" parent="MarginContainer/MarginContainer/VBoxContainer/MarginContainer2" unique_id=117241011] custom_minimum_size = Vector2(800, 80) layout_mode = 2 -[node name="GridContainer" type="GridContainer" parent="MarginContainer/MarginContainer/VBoxContainer/MarginContainer2/CenterContainer"] +[node name="GridContainer" type="GridContainer" parent="MarginContainer/MarginContainer/VBoxContainer/MarginContainer2/CenterContainer" unique_id=93516859] custom_minimum_size = Vector2(300, 40) layout_mode = 2 theme_override_constants/h_separation = 40 columns = 3 -[node name="CreateButton" type="Button" parent="MarginContainer/MarginContainer/VBoxContainer/MarginContainer2/CenterContainer/GridContainer"] +[node name="CreateButton" type="Button" parent="MarginContainer/MarginContainer/VBoxContainer/MarginContainer2/CenterContainer/GridContainer" unique_id=1783379866] layout_mode = 2 text = "Create Room" -[node name="ClearButton" type="Button" parent="MarginContainer/MarginContainer/VBoxContainer/MarginContainer2/CenterContainer/GridContainer"] +[node name="ClearButton" type="Button" parent="MarginContainer/MarginContainer/VBoxContainer/MarginContainer2/CenterContainer/GridContainer" unique_id=495821110] layout_mode = 2 text = "Clear" -[node name="MainMenuButton" type="Button" parent="MarginContainer/MarginContainer/VBoxContainer/MarginContainer2/CenterContainer/GridContainer"] +[node name="MainMenuButton" type="Button" parent="MarginContainer/MarginContainer/VBoxContainer/MarginContainer2/CenterContainer/GridContainer" unique_id=560281339] layout_mode = 2 text = "Main Menu" -[node name="InformationWindows" type="Control" parent="."] +[node name="InformationWindows" type="Control" parent="." unique_id=1537642924] layout_mode = 2 -[node name="PlayerSceneFileDialog" type="FileDialog" parent="InformationWindows"] +[node name="PlayerSceneFileDialog" type="FileDialog" parent="InformationWindows" unique_id=1145823587] filters = PackedStringArray("*.tscn, *.scn ; Scene Files") -[node name="ESCScriptFileDialog" type="FileDialog" parent="InformationWindows"] +[node name="ESCScriptFileDialog" type="FileDialog" parent="InformationWindows" unique_id=2037463107] filters = PackedStringArray("*.esc; Escoria script files") -[node name="BackgroundImageFileDialog" type="FileDialog" parent="InformationWindows"] +[node name="BackgroundImageFileDialog" type="FileDialog" parent="InformationWindows" unique_id=527515950] +title = "Open a File" +file_mode = 0 filters = PackedStringArray("*.png, *.jpg, *.jpeg ; Supported Images") -[node name="ClearConfirmationDialog" type="ConfirmationDialog" parent="InformationWindows"] +[node name="ClearConfirmationDialog" type="ConfirmationDialog" parent="InformationWindows" unique_id=909240617] dialog_text = "WARNING! If you continue you will lose the current room setup." -[node name="MainMenuConfirmationDialog" type="ConfirmationDialog" parent="InformationWindows"] +[node name="MainMenuConfirmationDialog" type="ConfirmationDialog" parent="InformationWindows" unique_id=1514890737] dialog_text = "WARNING! If you continue you will lose the current room setup." -[node name="GenericErrorDialog" type="AcceptDialog" parent="InformationWindows"] +[node name="GenericErrorDialog" type="AcceptDialog" parent="InformationWindows" unique_id=1255486392] dialog_text = "ERROR! Please supply a name for the room." -[node name="CreateCompleteDialog" type="AcceptDialog" parent="InformationWindows"] +[node name="CreateCompleteDialog" type="AcceptDialog" parent="InformationWindows" unique_id=121100860] dialog_text = "The room has been created." -[node name="RoomFolderDialog" type="FileDialog" parent="InformationWindows"] -mode = 2 +[node name="RoomFolderDialog" type="FileDialog" parent="InformationWindows" unique_id=1336376019] +file_mode = 2 [connection signal="text_changed" from="MarginContainer/MarginContainer/VBoxContainer/MarginContainer/GridContainer/RoomName" to="." method="_on_RoomName_text_changed"] [connection signal="text_changed" from="MarginContainer/MarginContainer/VBoxContainer/MarginContainer/GridContainer/GlobalID" to="." method="_on_GlobalID_text_changed"] diff --git a/addons/escoria-wizard/item_creator.gd b/addons/escoria-wizard/item_creator.gd index 6a279b8..93b08ce 100644 --- a/addons/escoria-wizard/item_creator.gd +++ b/addons/escoria-wizard/item_creator.gd @@ -1,3 +1,6 @@ +# gdlint:disable=function-name +# gdlint:disable=no-else-return +# TODO: Fix this file's legacy lint violations and remove the gdlint disables above. @tool extends MarginContainer @@ -36,27 +39,29 @@ var preview_size:Vector2 # Called when the node enters the scene tree for the first time. + func _ready() -> void: # Capture the size of the window before we update its contents so we have # the absolute size before it gets scaled contents applied to it - preview_size = get_node(PREVIEW_NODE).size + preview_size = get_node(PREVIEW_NODE).get_size() inventory_mode = not get_node(BACKGROUND_OBJ_NODE).pressed + + var action_option: OptionButton = get_node(ACTION_NODE) + action_option.clear() + for option_list in ["", "look", "pick up", "open", "close", "use", "push", "pull", "talk"]: + action_option.add_item(option_list) + item_creator_reset() + func item_creator_reset() -> void: get_node(ITEM_NAME_NODE).text = "replace_me" get_node(GLOBAL_ID_NODE).text = "" get_node(IMAGE_PATH_NODE).text = "" get_node(INTERACTIVE_NODE).button_pressed = true - - if get_node(ACTION_NODE).get_item_count() > 0: - get_node(ACTION_NODE).clear() - - for option_list in ["look", "pick up", "open", "close", "use", "push", "pull", "talk"]: - get_node(ACTION_NODE).add_item(option_list) - get_node(ACTION_NODE).selected = 0 + image_size = Vector2.ZERO image_has_been_loaded = false main_menu_requested = false @@ -91,9 +96,10 @@ func resize_image() -> void: # Calculate the scale to make the preview as big as possible in the preview window depending on # the height to width ratio of the frame image_size = image_stream_texture.get_size() + var preview_scale = Vector2.ONE - preview_scale.x = preview_size.x / image_size.x - preview_scale.y = preview_size.y / image_size.y + preview_scale.x = clampf(preview_size.x / image_size.x, 0, 1) + preview_scale.y = clampf(preview_size.y / image_size.y, 0, 1) if preview_scale.y > preview_scale.x: get_node(PREVIEW_NODE).scale = Vector2(preview_scale.x, preview_scale.x) @@ -110,12 +116,17 @@ func load_button_pressed() -> void: func LoadObjectFileDialog_file_selected(path: String) -> void: - image_stream_texture = load(path) - - get_node(PREVIEW_NODE).texture = image_stream_texture + var loaded_texture := load(path) as CompressedTexture2D + if loaded_texture == null: + get_node(ERROR_WINDOW_NODE).dialog_text = "Failed to load image: %s" % path + get_node(ERROR_WINDOW_NODE).popup_centered() + return + image_stream_texture = loaded_texture resize_image() + get_node(PREVIEW_NODE).texture = image_stream_texture + get_node(IMAGE_SIZE_NODE).text = "(%s, %s)" % [image_size.x, image_size.y] get_node(IMAGE_PATH_NODE).text = path @@ -155,17 +166,17 @@ func _on_CreateButton_pressed() -> void: var item = ESCItem.new() item.name = get_node(ITEM_NAME_NODE).text item.global_id = get_node(GLOBAL_ID_NODE).text - item.is_interactive = get_node(INTERACTIVE_NODE).pressed + item.is_interactive = get_node(INTERACTIVE_NODE).button_pressed item.tooltip_name = get_node(ITEM_NAME_NODE).text var selected_index = get_node(ACTION_NODE).selected item.default_action = get_node(ACTION_NODE).get_item_text(selected_index) - # Make the item by default it's usable straight out of the inventory + # Make the item use a second target object by default when used from inventory. if inventory_mode == true: - var new_pool_array: PackedStringArray = item.combine_when_selected_action_is_in + var new_pool_array: PackedStringArray = item.actions_requiring_target_object new_pool_array.append("use") - item.combine_when_selected_action_is_in = new_pool_array + item.actions_requiring_target_object = new_pool_array # Add Dialog Position to the background item var interact_position = ESCLocation.new() |
