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>2019-05-22 23:57:16 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2019-05-23 00:33:27 +0300
commit91aafd56e3af8313b49a87a9821c9abe9b901126 (patch)
treeccb5c2005dd1f5c6252baeda2e7bc5acabf113c1 /source/blender/blenloader
parentd1f96f9b1194404ffafd2540cd2928048779656e (diff)
Fix (unreported) broken collections after undo/redo, or remapping (leading to crashes).
Those are two cases where keeping infamous backward `parents` pointers of collections in sync is kind of impossible to do... So rebuilding those relationships from scratch instead. Fixes e.g. a crash when undoing, then reloading a library, and likely many more weird ones like that. Uncovered while investigating T64764.
Diffstat (limited to 'source/blender/blenloader')
-rw-r--r--source/blender/blenloader/intern/readfile.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index de6e5a80912..493a66b0f8b 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -9504,6 +9504,19 @@ static void lib_link_all(FileData *fd, Main *main)
/* We could integrate that to mesh/curve/lattice lib_link, but this is really cheap process,
* so simpler to just use it directly in this single call. */
BLO_main_validate_shapekeys(main, NULL);
+
+ if (fd->memfile != NULL) {
+ /* When doing redo, we perform a tremendous amount of esoterics magic tricks to avoid having to
+ * re-read all library datablocks.
+ * 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 ome 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(main);
+ }
}
/** \} */