Scene object iterator: Replace recursion with loop
This way we are not afraid of recursion being too deep. That could have happened when having two collections which are sharing same list of 1000s of objects.
This commit is contained in:
@@ -584,18 +584,14 @@ void BKE_scene_objects_iterator_begin(BLI_Iterator *iter, void *data_in)
|
||||
*/
|
||||
static LinkData *object_base_unique(GSet *gs, LinkData *link)
|
||||
{
|
||||
if (link == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Object *ob = link->data;
|
||||
if (!BLI_gset_haskey(gs, ob)) {
|
||||
BLI_gset_add(gs, ob);
|
||||
return link;
|
||||
}
|
||||
else {
|
||||
return object_base_unique(gs, link->next);
|
||||
for (; link != NULL; link = link->next) {
|
||||
Object *ob = link->data;
|
||||
if (!BLI_gset_haskey(gs, ob)) {
|
||||
BLI_gset_add(gs, ob);
|
||||
return link;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void BKE_scene_objects_iterator_next(BLI_Iterator *iter)
|
||||
|
||||
Reference in New Issue
Block a user