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 <bastien@blender.org>2020-06-15 17:30:46 +0300
committerBastien Montagne <bastien@blender.org>2020-06-30 13:44:19 +0300
commitb894480d68b2589115e62434aeb86f05b73b2414 (patch)
tree81cf0fa53975aa776f3e759fef252a49840a9801
parent3de9efdc9e1c2a04468cc36d575b83f882bce1a4 (diff)
Fix (unreported) critical mistake in Collection liblink code in readfile.c.
Prelimenary step to fix T77460. Not sure how or when that thing was done, but since that call walks around collections relationships, it's an utterly critical violation of liblinking principles (code here should never, ever 'get outside' of its own ID scope). This was wroking so far only because code called through this function (`BKE_collection_parent_relations_rebuild`) was only following parents pointers (in `BKE_collection_find_cycle()`), which would be either valid or non-existent. But next commit is going to change that to also check collection's objects instancing of other collections.
-rw-r--r--source/blender/blenloader/intern/readfile.c17
1 files changed, 3 insertions, 14 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 3c56ec966d5..657d776e57c 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -6433,8 +6433,6 @@ static void lib_link_collection_data(FileData *fd, Library *lib, Collection *col
for (CollectionChild *child = collection->children.first; child != NULL; child = child->next) {
child->collection = newlibadr(fd, lib, child->collection);
}
-
- BKE_collection_parent_relations_rebuild(collection);
}
static void lib_link_collection(FileData *fd, Main *UNUSED(bmain), Collection *collection)
@@ -10139,18 +10137,9 @@ static void lib_link_all(FileData *fd, Main *bmain)
* so simpler to just use it directly in this single call. */
BLO_main_validate_shapekeys(bmain, NULL);
- if (fd->memfile != NULL) {
- /* When doing redo, we perform a tremendous amount of esoteric magic tricks to avoid having to
- * re-read all library data-blocks.
- * Unfortunately, that means that we do not clear Collections' parents lists, which then get
- * improperly extended in some cases by lib_link_scene() and lib_link_collection() calls above
- * (when one local collection is parent of linked ones).
- * I do not really see a way to address that issue, besides brute force call below which
- * invalidates and re-creates all parenting relationships between collections. Yet another
- * example of why it is such a bad idea to keep that kind of double-linked relationships info
- * 'permanently' in our data structures... */
- BKE_main_collections_parent_relations_rebuild(bmain);
- }
+ /* We have to rebuild that runtime information *after* all data-blocks have been properly linked.
+ */
+ BKE_main_collections_parent_relations_rebuild(bmain);
#ifndef NDEBUG
/* Double check we do not have any 'need link' tag remaining, this should never be the case once