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
path: root/source
diff options
context:
space:
mode:
authorDalai Felinto <dalai@blender.org>2022-04-07 15:51:59 +0300
committerFabian Schempp <fabianschempp@googlemail.com>2022-04-11 01:31:59 +0300
commitbaa55fcf630236980d8dcf0fa0851de5fa22d62a (patch)
tree0ddbee514e9155a21b628b604ab4cf53a56119e8 /source
parent9c702423cf9fc34bfdc8cca3b7db055f1284f631 (diff)
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.
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/intern/collection.c29
1 files changed, 24 insertions, 5 deletions
diff --git a/source/blender/blenkernel/intern/collection.c b/source/blender/blenkernel/intern/collection.c
index c215321bc30..939f7c7b3ff 100644
--- a/source/blender/blenkernel/intern/collection.c
+++ b/source/blender/blenkernel/intern/collection.c
@@ -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)