summaryrefslogtreecommitdiffstats
path: root/editor/filesystem_dock.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'editor/filesystem_dock.cpp')
-rw-r--r--editor/filesystem_dock.cpp49
1 files changed, 19 insertions, 30 deletions
diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp
index 1082e4d0c2..dd2eec6893 100644
--- a/editor/filesystem_dock.cpp
+++ b/editor/filesystem_dock.cpp
@@ -649,8 +649,7 @@ void FileSystemDock::_notification(int p_what) {
}
if (do_redraw) {
- _update_file_list(true);
- _update_tree(get_uncollapsed_paths());
+ update_all();
}
if (EditorThemeManager::is_generated_theme_outdated()) {
@@ -1343,13 +1342,7 @@ void FileSystemDock::_fs_changed() {
scanning_vb->hide();
split_box->show();
- if (tree->is_visible()) {
- _update_tree(get_uncollapsed_paths());
- }
-
- if (file_list_vb->is_visible()) {
- _update_file_list(true);
- }
+ update_all();
if (!select_after_scan.is_empty()) {
_navigate_to_path(select_after_scan);
@@ -1361,15 +1354,6 @@ void FileSystemDock::_fs_changed() {
set_process(false);
}
-void FileSystemDock::_directory_created(const String &p_path) {
- if (!DirAccess::exists(p_path)) {
- return;
- }
- EditorFileSystem::get_singleton()->add_new_directory(p_path);
- _update_tree(get_uncollapsed_paths());
- _update_file_list(true);
-}
-
void FileSystemDock::_set_scanning_mode() {
button_hist_prev->set_disabled(true);
button_hist_next->set_disabled(true);
@@ -2678,8 +2662,11 @@ void FileSystemDock::_file_option(int p_option, const Vector<String> &p_selected
} break;
default: {
- // Resource conversion commands:
- if (p_option >= CONVERT_BASE_ID) {
+ if (p_option >= EditorContextMenuPlugin::BASE_ID) {
+ if (!EditorContextMenuPluginManager::get_singleton()->activate_custom_option(EditorContextMenuPlugin::CONTEXT_SLOT_FILESYSTEM, p_option, p_selected)) {
+ EditorContextMenuPluginManager::get_singleton()->activate_custom_option(EditorContextMenuPlugin::CONTEXT_SLOT_FILESYSTEM_CREATE, p_option, p_selected);
+ }
+ } else if (p_option >= CONVERT_BASE_ID) {
selected_conversion_id = p_option - CONVERT_BASE_ID;
ERR_FAIL_INDEX(selected_conversion_id, (int)cached_valid_conversion_targets.size());
@@ -2697,10 +2684,6 @@ void FileSystemDock::_file_option(int p_option, const Vector<String> &p_selected
}
conversion_id++;
}
- } else {
- if (!EditorContextMenuPluginManager::get_singleton()->activate_custom_option(EditorContextMenuPlugin::CONTEXT_SLOT_FILESYSTEM, p_option, p_selected)) {
- EditorContextMenuPluginManager::get_singleton()->activate_custom_option(EditorContextMenuPlugin::CONTEXT_SLOT_FILESYSTEM_CREATE, p_option, p_selected);
- }
}
break;
}
@@ -2820,6 +2803,16 @@ void FileSystemDock::fix_dependencies(const String &p_for_file) {
deps_editor->edit(p_for_file);
}
+void FileSystemDock::update_all() {
+ if (tree->is_visible()) {
+ _update_tree(get_uncollapsed_paths());
+ }
+
+ if (file_list_vb->is_visible()) {
+ _update_file_list(true);
+ }
+}
+
void FileSystemDock::focus_on_path() {
current_path_line_edit->grab_focus();
current_path_line_edit->select_all();
@@ -3241,9 +3234,7 @@ void FileSystemDock::_folder_color_index_pressed(int p_index, PopupMenu *p_menu)
}
_update_folder_colors_setting();
-
- _update_tree(get_uncollapsed_paths());
- _update_file_list(true);
+ update_all();
emit_signal(SNAME("folder_color_changed"));
}
@@ -3951,8 +3942,7 @@ void FileSystemDock::set_file_sort(FileSortOption p_file_sort) {
file_sort = p_file_sort;
// Update everything needed.
- _update_tree(get_uncollapsed_paths());
- _update_file_list(true);
+ update_all();
}
void FileSystemDock::_file_sort_popup(int p_id) {
@@ -4342,7 +4332,6 @@ FileSystemDock::FileSystemDock() {
make_dir_dialog = memnew(DirectoryCreateDialog);
add_child(make_dir_dialog);
- make_dir_dialog->connect("dir_created", callable_mp(this, &FileSystemDock::_directory_created));
make_scene_dialog = memnew(SceneCreateDialog);
add_child(make_scene_dialog);