If a resource is delete from fs dialog, but the resource is currently loaded,
clear the path of the resource. Fixes #5110
This commit is contained in:
parent
94a6ff3d7a
commit
f4ff30dff0
|
@ -399,6 +399,7 @@ void DependencyRemoveDialog::show(const Vector<String> &to_erase) {
|
||||||
|
|
||||||
_fill_owners(EditorFileSystem::get_singleton()->get_filesystem());
|
_fill_owners(EditorFileSystem::get_singleton()->get_filesystem());
|
||||||
|
|
||||||
|
|
||||||
if (exist) {
|
if (exist) {
|
||||||
owners->show();
|
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)"));
|
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);
|
DirAccess *da = DirAccess::create(DirAccess::ACCESS_RESOURCES);
|
||||||
for (Map<String,TreeItem*>::Element *E=files.front();E;E=E->next()) {
|
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());
|
da->remove(E->key());
|
||||||
EditorFileSystem::get_singleton()->update_file(E->key());
|
EditorFileSystem::get_singleton()->update_file(E->key());
|
||||||
}
|
}
|
||||||
|
|
|
@ -1052,6 +1052,7 @@ void ScenesDock::_file_option(int p_option) {
|
||||||
if (path.ends_with("/") || !files->is_selected(i))
|
if (path.ends_with("/") || !files->is_selected(i))
|
||||||
continue;
|
continue;
|
||||||
torem.push_back(path);
|
torem.push_back(path);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (torem.empty()) {
|
if (torem.empty()) {
|
||||||
|
|
Loading…
Reference in New Issue