Commit: 91ffd39e77498b81634750527aa5069c950a4d59 Author: Bastien Montagne Date: Mon Mar 18 16:48:31 2019 +0100 Branches: master https://developer.blender.org/rB91ffd39e77498b81634750527aa5069c950a4d59
Fix T62706: Orphan Data : I have now to save a file, close and reopen it, only then I can purge previous deleted meshes. libquery code has some specific handling for IDs tagged as 'no_main', among which to never consider them as refcounted/refcounting other IDs. This is fine, but it also means we have to be careful when moving an ID from main to out-of-main status, to do all id remapping we need //before// we tag it as no_main. That was a bit tedious to track down, we'll have to be careful that all the corner cases we have to take care of, do not end up in a giant soup of expections to exceptions, where nobody can find its way anymore... =================================================================== M source/blender/blenkernel/intern/library_remap.c =================================================================== diff --git a/source/blender/blenkernel/intern/library_remap.c b/source/blender/blenkernel/intern/library_remap.c index 04ccdc729da..d4e30bc07e9 100644 --- a/source/blender/blenkernel/intern/library_remap.c +++ b/source/blender/blenkernel/intern/library_remap.c @@ -1001,7 +1001,9 @@ static void id_delete(Main *bmain, const bool do_tagged_deletion) if ((id->tag & tag) || (id->lib != NULL && (id->lib->id.tag & tag))) { BLI_remlink(lb, id); BLI_addtail(&tagged_deleted_ids, id); - id->tag |= tag | LIB_TAG_NO_MAIN; + /* Do not tag as no_main now, we want to unlink it first (lower-level ID management code + * has some specific handling of 'nom main' IDs that would be a problem in that case). */ + id->tag |= tag; keep_looping = true; } } @@ -1021,6 +1023,8 @@ static void id_delete(Main *bmain, const bool do_tagged_deletion) ID_REMAP_FLAG_NEVER_NULL_USAGE | ID_REMAP_FORCE_NEVER_NULL_USAGE); /* Since we removed ID from Main, we also need to unlink its own other IDs usages ourself. */ BKE_libblock_relink_ex(bmain, id, NULL, NULL, true); + /* Now we can safely mark that ID as not being in Main database anymore. */ + id->tag |= LIB_TAG_NO_MAIN; /* This is needed because we may not have remapped usages of that ID by other deleted ones. */ // id->us = 0; /* Is it actually? */ } _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs