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:
authorBastien Montagne <montagne29@wanadoo.fr>2016-02-22 14:09:36 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2016-02-22 14:16:29 +0300
commit20104beea7d3bbcc32108fae935270503c251e54 (patch)
treee5f1ac293a7a44ec54f44af86e274c07f3de6015 /source/blender/blenkernel/intern
parent9cfc203749c3a2534d0b71fccf645eb4406ef228 (diff)
Fix T47482: take II, restore 2.76 behavior regarding groups when deleting an object.
Also re-reported through IRC by Thomas Beck (@plasmasolutions), thanks. Though it's not ideal in theory, we have quite poor handling of object datablock currently from user PoV - before this commit, it was not easily possible to get fully rid of an object anymore if you did not removed it from all its groups before deleting it. So for now, restore 2.76 behavior (namely, unlink an object from avaerything in Blender once it is no more used by any scene). Better handling of all this is TODO for later (also related to much more heavy changes done in id-remap branch regarding sanitizing our ID deletion process).
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r--source/blender/blenkernel/intern/library.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c
index c06f776f6d0..c04eda00904 100644
--- a/source/blender/blenkernel/intern/library.c
+++ b/source/blender/blenkernel/intern/library.c
@@ -183,7 +183,7 @@ void id_us_ensure_real(ID *id)
}
/* Unused currently... */
-static void UNUSED_FUNCTION(id_us_clear_real)(ID *id)
+void id_us_clear_real(ID *id)
{
if (id && (id->tag & LIB_TAG_EXTRAUSER)) {
if (id->tag & LIB_TAG_EXTRAUSER_SET) {
@@ -1298,6 +1298,16 @@ void BKE_libblock_free_us(Main *bmain, void *idv) /* test users */
id_us_min(id);
+ /* XXX This is a temp (2.77) hack so that we keep same behavior as in 2.76 regarding groups when deleting an object.
+ * Since only 'user_one' usage of objects is groups, and only 'real user' usage of objects is scenes,
+ * removing that 'user_one' tag when there is no more real (scene) users of an object ensures it gets
+ * fully unlinked.
+ * Otherwise, there is no real way to get rid of an object anymore - better handling of this is TODO.
+ */
+ if ((GS(id->name) == ID_OB) && (id->us == 1)) {
+ id_us_clear_real(id);
+ }
+
if (id->us == 0) {
switch (GS(id->name)) {
case ID_OB: