summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRindbee <idleman@yeah.net>2022-09-06 08:54:34 +0800
committerRindbee <idleman@yeah.net>2022-09-07 21:36:21 +0800
commit88b72c3de41be88f121e9fbf8365dc9d51586256 (patch)
tree74633b5d53af2b1cf07a8e677c984d3154c671b7
parent86dd3f312c4ff8ef8be04b9a210415d21f2ca269 (diff)
Fix file list in FileDialog not updating on first run
-rw-r--r--editor/editor_file_dialog.cpp20
-rw-r--r--scene/gui/file_dialog.cpp6
2 files changed, 8 insertions, 18 deletions
diff --git a/editor/editor_file_dialog.cpp b/editor/editor_file_dialog.cpp
index 36ca1619a4..629f72b974 100644
--- a/editor/editor_file_dialog.cpp
+++ b/editor/editor_file_dialog.cpp
@@ -145,6 +145,8 @@ void EditorFileDialog::_notification(int p_what) {
if (!is_visible()) {
set_process_shortcut_input(false);
}
+
+ invalidate(); // For consistency with the standard FileDialog.
} break;
case NOTIFICATION_WM_WINDOW_FOCUS_IN: {
@@ -304,10 +306,6 @@ void EditorFileDialog::_post_popup() {
}
set_current_dir(current);
- if (invalidated) {
- update_file_list();
- invalidated = false;
- }
if (mode == FILE_MODE_SAVE_FILE) {
file->grab_focus();
} else {
@@ -320,19 +318,13 @@ void EditorFileDialog::_post_popup() {
file_box->set_visible(true);
}
- if (is_visible() && !get_current_file().is_empty()) {
+ if (!get_current_file().is_empty()) {
_request_single_thumbnail(get_current_dir().path_join(get_current_file()));
}
- if (is_visible()) {
- _update_recent();
-
- local_history.clear();
- local_history_pos = -1;
- _push_history();
-
- _update_favorites();
- }
+ local_history.clear();
+ local_history_pos = -1;
+ _push_history();
set_process_shortcut_input(true);
}
diff --git a/scene/gui/file_dialog.cpp b/scene/gui/file_dialog.cpp
index 79d563c072..9fdb9537a0 100644
--- a/scene/gui/file_dialog.cpp
+++ b/scene/gui/file_dialog.cpp
@@ -87,6 +87,8 @@ void FileDialog::_notification(int p_what) {
if (!is_visible()) {
set_process_shortcut_input(false);
}
+
+ invalidate(); // Put it here to preview in the editor.
} break;
case NOTIFICATION_THEME_CHANGED: {
@@ -223,10 +225,6 @@ void FileDialog::_save_confirm_pressed() {
void FileDialog::_post_popup() {
ConfirmationDialog::_post_popup();
- if (invalidated) {
- update_file_list();
- invalidated = false;
- }
if (mode == FILE_MODE_SAVE_FILE) {
file->grab_focus();
} else {