summaryrefslogtreecommitdiff
path: root/editor/filesystem_dock.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'editor/filesystem_dock.cpp')
-rw-r--r--editor/filesystem_dock.cpp257
1 files changed, 137 insertions, 120 deletions
diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp
index 19b4932d3d..8df5808b11 100644
--- a/editor/filesystem_dock.cpp
+++ b/editor/filesystem_dock.cpp
@@ -42,6 +42,7 @@
#include "editor/editor_resource_preview.h"
#include "editor/editor_scale.h"
#include "editor/editor_settings.h"
+#include "editor/import/resource_importer_scene.h"
#include "editor/import_dock.h"
#include "editor/scene_create_dialog.h"
#include "editor/scene_tree_dock.h"
@@ -106,7 +107,7 @@ bool FileSystemDock::_create_tree(TreeItem *p_parent, EditorFileSystemDirectory
// Create all items for the files in the subdirectory.
if (display_mode == DISPLAY_MODE_TREE_ONLY) {
- String main_scene = ProjectSettings::get_singleton()->get("application/run/main_scene");
+ String main_scene = GLOBAL_GET("application/run/main_scene");
// Build the list of the files to display.
List<FileInfo> file_list;
@@ -218,11 +219,11 @@ void FileSystemDock::_update_tree(const Vector<String> &p_uncollapsed_paths, boo
TreeItem *root = tree->create_item();
// Handles the favorites.
- TreeItem *favorites = tree->create_item(root);
- favorites->set_icon(0, get_theme_icon(SNAME("Favorites"), SNAME("EditorIcons")));
- favorites->set_text(0, TTR("Favorites:"));
- favorites->set_metadata(0, "Favorites");
- favorites->set_collapsed(p_uncollapsed_paths.find("Favorites") < 0);
+ TreeItem *favorites_item = tree->create_item(root);
+ favorites_item->set_icon(0, get_theme_icon(SNAME("Favorites"), SNAME("EditorIcons")));
+ favorites_item->set_text(0, TTR("Favorites:"));
+ favorites_item->set_metadata(0, "Favorites");
+ favorites_item->set_collapsed(p_uncollapsed_paths.find("Favorites") < 0);
Vector<String> favorite_paths = EditorSettings::get_singleton()->get_favorites();
@@ -272,7 +273,7 @@ void FileSystemDock::_update_tree(const Vector<String> &p_uncollapsed_paths, boo
}
if (searched_string.length() == 0 || text.to_lower().find(searched_string) >= 0) {
- TreeItem *ti = tree->create_item(favorites);
+ TreeItem *ti = tree->create_item(favorites_item);
ti->set_text(0, text);
ti->set_icon(0, icon);
ti->set_icon_modulate(0, color);
@@ -383,7 +384,7 @@ void FileSystemDock::_notification(int p_what) {
current_path->connect("text_submitted", callable_mp(this, &FileSystemDock::_navigate_to_path).bind(false));
- always_show_folders = bool(EditorSettings::get_singleton()->get("docks/filesystem/always_show_folders"));
+ always_show_folders = bool(EDITOR_GET("docks/filesystem/always_show_folders"));
set_file_list_display_mode(FileSystemDock::FILE_LIST_DISPLAY_LIST);
@@ -464,7 +465,7 @@ void FileSystemDock::_notification(int p_what) {
file_list_button_sort->set_icon(get_theme_icon(SNAME("Sort"), SNAME("EditorIcons")));
// Update always show folders.
- bool new_always_show_folders = bool(EditorSettings::get_singleton()->get("docks/filesystem/always_show_folders"));
+ bool new_always_show_folders = bool(EDITOR_GET("docks/filesystem/always_show_folders"));
if (new_always_show_folders != always_show_folders) {
always_show_folders = new_always_show_folders;
_update_file_list(true);
@@ -511,7 +512,15 @@ void FileSystemDock::_tree_multi_selected(Object *p_item, int p_column, bool p_s
}
}
-String FileSystemDock::get_selected_path() const {
+Vector<String> FileSystemDock::get_selected_paths() const {
+ return _tree_get_selected(false);
+}
+
+String FileSystemDock::get_current_path() const {
+ return path;
+}
+
+String FileSystemDock::get_current_directory() const {
if (path.ends_with("/")) {
return path;
} else {
@@ -519,10 +528,6 @@ String FileSystemDock::get_selected_path() const {
}
}
-String FileSystemDock::get_current_path() const {
- return path;
-}
-
void FileSystemDock::_set_current_path_text(const String &p_path) {
if (p_path == "Favorites") {
current_path->set_text(TTR("Favorites"));
@@ -743,7 +748,7 @@ void FileSystemDock::_update_file_list(bool p_keep_selection) {
String directory = path;
String file = "";
- int thumbnail_size = EditorSettings::get_singleton()->get("docks/filesystem/thumbnail_size");
+ int thumbnail_size = EDITOR_GET("docks/filesystem/thumbnail_size");
thumbnail_size *= EDSCALE;
Ref<Texture2D> folder_thumbnail;
Ref<Texture2D> file_thumbnail;
@@ -784,9 +789,8 @@ void FileSystemDock::_update_file_list(bool p_keep_selection) {
List<FileInfo> file_list;
if (path == "Favorites") {
// Display the favorites.
- Vector<String> favorites = EditorSettings::get_singleton()->get_favorites();
- for (int i = 0; i < favorites.size(); i++) {
- String favorite = favorites[i];
+ Vector<String> favorites_list = EditorSettings::get_singleton()->get_favorites();
+ for (const String &favorite : favorites_list) {
String text;
Ref<Texture2D> icon;
if (favorite == "res://") {
@@ -894,7 +898,7 @@ void FileSystemDock::_update_file_list(bool p_keep_selection) {
_sort_file_info_list(file_list);
// Fills the ItemList control node from the FileInfos.
- String main_scene = ProjectSettings::get_singleton()->get("application/run/main_scene");
+ String main_scene = GLOBAL_GET("application/run/main_scene");
for (FileInfo &E : file_list) {
FileInfo *finfo = &(E);
String fname = finfo->name;
@@ -1056,15 +1060,15 @@ void FileSystemDock::_select_file(const String &p_path, bool p_select_in_favorit
void FileSystemDock::_tree_activate_file() {
TreeItem *selected = tree->get_selected();
if (selected) {
- String path = selected->get_metadata(0);
+ String file_path = selected->get_metadata(0);
TreeItem *parent = selected->get_parent();
bool is_favorite = parent != nullptr && parent->get_metadata(0) == "Favorites";
- if ((!is_favorite && path.ends_with("/")) || path == "Favorites") {
+ if ((!is_favorite && file_path.ends_with("/")) || file_path == "Favorites") {
bool collapsed = selected->is_collapsed();
selected->set_collapsed(!collapsed);
} else {
- _select_file(path, is_favorite && !path.ends_with("/"));
+ _select_file(file_path, is_favorite && !file_path.ends_with("/"));
}
}
}
@@ -1169,29 +1173,29 @@ void FileSystemDock::_push_to_history() {
button_hist_next->set_disabled(history_pos == history.size() - 1);
}
-void FileSystemDock::_get_all_items_in_dir(EditorFileSystemDirectory *efsd, Vector<String> &files, Vector<String> &folders) const {
- if (efsd == nullptr) {
+void FileSystemDock::_get_all_items_in_dir(EditorFileSystemDirectory *p_efsd, Vector<String> &r_files, Vector<String> &r_folders) const {
+ if (p_efsd == nullptr) {
return;
}
- for (int i = 0; i < efsd->get_subdir_count(); i++) {
- folders.push_back(efsd->get_subdir(i)->get_path());
- _get_all_items_in_dir(efsd->get_subdir(i), files, folders);
+ for (int i = 0; i < p_efsd->get_subdir_count(); i++) {
+ r_folders.push_back(p_efsd->get_subdir(i)->get_path());
+ _get_all_items_in_dir(p_efsd->get_subdir(i), r_files, r_folders);
}
- for (int i = 0; i < efsd->get_file_count(); i++) {
- files.push_back(efsd->get_file_path(i));
+ for (int i = 0; i < p_efsd->get_file_count(); i++) {
+ r_files.push_back(p_efsd->get_file_path(i));
}
}
-void FileSystemDock::_find_remaps(EditorFileSystemDirectory *efsd, const HashMap<String, String> &renames, Vector<String> &to_remaps) const {
- for (int i = 0; i < efsd->get_subdir_count(); i++) {
- _find_remaps(efsd->get_subdir(i), renames, to_remaps);
+void FileSystemDock::_find_remaps(EditorFileSystemDirectory *p_efsd, const HashMap<String, String> &r_renames, Vector<String> &r_to_remaps) const {
+ for (int i = 0; i < p_efsd->get_subdir_count(); i++) {
+ _find_remaps(p_efsd->get_subdir(i), r_renames, r_to_remaps);
}
- for (int i = 0; i < efsd->get_file_count(); i++) {
- Vector<String> deps = efsd->get_file_deps(i);
+ for (int i = 0; i < p_efsd->get_file_count(); i++) {
+ Vector<String> deps = p_efsd->get_file_deps(i);
for (int j = 0; j < deps.size(); j++) {
- if (renames.has(deps[j])) {
- to_remaps.push_back(efsd->get_file_path(i));
+ if (r_renames.has(deps[j])) {
+ r_to_remaps.push_back(p_efsd->get_file_path(i));
break;
}
}
@@ -1284,42 +1288,71 @@ void FileSystemDock::_try_duplicate_item(const FileOrFolder &p_item, const Strin
}
Ref<DirAccess> da = DirAccess::create(DirAccess::ACCESS_RESOURCES);
- print_verbose("Duplicating " + old_path + " -> " + new_path);
- Error err = p_item.is_file ? da->copy(old_path, new_path) : da->copy_dir(old_path, new_path);
- if (err == OK) {
- // Move/Rename any corresponding import settings too.
- if (p_item.is_file && FileAccess::exists(old_path + ".import")) {
- err = da->copy(old_path + ".import", new_path + ".import");
+
+ if (p_item.is_file) {
+ print_verbose("Duplicating " + old_path + " -> " + new_path);
+
+ // Create the directory structure.
+ da->make_dir_recursive(new_path.get_base_dir());
+
+ if (FileAccess::exists(old_path + ".import")) {
+ Error err = da->copy(old_path, new_path);
if (err != OK) {
- EditorNode::get_singleton()->add_io_error(TTR("Error duplicating:") + "\n" + old_path + ".import\n");
+ EditorNode::get_singleton()->add_io_error(TTR("Error duplicating:") + "\n" + old_path + ": " + error_names[err] + "\n");
+ return;
}
// Remove uid from .import file to avoid conflict.
Ref<ConfigFile> cfg;
cfg.instantiate();
- cfg->load(new_path + ".import");
+ cfg->load(old_path + ".import");
cfg->erase_section_key("remap", "uid");
- cfg->save(new_path + ".import");
- } else if (p_item.is_file && (old_path.get_extension() == "tscn" || old_path.get_extension() == "tres")) {
- // FIXME: Quick hack to fix text resources. This should be fixed properly.
- Ref<FileAccess> file = FileAccess::open(old_path, FileAccess::READ, &err);
- if (err == OK) {
- PackedStringArray lines = file->get_as_utf8_string().split("\n");
- String line = lines[0];
-
- if (line.contains("uid")) {
- line = line.substr(0, line.find(" uid")) + "]";
- lines.write[0] = line;
+ err = cfg->save(new_path + ".import");
+ if (err != OK) {
+ EditorNode::get_singleton()->add_io_error(TTR("Error duplicating:") + "\n" + old_path + ".import: " + error_names[err] + "\n");
+ return;
+ }
+ } else {
+ // Files which do not use an uid can just be copied.
+ if (ResourceLoader::get_resource_uid(old_path) == ResourceUID::INVALID_ID) {
+ Error err = da->copy(old_path, new_path);
+ if (err != OK) {
+ EditorNode::get_singleton()->add_io_error(TTR("Error duplicating:") + "\n" + old_path + ": " + error_names[err] + "\n");
+ }
+ return;
+ }
- Ref<FileAccess> file2 = FileAccess::open(new_path, FileAccess::WRITE, &err);
- if (err == OK) {
- file2->store_string(String("\n").join(lines));
- }
+ // Load the resource and save it again in the new location (this generates a new UID).
+ Error err;
+ Ref<Resource> res = ResourceLoader::load(old_path, "", ResourceFormatLoader::CACHE_MODE_REUSE, &err);
+ if (err == OK && res.is_valid()) {
+ err = ResourceSaver::save(res, new_path, ResourceSaver::FLAG_COMPRESS);
+ if (err != OK) {
+ EditorNode::get_singleton()->add_io_error(TTR("Error duplicating:") + " " + vformat(TTR("Failed to save resource at %s: %s"), new_path, error_names[err]));
}
+ } else if (err != OK) {
+ // When loading files like text files the error is OK but the resource is still null.
+ // We can ignore such files.
+ EditorNode::get_singleton()->add_io_error(TTR("Error duplicating:") + " " + vformat(TTR("Failed to load resource at %s: %s"), new_path, error_names[err]));
}
}
} else {
- EditorNode::get_singleton()->add_io_error(TTR("Error duplicating:") + "\n" + old_path + "\n");
+ // Recursively duplicate all files inside the folder.
+ Ref<DirAccess> old_dir = DirAccess::open(old_path);
+ Ref<FileAccess> file_access = FileAccess::create(FileAccess::ACCESS_RESOURCES);
+ old_dir->set_include_navigational(false);
+ old_dir->list_dir_begin();
+ for (String f = old_dir->_get_next(); !f.is_empty(); f = old_dir->_get_next()) {
+ if (f.get_extension() == "import") {
+ continue;
+ }
+ if (file_access->file_exists(old_path + f)) {
+ _try_duplicate_item(FileOrFolder(old_path + f, true), new_path + f);
+ } else if (da->dir_exists(old_path + f)) {
+ _try_duplicate_item(FileOrFolder(old_path + f, false), new_path + f);
+ }
+ }
+ old_dir->list_dir_end();
}
}
@@ -1345,25 +1378,25 @@ void FileSystemDock::_update_resource_paths_after_move(const HashMap<String, Str
}
for (int i = 0; i < EditorNode::get_editor_data().get_edited_scene_count(); i++) {
- String path;
+ String file_path;
if (i == EditorNode::get_editor_data().get_edited_scene()) {
if (!get_tree()->get_edited_scene_root()) {
continue;
}
- path = get_tree()->get_edited_scene_root()->get_scene_file_path();
+ file_path = get_tree()->get_edited_scene_root()->get_scene_file_path();
} else {
- path = EditorNode::get_editor_data().get_scene_path(i);
+ file_path = EditorNode::get_editor_data().get_scene_path(i);
}
- if (p_renames.has(path)) {
- path = p_renames[path];
+ if (p_renames.has(file_path)) {
+ file_path = p_renames[file_path];
}
if (i == EditorNode::get_editor_data().get_edited_scene()) {
- get_tree()->get_edited_scene_root()->set_scene_file_path(path);
+ get_tree()->get_edited_scene_root()->set_scene_file_path(file_path);
} else {
- EditorNode::get_editor_data().set_scene_path(i, path);
+ EditorNode::get_editor_data().set_scene_path(i, file_path);
}
}
}
@@ -1421,11 +1454,10 @@ void FileSystemDock::_update_project_settings_after_move(const HashMap<String, S
}
void FileSystemDock::_update_favorites_list_after_move(const HashMap<String, String> &p_files_renames, const HashMap<String, String> &p_folders_renames) const {
- Vector<String> favorites = EditorSettings::get_singleton()->get_favorites();
+ Vector<String> favorites_list = EditorSettings::get_singleton()->get_favorites();
Vector<String> new_favorites;
- for (int i = 0; i < favorites.size(); i++) {
- String old_path = favorites[i];
+ for (const String &old_path : favorites_list) {
if (p_folders_renames.has(old_path)) {
new_favorites.push_back(p_folders_renames[old_path]);
} else if (p_files_renames.has(old_path)) {
@@ -1699,7 +1731,7 @@ void FileSystemDock::_move_operation_confirm(const String &p_to_path, bool p_ove
}
}
-Vector<String> FileSystemDock::_tree_get_selected(bool remove_self_inclusion) {
+Vector<String> FileSystemDock::_tree_get_selected(bool remove_self_inclusion) const {
// Build a list of selected items with the active one at the first position.
Vector<String> selected_strings;
@@ -1751,22 +1783,7 @@ void FileSystemDock::_tree_rmb_option(int p_option) {
case FOLDER_COLLAPSE_ALL: {
// Expand or collapse the folder
if (selected_strings.size() == 1) {
- bool is_collapsed = (p_option == FOLDER_COLLAPSE_ALL);
-
- Vector<TreeItem *> needs_check;
- needs_check.push_back(tree->get_selected());
-
- while (needs_check.size()) {
- needs_check[0]->set_collapsed(is_collapsed);
-
- TreeItem *child = needs_check[0]->get_first_child();
- while (child) {
- needs_check.push_back(child);
- child = child->get_next();
- }
-
- needs_check.remove_at(0);
- }
+ tree->get_selected()->set_collapsed_recursive(p_option == FOLDER_COLLAPSE_ALL);
}
} break;
default: {
@@ -1835,8 +1852,8 @@ void FileSystemDock::_file_option(int p_option, const Vector<String> &p_selected
}
} break;
- case FILE_INSTANCE: {
- // Instance all selected scenes.
+ case FILE_INSTANTIATE: {
+ // Instantiate all selected scenes.
Vector<String> paths;
for (int i = 0; i < p_selected.size(); i++) {
String fpath = p_selected[i];
@@ -1845,29 +1862,29 @@ void FileSystemDock::_file_option(int p_option, const Vector<String> &p_selected
}
}
if (!paths.is_empty()) {
- emit_signal(SNAME("instance"), paths);
+ emit_signal(SNAME("instantiate"), paths);
}
} break;
case FILE_ADD_FAVORITE: {
// Add the files from favorites.
- Vector<String> favorites = EditorSettings::get_singleton()->get_favorites();
+ Vector<String> favorites_list = EditorSettings::get_singleton()->get_favorites();
for (int i = 0; i < p_selected.size(); i++) {
- if (!favorites.has(p_selected[i])) {
- favorites.push_back(p_selected[i]);
+ if (!favorites_list.has(p_selected[i])) {
+ favorites_list.push_back(p_selected[i]);
}
}
- EditorSettings::get_singleton()->set_favorites(favorites);
+ EditorSettings::get_singleton()->set_favorites(favorites_list);
_update_tree(_compute_uncollapsed_paths());
} break;
case FILE_REMOVE_FAVORITE: {
// Remove the files from favorites.
- Vector<String> favorites = EditorSettings::get_singleton()->get_favorites();
+ Vector<String> favorites_list = EditorSettings::get_singleton()->get_favorites();
for (int i = 0; i < p_selected.size(); i++) {
- favorites.erase(p_selected[i]);
+ favorites_list.erase(p_selected[i]);
}
- EditorSettings::get_singleton()->set_favorites(favorites);
+ EditorSettings::get_singleton()->set_favorites(favorites_list);
_update_tree(_compute_uncollapsed_paths());
if (path == "Favorites") {
_update_file_list(true);
@@ -2060,7 +2077,7 @@ void FileSystemDock::_resource_created() {
return;
}
- Variant c = new_resource_dialog->instance_selected();
+ Variant c = new_resource_dialog->instantiate_selected();
ERR_FAIL_COND(!c);
Resource *r = Object::cast_to<Resource>(c);
@@ -2289,7 +2306,7 @@ void FileSystemDock::drop_data_fw(const Point2 &p_point, const Variant &p_data,
int drop_section = tree->get_drop_section_at_position(p_point);
int drop_position;
- Vector<String> files = drag_data["files"];
+ Vector<String> drag_files = drag_data["files"];
TreeItem *favorites_item = tree->get_root()->get_first_child();
TreeItem *resources_item = favorites_item->get_next();
@@ -2310,8 +2327,8 @@ void FileSystemDock::drop_data_fw(const Point2 &p_point, const Variant &p_data,
// Remove dragged favorites.
Vector<int> to_remove;
int offset = 0;
- for (int i = 0; i < files.size(); i++) {
- int to_remove_pos = dirs.find(files[i]);
+ for (int i = 0; i < drag_files.size(); i++) {
+ int to_remove_pos = dirs.find(drag_files[i]);
to_remove.push_back(to_remove_pos);
if (to_remove_pos < drop_position) {
offset++;
@@ -2324,8 +2341,8 @@ void FileSystemDock::drop_data_fw(const Point2 &p_point, const Variant &p_data,
}
// Re-add them at the right position.
- for (int i = 0; i < files.size(); i++) {
- dirs.insert(drop_position, files[i]);
+ for (int i = 0; i < drag_files.size(); i++) {
+ dirs.insert(drop_position, drag_files[i]);
drop_position++;
}
@@ -2394,13 +2411,13 @@ void FileSystemDock::drop_data_fw(const Point2 &p_point, const Variant &p_data,
} else if (favorite) {
// Add the files from favorites.
Vector<String> fnames = drag_data["files"];
- Vector<String> favorites = EditorSettings::get_singleton()->get_favorites();
+ Vector<String> favorites_list = EditorSettings::get_singleton()->get_favorites();
for (int i = 0; i < fnames.size(); i++) {
- if (!favorites.has(fnames[i])) {
- favorites.push_back(fnames[i]);
+ if (!favorites_list.has(fnames[i])) {
+ favorites_list.push_back(fnames[i]);
}
}
- EditorSettings::get_singleton()->set_favorites(favorites);
+ EditorSettings::get_singleton()->set_favorites(favorites_list);
_update_tree(_compute_uncollapsed_paths());
}
}
@@ -2478,7 +2495,7 @@ void FileSystemDock::_file_and_folders_fill_popup(PopupMenu *p_popup, Vector<Str
Vector<String> filenames;
Vector<String> foldernames;
- Vector<String> favorites = EditorSettings::get_singleton()->get_favorites();
+ Vector<String> favorites_list = EditorSettings::get_singleton()->get_favorites();
bool all_files = true;
bool all_files_scenes = true;
@@ -2499,8 +2516,8 @@ void FileSystemDock::_file_and_folders_fill_popup(PopupMenu *p_popup, Vector<Str
// Check if in favorites.
bool found = false;
- for (int j = 0; j < favorites.size(); j++) {
- if (favorites[j] == fpath) {
+ for (int j = 0; j < favorites_list.size(); j++) {
+ if (favorites_list[j] == fpath) {
found = true;
break;
}
@@ -2517,13 +2534,13 @@ void FileSystemDock::_file_and_folders_fill_popup(PopupMenu *p_popup, Vector<Str
if (filenames.size() == 1) {
p_popup->add_icon_item(get_theme_icon(SNAME("Load"), SNAME("EditorIcons")), TTR("Open Scene"), FILE_OPEN);
p_popup->add_icon_item(get_theme_icon(SNAME("CreateNewSceneFrom"), SNAME("EditorIcons")), TTR("New Inherited Scene"), FILE_INHERIT);
- if (ProjectSettings::get_singleton()->get("application/run/main_scene") != filenames[0]) {
+ if (GLOBAL_GET("application/run/main_scene") != filenames[0]) {
p_popup->add_icon_item(get_theme_icon(SNAME("PlayScene"), SNAME("EditorIcons")), TTR("Set As Main Scene"), FILE_MAIN_SCENE);
}
} else {
p_popup->add_icon_item(get_theme_icon(SNAME("Load"), SNAME("EditorIcons")), TTR("Open Scenes"), FILE_OPEN);
}
- p_popup->add_icon_item(get_theme_icon(SNAME("Instance"), SNAME("EditorIcons")), TTR("Instance"), FILE_INSTANCE);
+ p_popup->add_icon_item(get_theme_icon(SNAME("Instance"), SNAME("EditorIcons")), TTR("Instantiate"), FILE_INSTANTIATE);
p_popup->add_separator();
} else if (filenames.size() == 1) {
p_popup->add_icon_item(get_theme_icon(SNAME("Load"), SNAME("EditorIcons")), TTR("Open"), FILE_OPEN);
@@ -2867,10 +2884,10 @@ void FileSystemDock::_file_list_gui_input(Ref<InputEvent> p_event) {
}
}
-void FileSystemDock::_get_imported_files(const String &p_path, Vector<String> &files) const {
+void FileSystemDock::_get_imported_files(const String &p_path, Vector<String> &r_files) const {
if (!p_path.ends_with("/")) {
if (FileAccess::exists(p_path + ".import")) {
- files.push_back(p_path);
+ r_files.push_back(p_path);
}
return;
}
@@ -2881,7 +2898,7 @@ void FileSystemDock::_get_imported_files(const String &p_path, Vector<String> &f
while (!n.is_empty()) {
if (n != "." && n != ".." && !n.ends_with(".import")) {
String npath = p_path + n + (da->current_is_dir() ? "/" : "");
- _get_imported_files(npath, files);
+ _get_imported_files(npath, r_files);
}
n = da->get_next();
}
@@ -2977,7 +2994,7 @@ void FileSystemDock::_file_sort_popup(int p_id) {
MenuButton *FileSystemDock::_create_file_menu_button() {
MenuButton *button = memnew(MenuButton);
button->set_flat(true);
- button->set_tooltip_text(TTR("Sort files"));
+ button->set_tooltip_text(TTR("Sort Files"));
PopupMenu *p = button->get_popup();
p->connect("id_pressed", callable_mp(this, &FileSystemDock::_file_sort_popup));
@@ -3006,12 +3023,12 @@ void FileSystemDock::_bind_methods() {
ClassDB::bind_method(D_METHOD("_update_import_dock"), &FileSystemDock::_update_import_dock);
ADD_SIGNAL(MethodInfo("inherit", PropertyInfo(Variant::STRING, "file")));
- ADD_SIGNAL(MethodInfo("instance", PropertyInfo(Variant::PACKED_STRING_ARRAY, "files")));
+ ADD_SIGNAL(MethodInfo("instantiate", PropertyInfo(Variant::PACKED_STRING_ARRAY, "files")));
ADD_SIGNAL(MethodInfo("file_removed", PropertyInfo(Variant::STRING, "file")));
ADD_SIGNAL(MethodInfo("folder_removed", PropertyInfo(Variant::STRING, "folder")));
ADD_SIGNAL(MethodInfo("files_moved", PropertyInfo(Variant::STRING, "old_file"), PropertyInfo(Variant::STRING, "new_file")));
- ADD_SIGNAL(MethodInfo("folder_moved", PropertyInfo(Variant::STRING, "old_folder"), PropertyInfo(Variant::STRING, "new_file")));
+ ADD_SIGNAL(MethodInfo("folder_moved", PropertyInfo(Variant::STRING, "old_folder"), PropertyInfo(Variant::STRING, "new_folder")));
ADD_SIGNAL(MethodInfo("display_mode_changed"));
}
@@ -3040,14 +3057,14 @@ FileSystemDock::FileSystemDock() {
button_hist_prev->set_flat(true);
button_hist_prev->set_disabled(true);
button_hist_prev->set_focus_mode(FOCUS_NONE);
- button_hist_prev->set_tooltip_text(TTR("Previous Folder/File"));
+ button_hist_prev->set_tooltip_text(TTR("Go to previous selected folder/file."));
toolbar_hbc->add_child(button_hist_prev);
button_hist_next = memnew(Button);
button_hist_next->set_flat(true);
button_hist_next->set_disabled(true);
button_hist_next->set_focus_mode(FOCUS_NONE);
- button_hist_next->set_tooltip_text(TTR("Next Folder/File"));
+ button_hist_next->set_tooltip_text(TTR("Go to next selected folder/file."));
toolbar_hbc->add_child(button_hist_next);
current_path = memnew(LineEdit);