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:
Diffstat (limited to 'source/blender/blenkernel/intern/layer.c')
-rw-r--r--source/blender/blenkernel/intern/layer.c32
1 files changed, 15 insertions, 17 deletions
diff --git a/source/blender/blenkernel/intern/layer.c b/source/blender/blenkernel/intern/layer.c
index f03bf60817f..64649d84320 100644
--- a/source/blender/blenkernel/intern/layer.c
+++ b/source/blender/blenkernel/intern/layer.c
@@ -695,8 +695,8 @@ int BKE_layer_collection_findindex(ViewLayer *view_layer, const LayerCollection
* stores state like selection. */
static void layer_collection_sync(ViewLayer *view_layer,
- const ListBase *lb_scene,
- ListBase *lb_layer,
+ const ListBase *lb_collections,
+ ListBase *lb_layer_collections,
ListBase *new_object_bases,
short parent_exclude,
short parent_restrict,
@@ -708,11 +708,10 @@ static void layer_collection_sync(ViewLayer *view_layer,
* linking we can only sync after the fact. */
/* Remove layer collections that no longer have a corresponding scene collection. */
- for (LayerCollection *lc = lb_layer->first; lc;) {
- /* Note ID remap can set lc->collection to NULL when deleting collections. */
- LayerCollection *lc_next = lc->next;
+ LISTBASE_FOREACH_MUTABLE (LayerCollection *, lc, lb_layer_collections) {
+ /* Note that ID remap can set lc->collection to NULL when deleting collections. */
Collection *collection = (lc->collection) ?
- BLI_findptr(lb_scene,
+ BLI_findptr(lb_collections,
lc->collection,
offsetof(CollectionChild, collection)) :
NULL;
@@ -724,21 +723,20 @@ static void layer_collection_sync(ViewLayer *view_layer,
/* Free recursively. */
layer_collection_free(view_layer, lc);
- BLI_freelinkN(lb_layer, lc);
+ BLI_freelinkN(lb_layer_collections, lc);
}
-
- lc = lc_next;
}
/* Add layer collections for any new scene collections, and ensure order is the same. */
ListBase new_lb_layer = {NULL, NULL};
- LISTBASE_FOREACH (const CollectionChild *, child, lb_scene) {
+ LISTBASE_FOREACH (const CollectionChild *, child, lb_collections) {
Collection *collection = child->collection;
- LayerCollection *lc = BLI_findptr(lb_layer, collection, offsetof(LayerCollection, collection));
+ LayerCollection *lc = BLI_findptr(
+ lb_layer_collections, collection, offsetof(LayerCollection, collection));
if (lc) {
- BLI_remlink(lb_layer, lc);
+ BLI_remlink(lb_layer_collections, lc);
BLI_addtail(&new_lb_layer, lc);
}
else {
@@ -845,8 +843,8 @@ static void layer_collection_sync(ViewLayer *view_layer,
}
/* Replace layer collection list with new one. */
- *lb_layer = new_lb_layer;
- BLI_assert(BLI_listbase_count(lb_scene) == BLI_listbase_count(lb_layer));
+ *lb_layer_collections = new_lb_layer;
+ BLI_assert(BLI_listbase_count(lb_collections) == BLI_listbase_count(lb_layer_collections));
}
/**
@@ -876,9 +874,9 @@ void BKE_layer_collection_sync(const Scene *scene, ViewLayer *view_layer)
}
/* Generate new layer connections and object bases when collections changed. */
- CollectionChild child = {NULL, NULL, scene->master_collection};
- const ListBase collections = {&child, &child};
- ListBase new_object_bases = {NULL, NULL};
+ CollectionChild child = {.next = NULL, .prev = NULL, .collection = scene->master_collection};
+ const ListBase collections = {.first = &child, .last = &child};
+ ListBase new_object_bases = {.first = NULL, .last = NULL};
const short parent_exclude = 0, parent_restrict = 0, parent_layer_restrict = 0;
layer_collection_sync(view_layer,