Fix #147759: Do not delete a library if it contains the active scene.
Supporting this is fairly involved (see #147759 comments and !147827), so for 5.0 and active LTSs releases, best is to not delete a library if it contains the active scene. Pull Request: https://projects.blender.org/blender/blender/pulls/147831
This commit is contained in:
@@ -498,9 +498,19 @@ static void id_delete_tag(bContext *C, ReportList *reports, TreeElement *te, Tre
|
||||
}
|
||||
}
|
||||
|
||||
if (te->idcode == ID_LI && ((Library *)id)->runtime->parent != nullptr) {
|
||||
BKE_reportf(reports, RPT_WARNING, "Cannot delete indirectly linked library '%s'", id->name);
|
||||
return;
|
||||
if (te->idcode == ID_LI) {
|
||||
Library *lib = blender::id_cast<Library *>(id);
|
||||
if (lib->runtime->parent != nullptr) {
|
||||
BKE_reportf(reports, RPT_WARNING, "Cannot delete indirectly linked library '%s'", id->name);
|
||||
return;
|
||||
}
|
||||
if (CTX_data_scene(C)->id.lib == lib) {
|
||||
BKE_reportf(reports,
|
||||
RPT_WARNING,
|
||||
"Cannot delete library '%s', as it contains the currently active Scene",
|
||||
id->name);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (id->tag & ID_TAG_INDIRECT) {
|
||||
BKE_reportf(reports, RPT_WARNING, "Cannot delete indirectly linked id '%s'", id->name);
|
||||
|
||||
Reference in New Issue
Block a user