summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
Diffstat (limited to 'editor')
-rw-r--r--editor/dependency_editor.cpp63
-rw-r--r--editor/dependency_editor.h3
-rw-r--r--editor/editor_file_dialog.cpp1
-rw-r--r--editor/editor_node.cpp2
-rw-r--r--editor/find_in_files.cpp11
5 files changed, 49 insertions, 31 deletions
diff --git a/editor/dependency_editor.cpp b/editor/dependency_editor.cpp
index 19fd297f69..953d787322 100644
--- a/editor/dependency_editor.cpp
+++ b/editor/dependency_editor.cpp
@@ -472,17 +472,18 @@ void DependencyRemoveDialog::_build_removed_dependency_tree(const Vector<Removed
void DependencyRemoveDialog::show(const Vector<String> &p_folders, const Vector<String> &p_files) {
all_remove_files.clear();
- to_delete.clear();
+ dirs_to_delete.clear();
+ files_to_delete.clear();
owners->clear();
for (int i = 0; i < p_folders.size(); ++i) {
String folder = p_folders[i].ends_with("/") ? p_folders[i] : (p_folders[i] + "/");
_find_files_in_removed_folder(EditorFileSystem::get_singleton()->get_filesystem_path(folder), folder);
- to_delete.push_back(folder);
+ dirs_to_delete.push_back(folder);
}
for (int i = 0; i < p_files.size(); ++i) {
all_remove_files[p_files[i]] = String();
- to_delete.push_back(p_files[i]);
+ files_to_delete.push_back(p_files[i]);
}
Vector<RemovedDependency> removed_deps;
@@ -502,29 +503,49 @@ void DependencyRemoveDialog::show(const Vector<String> &p_folders, const Vector<
}
void DependencyRemoveDialog::ok_pressed() {
- bool files_only = true;
- for (int i = 0; i < to_delete.size(); ++i) {
- if (to_delete[i].ends_with("/")) {
- files_only = false;
- } else if (ResourceCache::has(to_delete[i])) {
- Resource *res = ResourceCache::get(to_delete[i]);
- res->set_path(""); //clear reference to path
+
+ if (dirs_to_delete.size() == 0) {
+ //If we only deleted files we should only need to tell the file system about the files we touched.
+ for (int i = 0; i < files_to_delete.size(); ++i)
+ EditorFileSystem::get_singleton()->update_file(files_to_delete[i]);
+ } else {
+
+ for (int i = 0; i < files_to_delete.size(); ++i) {
+ if (ResourceCache::has(files_to_delete[i])) {
+ Resource *res = ResourceCache::get(files_to_delete[i]);
+ res->set_path("");
+ }
+ String path = OS::get_singleton()->get_resource_dir() + files_to_delete[i].replace_first("res://", "/");
+ print_line("Moving to trash: " + path);
+ Error err = OS::get_singleton()->move_to_trash(path);
+ if (err != OK) {
+ EditorNode::get_singleton()->add_io_error(TTR("Cannot remove:") + "\n" + files_to_delete[i] + "\n");
+ }
}
- String path = OS::get_singleton()->get_resource_dir() + to_delete[i].replace_first("res://", "/");
- print_line("Moving to trash: " + path);
- Error err = OS::get_singleton()->move_to_trash(path);
- if (err != OK) {
- EditorNode::get_singleton()->add_io_error(TTR("Cannot remove:") + "\n" + to_delete[i] + "\n");
+ for (int i = 0; i < dirs_to_delete.size(); ++i) {
+ String path = OS::get_singleton()->get_resource_dir() + dirs_to_delete[i].replace_first("res://", "/");
+ print_line("Moving to trash: " + path);
+ Error err = OS::get_singleton()->move_to_trash(path);
+ if (err != OK) {
+ EditorNode::get_singleton()->add_io_error(TTR("Cannot remove:") + "\n" + dirs_to_delete[i] + "\n");
+ }
}
- }
- if (files_only) {
- //If we only deleted files we should only need to tell the file system about the files we touched.
- for (int i = 0; i < to_delete.size(); ++i) {
- EditorFileSystem::get_singleton()->update_file(to_delete[i]);
+ // if some dirs would be deleted, favorite dirs need to be updated
+ Vector<String> previous_favorite_dirs = EditorSettings::get_singleton()->get_favorite_dirs();
+ Vector<String> new_favorite_dirs;
+
+ for (int i = 0; i < previous_favorite_dirs.size(); ++i) {
+ if (dirs_to_delete.find(previous_favorite_dirs[i] + "/") < 0) {
+ new_favorite_dirs.push_back(previous_favorite_dirs[i]);
+ }
}
- } else {
+
+ if (new_favorite_dirs.size() < previous_favorite_dirs.size()) {
+ EditorSettings::get_singleton()->set_favorite_dirs(new_favorite_dirs);
+ }
+
EditorFileSystem::get_singleton()->scan_changes();
}
}
diff --git a/editor/dependency_editor.h b/editor/dependency_editor.h
index 16135c352b..4f268de748 100644
--- a/editor/dependency_editor.h
+++ b/editor/dependency_editor.h
@@ -102,7 +102,8 @@ class DependencyRemoveDialog : public ConfirmationDialog {
Tree *owners;
Map<String, String> all_remove_files;
- Vector<String> to_delete;
+ Vector<String> dirs_to_delete;
+ Vector<String> files_to_delete;
struct RemovedDependency {
String file;
diff --git a/editor/editor_file_dialog.cpp b/editor/editor_file_dialog.cpp
index 4ae6e9a4f4..8a8a21543b 100644
--- a/editor/editor_file_dialog.cpp
+++ b/editor/editor_file_dialog.cpp
@@ -1027,6 +1027,7 @@ void EditorFileDialog::invalidate() {
if (is_visible_in_tree()) {
update_file_list();
+ _update_favorites();
invalidated = false;
} else {
invalidated = true;
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index f68f8380fd..d8c85df83d 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -4886,7 +4886,7 @@ EditorNode::EditorNode() {
if (!OS::get_singleton()->has_touchscreen_ui_hint() && Input::get_singleton()) {
//only if no touchscreen ui hint, set emulation
- id->set_emulate_touch(false); //just disable just in case
+ id->set_emulate_touch_from_mouse(false); //just disable just in case
}
id->set_custom_mouse_cursor(RES());
}
diff --git a/editor/find_in_files.cpp b/editor/find_in_files.cpp
index 9442bbc0e8..74ea46838b 100644
--- a/editor/find_in_files.cpp
+++ b/editor/find_in_files.cpp
@@ -154,9 +154,7 @@ void FindInFiles::_iterate() {
PoolStringArray sub_dirs;
_scan_dir(_root_prefix + _current_dir, sub_dirs);
- if (sub_dirs.size() != 0) {
- _folders_stack.push_back(sub_dirs);
- }
+ _folders_stack.push_back(sub_dirs);
} else {
// Go back one level
@@ -176,7 +174,7 @@ void FindInFiles::_iterate() {
String fpath = _files_to_scan[_files_to_scan.size() - 1];
pop_back(_files_to_scan);
- _scan_file(_root_prefix + fpath);
+ _scan_file(fpath);
} else {
print_line("Search complete");
@@ -202,8 +200,6 @@ void FindInFiles::_scan_dir(String path, PoolStringArray &out_folders) {
return;
}
- //print_line(String("Scanning ") + path);
-
dir->list_dir_begin();
for (int i = 0; i < 1000; ++i) {
@@ -222,7 +218,7 @@ void FindInFiles::_scan_dir(String path, PoolStringArray &out_folders) {
else {
String file_ext = file.get_extension();
if (_extension_filter.has(file_ext)) {
- _files_to_scan.push_back(file);
+ _files_to_scan.push_back(path.plus_file(file));
}
}
}
@@ -232,7 +228,6 @@ void FindInFiles::_scan_file(String fpath) {
FileAccess *f = FileAccess::open(fpath, FileAccess::READ);
if (f == NULL) {
- f->close();
print_line(String("Cannot open file ") + fpath);
return;
}