diff options
Diffstat (limited to 'editor/editor_file_dialog.cpp')
-rw-r--r-- | editor/editor_file_dialog.cpp | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/editor/editor_file_dialog.cpp b/editor/editor_file_dialog.cpp index 6262680454..f877aab577 100644 --- a/editor/editor_file_dialog.cpp +++ b/editor/editor_file_dialog.cpp @@ -199,7 +199,10 @@ Vector<String> EditorFileDialog::get_selected_files() const { void EditorFileDialog::update_dir() { - dir->set_text(dir_access->get_current_dir()); + if (drives->is_visible()) { + drives->select(dir_access->get_current_drive()); + } + dir->set_text(dir_access->get_current_dir(false)); // Disable "Open" button only when selecting file(s) mode. get_ok()->set_disabled(_is_open_should_be_disabled()); @@ -946,7 +949,7 @@ void EditorFileDialog::add_filter(const String &p_filter) { String EditorFileDialog::get_current_dir() const { - return dir->get_text(); + return dir_access->get_current_dir(); } String EditorFileDialog::get_current_file() const { @@ -954,7 +957,7 @@ String EditorFileDialog::get_current_file() const { } String EditorFileDialog::get_current_path() const { - return dir->get_text().plus_file(file->get_text()); + return dir_access->get_current_dir().plus_file(file->get_text()); } void EditorFileDialog::set_current_dir(const String &p_dir) { @@ -1149,6 +1152,12 @@ void EditorFileDialog::_update_drives() { drives->hide(); } else { drives->clear(); + Node *dp = drives->get_parent(); + if (dp) { + dp->remove_child(drives); + } + dp = dir_access->drives_are_shortcuts() ? shortcuts_container : drives_container; + dp->add_child(drives); drives->show(); for (int i = 0; i < dir_access->get_drive_count(); i++) { @@ -1517,6 +1526,9 @@ EditorFileDialog::EditorFileDialog() { pathhb->add_child(memnew(Label(TTR("Path:")))); + drives_container = memnew(HBoxContainer); + pathhb->add_child(drives_container); + dir = memnew(LineEdit); pathhb->add_child(dir); dir->set_h_size_flags(SIZE_EXPAND_FILL); @@ -1560,8 +1572,10 @@ EditorFileDialog::EditorFileDialog() { mode_list->set_tooltip(TTR("View items as a list.")); pathhb->add_child(mode_list); + shortcuts_container = memnew(HBoxContainer); + pathhb->add_child(shortcuts_container); + drives = memnew(OptionButton); - pathhb->add_child(drives); drives->connect("item_selected", callable_mp(this, &EditorFileDialog::_select_drive)); makedir = memnew(Button); |