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.cpp35
1 files changed, 33 insertions, 2 deletions
diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp
index 194a131095..e57217bb11 100644
--- a/editor/filesystem_dock.cpp
+++ b/editor/filesystem_dock.cpp
@@ -451,9 +451,11 @@ void FileSystemDock::_navigate_to_path(const String &p_path, bool p_select_in_fa
} else if (dirAccess->dir_exists(p_path)) {
path = target_path + "/";
} else {
+ memdelete(dirAccess);
ERR_EXPLAIN(vformat(TTR("Cannot navigate to '%s' as it has not been found in the file system!"), p_path));
ERR_FAIL();
}
+ memdelete(dirAccess);
}
_set_current_path_text(path);
@@ -1201,6 +1203,21 @@ void FileSystemDock::_update_favorites_list_after_move(const Map<String, String>
EditorSettings::get_singleton()->set_favorites(new_favorites);
}
+void FileSystemDock::_save_scenes_after_move(const Map<String, String> &p_renames) const {
+ Vector<String> remaps;
+ _find_remaps(EditorFileSystem::get_singleton()->get_filesystem(), p_renames, remaps);
+ Vector<String> new_filenames;
+
+ for (int i = 0; i < remaps.size(); ++i) {
+ String file = p_renames.has(remaps[i]) ? p_renames[remaps[i]] : remaps[i];
+ if (ResourceLoader::get_resource_type(file) == "PackedScene") {
+ new_filenames.push_back(file);
+ }
+ }
+
+ editor->save_scene_list(new_filenames);
+}
+
void FileSystemDock::_make_dir_confirm() {
String dir_name = make_dir_dialog_text->get_text().strip_edges();
@@ -1279,14 +1296,21 @@ void FileSystemDock::_rename_operation_confirm() {
Map<String, String> file_renames;
Map<String, String> folder_renames;
_try_move_item(to_rename, new_path, file_renames, folder_renames);
+
+ int current_tab = editor->get_current_tab();
+
_update_dependencies_after_move(file_renames);
_update_resource_paths_after_move(file_renames);
_update_project_settings_after_move(file_renames);
_update_favorites_list_after_move(file_renames, folder_renames);
- //Rescan everything
+ editor->set_current_tab(current_tab);
+
print_verbose("FileSystem: calling rescan.");
_rescan();
+
+ print_verbose("FileSystem: saving moved scenes.");
+ _save_scenes_after_move(file_renames);
}
void FileSystemDock::_duplicate_operation_confirm() {
@@ -1382,13 +1406,20 @@ void FileSystemDock::_move_operation_confirm(const String &p_to_path, bool overw
}
if (is_moved) {
+ int current_tab = editor->get_current_tab();
+
_update_dependencies_after_move(file_renames);
_update_resource_paths_after_move(file_renames);
_update_project_settings_after_move(file_renames);
_update_favorites_list_after_move(file_renames, folder_renames);
+ editor->set_current_tab(current_tab);
+
print_verbose("FileSystem: calling rescan.");
_rescan();
+
+ print_verbose("FileSystem: saving moved scenes.");
+ _save_scenes_after_move(file_renames);
}
}
@@ -2038,7 +2069,7 @@ void FileSystemDock::_get_drag_target_folder(String &target, bool &target_favori
void FileSystemDock::_file_and_folders_fill_popup(PopupMenu *p_popup, Vector<String> p_paths, bool p_display_path_dependent_options) {
// Add options for files and folders
- ERR_FAIL_COND(p_paths.empty())
+ ERR_FAIL_COND(p_paths.empty());
Vector<String> filenames;
Vector<String> foldernames;