summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
authorMCrafterzz <marcusaccounts@yahoo.se>2019-10-26 17:29:22 +0200
committerMCrafterzz <marcusaccounts@yahoo.se>2019-10-29 11:36:09 +0100
commit336e61b36ac99bfa6d295618caf28efb11201696 (patch)
treeec962c0ec7e127159017b7ad235acd316a309189 /editor
parentcbfb944a7be4cc111fe43e504428107d8342bbd6 (diff)
Improved UX of selecting directories in (Editor)FileDialog by hiding unused gui elements and moving the drive selection
Diffstat (limited to 'editor')
-rw-r--r--editor/editor_file_dialog.cpp18
-rw-r--r--editor/editor_file_dialog.h3
2 files changed, 14 insertions, 7 deletions
diff --git a/editor/editor_file_dialog.cpp b/editor/editor_file_dialog.cpp
index 02a9cc905b..2af292849b 100644
--- a/editor/editor_file_dialog.cpp
+++ b/editor/editor_file_dialog.cpp
@@ -253,6 +253,12 @@ void EditorFileDialog::_post_popup() {
else
item_list->grab_focus();
+ if (mode == MODE_OPEN_DIR) {
+ file_box->set_visible(false);
+ } else {
+ file_box->set_visible(true);
+ }
+
if (is_visible_in_tree() && get_current_file() != "")
_request_single_thumbnail(get_current_dir().plus_file(get_current_file()));
@@ -1658,19 +1664,19 @@ EditorFileDialog::EditorFileDialog() {
prev_cc->add_child(preview);
preview_vb->hide();
- HBoxContainer *filename_hbc = memnew(HBoxContainer);
- filename_hbc->add_child(memnew(Label(TTR("File:"))));
+ file_box = memnew(HBoxContainer);
+ file_box->add_child(memnew(Label(TTR("File:"))));
file = memnew(LineEdit);
file->set_stretch_ratio(4);
file->set_h_size_flags(SIZE_EXPAND_FILL);
- filename_hbc->add_child(file);
+ file_box->add_child(file);
filter = memnew(OptionButton);
filter->set_stretch_ratio(3);
filter->set_h_size_flags(SIZE_EXPAND_FILL);
filter->set_clip_text(true); // Too many extensions overflow it.
- filename_hbc->add_child(filter);
- filename_hbc->set_h_size_flags(SIZE_EXPAND_FILL);
- item_vb->add_child(filename_hbc);
+ file_box->add_child(filter);
+ file_box->set_h_size_flags(SIZE_EXPAND_FILL);
+ item_vb->add_child(file_box);
dir_access = DirAccess::create(DirAccess::ACCESS_RESOURCES);
access = ACCESS_RESOURCES;
diff --git a/editor/editor_file_dialog.h b/editor/editor_file_dialog.h
index 2ecfa7db15..af52f6af5b 100644
--- a/editor/editor_file_dialog.h
+++ b/editor/editor_file_dialog.h
@@ -106,10 +106,11 @@ private:
TextureRect *preview;
VBoxContainer *preview_vb;
HSplitContainer *list_hb;
+ HBoxContainer *file_box;
LineEdit *file;
+ OptionButton *filter;
AcceptDialog *mkdirerr;
AcceptDialog *exterr;
- OptionButton *filter;
DirAccess *dir_access;
ConfirmationDialog *confirm_save;
DependencyRemoveDialog *remove_dialog;