Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacques Lucke <jacques@blender.org>2021-01-08 18:30:44 +0300
committerJacques Lucke <jacques@blender.org>2021-01-08 18:39:42 +0300
commitbc788929aa2bd259670a5562a1f403f25cad4625 (patch)
treee8aa0b6746a5bffa2c97b8cb42a817659b20fff9 /source/blender/makesrna/intern/rna_main_api.c
parent2d3f96cace6d63dbf15544dbe8a9a4fa912f6d6d (diff)
Scenes: forbid deleting last local scene
Previously, it was only forbidden to delete the last scene. This can lead to the situation where a .blend file only contains linked scenes. This is problematic, because linked data might not always be available or can be removed from a .blend file without having an additional check for remaining scenes. Now there always has to be at least one local scene. Reviewers: mont29 Differential Revision: https://developer.blender.org/D10049
Diffstat (limited to 'source/blender/makesrna/intern/rna_main_api.c')
-rw-r--r--source/blender/makesrna/intern/rna_main_api.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/source/blender/makesrna/intern/rna_main_api.c b/source/blender/makesrna/intern/rna_main_api.c
index 5170d598ab5..d24be91f731 100644
--- a/source/blender/makesrna/intern/rna_main_api.c
+++ b/source/blender/makesrna/intern/rna_main_api.c
@@ -194,9 +194,9 @@ static void rna_Main_scenes_remove(
{
/* don't call BKE_id_free(...) directly */
Scene *scene = scene_ptr->data;
- Scene *scene_new;
- if ((scene_new = scene->id.prev) || (scene_new = scene->id.next)) {
+ if (BKE_scene_can_be_removed(bmain, scene)) {
+ Scene *scene_new = scene->id.prev ? scene->id.prev : scene->id.next;
if (do_unlink) {
wmWindow *win = CTX_wm_window(C);
@@ -216,8 +216,10 @@ static void rna_Main_scenes_remove(
rna_Main_ID_remove(bmain, reports, scene_ptr, do_unlink, true, true);
}
else {
- BKE_reportf(
- reports, RPT_ERROR, "Scene '%s' is the last, cannot be removed", scene->id.name + 2);
+ BKE_reportf(reports,
+ RPT_ERROR,
+ "Scene '%s' is the last local one, cannot be removed",
+ scene->id.name + 2);
}
}