summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2016-06-09 21:43:28 -0300
committerJuan Linietsky <reduzio@gmail.com>2016-06-09 21:43:28 -0300
commitf4ff30dff0468880c6b36c347e83ebacb9db2d5e (patch)
tree52632980a500e2e555cbb8fcb23e7580daca294d
parent94a6ff3d7a2ff770e32a68ac76771639e5a22665 (diff)
If a resource is delete from fs dialog, but the resource is currently loaded,
clear the path of the resource. Fixes #5110
-rw-r--r--tools/editor/dependency_editor.cpp5
-rw-r--r--tools/editor/scenes_dock.cpp1
2 files changed, 6 insertions, 0 deletions
diff --git a/tools/editor/dependency_editor.cpp b/tools/editor/dependency_editor.cpp
index a702d3c687..6ad7704815 100644
--- a/tools/editor/dependency_editor.cpp
+++ b/tools/editor/dependency_editor.cpp
@@ -399,6 +399,7 @@ void DependencyRemoveDialog::show(const Vector<String> &to_erase) {
_fill_owners(EditorFileSystem::get_singleton()->get_filesystem());
+
if (exist) {
owners->show();
text->set_text(TTR("The files being removed are required by other resources in order for them to work.\nRemove them anyway? (no undo)"));
@@ -417,6 +418,10 @@ void DependencyRemoveDialog::ok_pressed() {
DirAccess *da = DirAccess::create(DirAccess::ACCESS_RESOURCES);
for (Map<String,TreeItem*>::Element *E=files.front();E;E=E->next()) {
+ if (ResourceCache::has(E->key())) {
+ Resource *res = ResourceCache::get(E->key());
+ res->set_path(""); //clear reference to path
+ }
da->remove(E->key());
EditorFileSystem::get_singleton()->update_file(E->key());
}
diff --git a/tools/editor/scenes_dock.cpp b/tools/editor/scenes_dock.cpp
index 7c61e3d4a1..7953cf2739 100644
--- a/tools/editor/scenes_dock.cpp
+++ b/tools/editor/scenes_dock.cpp
@@ -1052,6 +1052,7 @@ void ScenesDock::_file_option(int p_option) {
if (path.ends_with("/") || !files->is_selected(i))
continue;
torem.push_back(path);
+
}
if (torem.empty()) {