diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2017-01-04 12:25:27 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2017-01-04 12:28:59 +0300 |
commit | 351a9d084f59a6d11be9148830cec86eacb85529 (patch) | |
tree | 4e971000a84cb0685a082faebbb9afc6e30b0d4c /source/blender/editors/space_outliner | |
parent | c0c48cdacc13742e804b19abb7b9b2049fb1bcbd (diff) |
Fix T50369: Objects can't be deleted from scene when using "link group objects to scene"
Main issue here was that in old usercount system 'user_real' did simply
not allow that kind of thing to work. With new pait of 'USER_EXTRA'
tags, it becomes possible to handle the case correctly, by merely refining
checks about indirectly use objects whene removing them from a scene.
Incidently, found another related bug, 'link group objects to scene' was not
incrementing objects' usercount - bad, very very bad!
Diffstat (limited to 'source/blender/editors/space_outliner')
-rw-r--r-- | source/blender/editors/space_outliner/outliner_tools.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/source/blender/editors/space_outliner/outliner_tools.c b/source/blender/editors/space_outliner/outliner_tools.c index 7739d241bd3..4eda7977622 100644 --- a/source/blender/editors/space_outliner/outliner_tools.c +++ b/source/blender/editors/space_outliner/outliner_tools.c @@ -411,7 +411,9 @@ static void object_delete_cb( BKE_reportf(reports, RPT_WARNING, "Cannot delete indirectly linked object '%s'", base->object->id.name + 2); return; } - else if (BKE_library_ID_is_indirectly_used(bmain, base->object) && ID_REAL_USERS(base->object) <= 1) { + else if (BKE_library_ID_is_indirectly_used(bmain, base->object) && + ID_REAL_USERS(base->object) <= 1 && ID_EXTRA_USERS(base->object) == 0) + { BKE_reportf(reports, RPT_WARNING, "Cannot delete object '%s' from scene '%s', indirectly used objects need at least one user", base->object->id.name + 2, scene->id.name + 2); @@ -525,7 +527,7 @@ static void group_linkobs2scene_cb( if (!base) { /* link to scene */ base = BKE_scene_base_add(scene, gob->ob); - id_lib_extern((ID *)gob->ob); /* in case these are from a linked group */ + id_us_plus(&gob->ob->id); } base->object->flag |= SELECT; base->flag |= SELECT; @@ -842,7 +844,9 @@ static Base *outline_delete_hierarchy(bContext *C, ReportList *reports, Scene *s BKE_reportf(reports, RPT_WARNING, "Cannot delete indirectly linked object '%s'", base->object->id.name + 2); return base_next; } - else if (BKE_library_ID_is_indirectly_used(bmain, base->object) && ID_REAL_USERS(base->object) <= 1) { + else if (BKE_library_ID_is_indirectly_used(bmain, base->object) && + ID_REAL_USERS(base->object) <= 1 && ID_EXTRA_USERS(base->object) == 0) + { BKE_reportf(reports, RPT_WARNING, "Cannot delete object '%s' from scene '%s', indirectly used objects need at least one user", base->object->id.name + 2, scene->id.name + 2); |