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:
authorDalai Felinto <dfelinto@gmail.com>2017-11-07 19:06:55 +0300
committerDalai Felinto <dfelinto@gmail.com>2017-11-07 19:08:34 +0300
commit1b18e158025a488e1ba2446ad93c2eb563c11611 (patch)
tree9fa432d1bd7e622cb0d7cd4a9160bdff7d30c554 /source/blender/blenkernel/intern/collection.c
parentfc789803cabc9dfd47319a7f0297456c8f60153c (diff)
Sanitize use of BLI_iterator
We now initialize iter.valid as true as part of the main iterator (and manually when using via Python). And we don't even bother setting iter->current to NULL if it's invalid. Let's stick to using iter->valid only.
Diffstat (limited to 'source/blender/blenkernel/intern/collection.c')
-rw-r--r--source/blender/blenkernel/intern/collection.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/source/blender/blenkernel/intern/collection.c b/source/blender/blenkernel/intern/collection.c
index 2b69c176c39..2a1157cf6b4 100644
--- a/source/blender/blenkernel/intern/collection.c
+++ b/source/blender/blenkernel/intern/collection.c
@@ -535,7 +535,6 @@ void BKE_scene_collections_iterator_begin(BLI_Iterator *iter, void *data_in)
data->cur = 0;
iter->current = data->array[data->cur];
- iter->valid = true;
}
void BKE_scene_collections_iterator_next(struct BLI_Iterator *iter)
@@ -585,10 +584,10 @@ void BKE_scene_objects_iterator_begin(BLI_Iterator *iter, void *data_in)
BKE_scene_collections_iterator_begin(&data->scene_collection_iter, scene);
SceneCollection *sc = data->scene_collection_iter.current;
- iter->current = sc->objects.first ? ((LinkData *)sc->objects.first)->data : NULL;
- iter->valid = true;
-
- if (iter->current == NULL) {
+ if (sc->objects.first != NULL) {
+ iter->current = ((LinkData *)sc->objects.first)->data;
+ }
+ else {
BKE_scene_objects_iterator_next(iter);
}
}