Fix T97123: Applying modifier to multi-user: other objects were also converted
The first element of the iterator was not being tested against the flag. So in some cases it would lead to more objects been made into single-user than the active (or selected) ones.
This commit is contained in:
parent
8306f89c37
commit
9db15f502c
Notes:
blender-bot
2023-02-14 00:44:02 +01:00
Referenced by issue #97144, 3.2.0 Alpha Illegal recursive expansion of macros Referenced by issue #97123, Applying modifier to instance: another one (1st) instance become single-user too
|
@ -1929,6 +1929,26 @@ void BKE_scene_objects_iterator_begin(BLI_Iterator *iter, void *data_in)
|
|||
scene_objects_iterator_begin(iter, scene, NULL);
|
||||
}
|
||||
|
||||
static void scene_objects_iterator_skip_invalid_flag(BLI_Iterator *iter)
|
||||
{
|
||||
if (!iter->valid) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* Unpack the data. */
|
||||
SceneObjectsIteratorExData *data = iter->data;
|
||||
iter->data = data->iter_data;
|
||||
|
||||
Object *ob = iter->current;
|
||||
if (ob && (ob->flag & data->flag) == 0) {
|
||||
iter->skip = true;
|
||||
}
|
||||
|
||||
/* Pack the data. */
|
||||
data->iter_data = iter->data;
|
||||
iter->data = data;
|
||||
}
|
||||
|
||||
void BKE_scene_objects_iterator_begin_ex(BLI_Iterator *iter, void *data_in)
|
||||
{
|
||||
SceneObjectsIteratorExData *data = data_in;
|
||||
|
@ -1938,6 +1958,8 @@ void BKE_scene_objects_iterator_begin_ex(BLI_Iterator *iter, void *data_in)
|
|||
/* Pack the data. */
|
||||
data->iter_data = iter->data;
|
||||
iter->data = data_in;
|
||||
|
||||
scene_objects_iterator_skip_invalid_flag(iter);
|
||||
}
|
||||
|
||||
void BKE_scene_objects_iterator_next_ex(struct BLI_Iterator *iter)
|
||||
|
@ -1948,14 +1970,11 @@ void BKE_scene_objects_iterator_next_ex(struct BLI_Iterator *iter)
|
|||
|
||||
BKE_scene_objects_iterator_next(iter);
|
||||
|
||||
Object *ob = iter->current;
|
||||
if (ob && (ob->flag & data->flag) == 0) {
|
||||
iter->skip = true;
|
||||
}
|
||||
|
||||
/* Pack the data. */
|
||||
data->iter_data = iter->data;
|
||||
iter->data = data;
|
||||
|
||||
scene_objects_iterator_skip_invalid_flag(iter);
|
||||
}
|
||||
|
||||
void BKE_scene_objects_iterator_end_ex(struct BLI_Iterator *iter)
|
||||
|
|
Loading…
Reference in New Issue