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:51:36 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2019-05-23 00:33:27 +0300
commitd1f96f9b1194404ffafd2540cd2928048779656e (patch)
tree4137cd2f2ccc8cfbb5cbbd1d21762df49fa1b161 /source/blender/blenloader
parent5a3c44937f64776099125577126766c67f96139a (diff)
BKE Collection: Add new function to rebuild parent relationships.
It's not always possible to keep 'by hand' parent relationships valid in collections hierarchy. Add functions to remake those (re-using/factorizing code from `readfile.c` `lib_link_collection_data()` function). Can't stress again how painful it is to have those kind of backward relationships in our data structures, those *always* end up being serious issues to keep in sync... Should only be generated on the fly when needed, period. :(
Diffstat (limited to 'source/blender/blenloader')
-rw-r--r--source/blender/blenloader/intern/readfile.c15
1 files changed, 3 insertions, 12 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 5edba272cd4..de6e5a80912 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -6228,20 +6228,11 @@ static void lib_link_collection_data(FileData *fd, Library *lib, Collection *col
}
}
- for (CollectionChild *child = collection->children.first, *child_next = NULL; child;
- child = child_next) {
- child_next = child->next;
+ for (CollectionChild *child = collection->children.first; child != NULL; child = child->next) {
child->collection = newlibadr_us(fd, lib, child->collection);
-
- if (child->collection == NULL || BKE_collection_find_cycle(collection, child->collection)) {
- BLI_freelinkN(&collection->children, child);
- }
- else {
- CollectionParent *cparent = MEM_callocN(sizeof(CollectionParent), "CollectionParent");
- cparent->collection = collection;
- BLI_addtail(&child->collection->parents, cparent);
- }
}
+
+ BKE_collection_parent_relations_rebuild(collection);
}
static void lib_link_collection(FileData *fd, Main *main)