Skip to content

Commit ffe00d5

Browse files
committed
Moved File Filter When Filesystem Dock is on the Bottom Panel
When the Filesystem Dock is on the bottom panel vertical space is more valuable than horizontal space. Moving the file filter to be horizontal with the current path LineEdit makes the dock more space efficient when on the bottom panel. When docked on the side, the file filter is unchanged.
1 parent 60710df commit ffe00d5

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

editor/docks/filesystem_dock.cpp

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,11 @@ void FileSystemDock::_update_display_mode(bool p_force) {
489489
button_toggle_display_mode->set_button_icon(get_editor_theme_icon(SNAME("Panels1")));
490490
tree->show();
491491
tree->set_v_size_flags(SIZE_EXPAND_FILL);
492-
toolbar2_hbc->show();
492+
if (horizontal) {
493+
toolbar2_hbc->hide();
494+
} else {
495+
toolbar2_hbc->show();
496+
}
493497

494498
_update_tree(get_uncollapsed_paths());
495499
file_list_vb->hide();
@@ -4019,12 +4023,14 @@ MenuButton *FileSystemDock::_create_file_menu_button() {
40194023
}
40204024

40214025
void FileSystemDock::update_layout(EditorDock::DockLayout p_layout) {
4022-
bool horizontal = p_layout == EditorDock::DOCK_LAYOUT_HORIZONTAL;
4026+
horizontal = p_layout == EditorDock::DOCK_LAYOUT_HORIZONTAL;
40234027
if (button_dock_placement->is_visible() == horizontal) {
40244028
return;
40254029
}
40264030

40274031
if (horizontal) {
4032+
path_hb->reparent(toolbar_hbc, false);
4033+
toolbar_hbc->move_child(path_hb, 2);
40284034
set_meta("_dock_display_mode", get_display_mode());
40294035
set_meta("_dock_file_display_mode", get_file_list_display_mode());
40304036

@@ -4035,6 +4041,8 @@ void FileSystemDock::update_layout(EditorDock::DockLayout p_layout) {
40354041
set_file_list_display_mode(new_file_display_mode);
40364042
set_custom_minimum_size(Size2(0, 200) * EDSCALE);
40374043
} else {
4044+
path_hb->reparent(file_list_vb);
4045+
file_list_vb->move_child(path_hb, 0);
40384046
set_meta("_bottom_display_mode", get_display_mode());
40394047
set_meta("_bottom_file_display_mode", get_file_list_display_mode());
40404048

@@ -4180,7 +4188,7 @@ FileSystemDock::FileSystemDock() {
41804188
VBoxContainer *top_vbc = memnew(VBoxContainer);
41814189
main_vb->add_child(top_vbc);
41824190

4183-
HBoxContainer *toolbar_hbc = memnew(HBoxContainer);
4191+
toolbar_hbc = memnew(HBoxContainer);
41844192
top_vbc->add_child(toolbar_hbc);
41854193

41864194
HBoxContainer *nav_hbc = memnew(HBoxContainer);
@@ -4276,6 +4284,7 @@ FileSystemDock::FileSystemDock() {
42764284
split_box->add_child(file_list_vb);
42774285

42784286
path_hb = memnew(HBoxContainer);
4287+
path_hb->set_h_size_flags(SIZE_EXPAND_FILL);
42794288
file_list_vb->add_child(path_hb);
42804289

42814290
file_list_search_box = memnew(LineEdit);

editor/docks/filesystem_dock.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ class FileSystemDock : public EditorDock {
165165
Button *button_hist_prev = nullptr;
166166
LineEdit *current_path_line_edit = nullptr;
167167

168+
HBoxContainer *toolbar_hbc = nullptr;
168169
HBoxContainer *toolbar2_hbc = nullptr;
169170
LineEdit *tree_search_box = nullptr;
170171
MenuButton *tree_button_sort = nullptr;
@@ -182,6 +183,8 @@ class FileSystemDock : public EditorDock {
182183
DisplayMode display_mode;
183184
DisplayMode old_display_mode;
184185

186+
bool horizontal = false;
187+
185188
PopupMenu *file_list_popup = nullptr;
186189
PopupMenu *tree_popup = nullptr;
187190

0 commit comments

Comments
 (0)