diff options
Diffstat (limited to 'editor/editor_autoload_settings.cpp')
-rw-r--r-- | editor/editor_autoload_settings.cpp | 39 |
1 files changed, 22 insertions, 17 deletions
diff --git a/editor/editor_autoload_settings.cpp b/editor/editor_autoload_settings.cpp index 6d31141be7..281d614ea9 100644 --- a/editor/editor_autoload_settings.cpp +++ b/editor/editor_autoload_settings.cpp @@ -32,8 +32,9 @@ #include "core/config/project_settings.h" #include "core/core_constants.h" -#include "editor_node.h" -#include "editor_scale.h" +#include "editor/editor_file_dialog.h" +#include "editor/editor_node.h" +#include "editor/editor_scale.h" #include "project_settings_editor.h" #include "scene/main/window.h" #include "scene/resources/packed_scene.h" @@ -41,23 +42,27 @@ #define PREVIEW_LIST_MAX_SIZE 10 void EditorAutoloadSettings::_notification(int p_what) { - if (p_what == NOTIFICATION_ENTER_TREE) { - List<String> afn; - ResourceLoader::get_recognized_extensions_for_type("Script", &afn); - ResourceLoader::get_recognized_extensions_for_type("PackedScene", &afn); - - for (const String &E : afn) { - file_dialog->add_filter("*." + E); - } + switch (p_what) { + case NOTIFICATION_ENTER_TREE: { + List<String> afn; + ResourceLoader::get_recognized_extensions_for_type("Script", &afn); + ResourceLoader::get_recognized_extensions_for_type("PackedScene", &afn); + + for (const String &E : afn) { + file_dialog->add_filter("*." + E); + } - for (const AutoLoadInfo &info : autoload_cache) { - if (info.node && info.in_editor) { - get_tree()->get_root()->call_deferred(SNAME("add_child"), info.node); + for (const AutoLoadInfo &info : autoload_cache) { + if (info.node && info.in_editor) { + get_tree()->get_root()->call_deferred(SNAME("add_child"), info.node); + } } - } - browse_button->set_icon(get_theme_icon(SNAME("Folder"), SNAME("EditorIcons"))); - } else if (p_what == NOTIFICATION_THEME_CHANGED) { - browse_button->set_icon(get_theme_icon(SNAME("Folder"), SNAME("EditorIcons"))); + browse_button->set_icon(get_theme_icon(SNAME("Folder"), SNAME("EditorIcons"))); + } break; + + case NOTIFICATION_THEME_CHANGED: { + browse_button->set_icon(get_theme_icon(SNAME("Folder"), SNAME("EditorIcons"))); + } break; } } |