Skip to content

Commit

Permalink
Editor UI: Sidebar upgrade (#2350)
Browse files Browse the repository at this point in the history
Adds the functionality to collapse the sidebar.
Adds three new modes for sorting the resources in the resource list: Folder, Path, and Type. Type is the new default.
Allows selecting with enter after searching in the sidebar filter.
---------
Co-authored-by: Jowan-Spooner <[email protected]>
  • Loading branch information
firedfromlife authored Sep 22, 2024
1 parent 71bced7 commit 8c79991
Show file tree
Hide file tree
Showing 6 changed files with 697 additions and 215 deletions.
108 changes: 92 additions & 16 deletions addons/dialogic/Editor/Common/side_bar.tscn
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
[gd_scene load_steps=5 format=3 uid="uid://cwe3r2tbh2og1"]
[gd_scene load_steps=7 format=3 uid="uid://cwe3r2tbh2og1"]

[ext_resource type="Script" path="res://addons/dialogic/Editor/Common/sidebar.gd" id="1_jnq65"]
[ext_resource type="Texture2D" uid="uid://bff65e82555qr" path="res://addons/dialogic/Editor/Images/Pieces/close-icon.svg" id="2_54pks"]
[ext_resource type="Texture2D" uid="uid://dx3o2ild56i76" path="res://addons/dialogic/Editor/Images/Pieces/closed-icon.svg" id="2_ilyps"]

[sub_resource type="Theme" id="Theme_pn0f4"]
VBoxContainer/constants/separation = 4
Expand All @@ -20,24 +22,41 @@ theme = SubResource("Theme_pn0f4")
split_offset = 100
script = ExtResource("1_jnq65")

[node name="VBox" type="VBoxContainer" parent="."]
[node name="VBoxHidden" type="VBoxContainer" parent="."]
unique_name_in_owner = true
visible = false
layout_mode = 2

[node name="OpenButton" type="Button" parent="VBoxHidden"]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 0
size_flags_vertical = 3
tooltip_text = "Show Sidebar"
theme_override_constants/icon_max_width = 20
icon = ExtResource("2_ilyps")
flat = true
icon_alignment = 1

[node name="Margin" type="MarginContainer" parent="VBox"]
[node name="VBoxPrimary" type="VBoxContainer" parent="."]
unique_name_in_owner = true
layout_mode = 2
size_flags_vertical = 3

[node name="Margin" type="MarginContainer" parent="VBoxPrimary"]
layout_mode = 2
size_flags_vertical = 3
theme_override_constants/margin_left = 5
theme_override_constants/margin_bottom = 5

[node name="VSplitContainer" type="VSplitContainer" parent="VBox/Margin"]
[node name="VSplitContainer" type="VSplitContainer" parent="VBoxPrimary/Margin"]
layout_mode = 2

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

[node name="Logo" type="TextureRect" parent="VBox/Margin/VSplitContainer/VBox"]
[node name="Logo" type="TextureRect" parent="VBoxPrimary/Margin/VSplitContainer/VBox"]
unique_name_in_owner = true
modulate = Color(1, 1, 1, 0.623529)
texture_filter = 6
Expand All @@ -46,33 +65,89 @@ layout_mode = 2
expand_mode = 3
stretch_mode = 4

[node name="CurrentResource" type="LineEdit" parent="VBox/Margin/VSplitContainer/VBox"]
[node name="HBox" type="HBoxContainer" parent="VBoxPrimary/Margin/VSplitContainer/VBox"]
layout_mode = 2

[node name="CurrentResource" type="LineEdit" parent="VBoxPrimary/Margin/VSplitContainer/VBox/HBox"]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
text = "No resource"
alignment = 1
editable = false

[node name="Search" type="LineEdit" parent="VBox/Margin/VSplitContainer/VBox"]
[node name="CloseButton" type="Button" parent="VBoxPrimary/Margin/VSplitContainer/VBox/HBox"]
unique_name_in_owner = true
layout_mode = 2
tooltip_text = "Hide Sidebar"
text = " "
icon = ExtResource("2_54pks")
flat = true
icon_alignment = 1
expand_icon = true

[node name="HBoxSearchSort" type="HBoxContainer" parent="VBoxPrimary/Margin/VSplitContainer/VBox"]
layout_mode = 2

[node name="Search" type="LineEdit" parent="VBoxPrimary/Margin/VSplitContainer/VBox/HBoxSearchSort"]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
tooltip_text = "Filter Resources"
placeholder_text = "Filter Resources"
caret_blink = true
caret_blink_interval = 0.5

[node name="ResourcesList" type="ItemList" parent="VBox/Margin/VSplitContainer/VBox"]
[node name="SortOption" type="OptionButton" parent="VBoxPrimary/Margin/VSplitContainer/VBox/HBoxSearchSort"]
unique_name_in_owner = true
layout_mode = 2
tooltip_text = "Sort
- Default: Sort alphabetically split into Characters & Timeilnes.
- Folder: Sort alphabetically by parent directory.
- Path: Display full path relative to res://.
- None: Sort alphabetically with no categories."
text_overrun_behavior = 1
clip_text = true
selected = 0
item_count = 4
popup/item_0/text = "Type"
popup/item_1/text = "Folder"
popup/item_1/id = 1
popup/item_2/text = "Path"
popup/item_2/id = 2
popup/item_3/text = "None"
popup/item_3/id = 3

[node name="ResourceTree" type="Tree" parent="VBoxPrimary/Margin/VSplitContainer/VBox"]
unique_name_in_owner = true
layout_mode = 2
size_flags_vertical = 3
same_column_width = true
allow_rmb_select = true
hide_root = true
scroll_horizontal_enabled = false

[node name="HBoxContainer" type="HBoxContainer" parent="VBoxPrimary/Margin/VSplitContainer/VBox"]
visible = false
layout_mode = 2

[node name="Label" type="Label" parent="VBoxPrimary/Margin/VSplitContainer/VBox/HBoxContainer"]
layout_mode = 2
size_flags_vertical = 1
text = "Sort Order"
vertical_alignment = 1

[node name="SortOption" type="OptionButton" parent="VBoxPrimary/Margin/VSplitContainer/VBox/HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3
item_count = 1
popup/item_0/text = "Alphabetical (All)"

[node name="ContentListSection" type="VBoxContainer" parent="VBox/Margin/VSplitContainer"]
[node name="ContentListSection" type="VBoxContainer" parent="VBoxPrimary/Margin/VSplitContainer"]
unique_name_in_owner = true
layout_mode = 2
size_flags_vertical = 3

[node name="ContentList" type="ItemList" parent="VBox/Margin/VSplitContainer/ContentListSection"]
[node name="ContentList" type="ItemList" parent="VBoxPrimary/Margin/VSplitContainer/ContentListSection"]
unique_name_in_owner = true
layout_mode = 2
size_flags_vertical = 3
Expand All @@ -82,7 +157,7 @@ theme_override_styles/selected_focus = SubResource("StyleBoxEmpty_n8rql")
allow_reselect = true
same_column_width = true

[node name="CurrentVersion" type="Button" parent="VBox"]
[node name="CurrentVersion" type="Button" parent="VBoxPrimary"]
unique_name_in_owner = true
layout_mode = 2
text = "Some Version"
Expand All @@ -93,7 +168,8 @@ clip_text = true
unique_name_in_owner = true
size = Vector2i(164, 100)

[connection signal="gui_input" from="VBox/Margin/VSplitContainer/VBox/Logo" to="." method="_on_logo_gui_input"]
[connection signal="text_changed" from="VBox/Margin/VSplitContainer/VBox/Search" to="." method="_on_search_text_changed"]
[connection signal="pressed" from="VBox/CurrentVersion" to="." method="_on_current_version_pressed"]
[connection signal="gui_input" from="VBoxPrimary/Margin/VSplitContainer/VBox/Logo" to="." method="_on_logo_gui_input"]
[connection signal="text_changed" from="VBoxPrimary/Margin/VSplitContainer/VBox/HBoxSearchSort/Search" to="." method="_on_search_text_changed"]
[connection signal="text_submitted" from="VBoxPrimary/Margin/VSplitContainer/VBox/HBoxSearchSort/Search" to="." method="_on_search_text_submitted"]
[connection signal="pressed" from="VBoxPrimary/CurrentVersion" to="." method="_on_current_version_pressed"]
[connection signal="id_pressed" from="RightClickMenu" to="." method="_on_right_click_menu_id_pressed"]
Loading

0 comments on commit 8c79991

Please sign in to comment.