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:
authorYiming Wu <xp8110@outlook.com>2022-06-01 09:34:10 +0300
committerYiming Wu <xp8110@outlook.com>2022-06-01 09:35:33 +0300
commit71ce47a71d69b5433b22f02010c47db37a739a98 (patch)
treec4ddee2c7d0e46ea72a147eead4648e7ba8424d4
parent1bf35f1b197a825a0411c92ca590ff875f7c5f91 (diff)
LineArt: Temporary fix for object loading iterator.
Use `DEG_OBJECT_ITER_BEGIN`for loading objects, this iterator is technially unsafe to use *during* depsgraph evaluation, see https://developer.blender.org/D14997 for detailed explainations.
-rw-r--r--source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c32
1 files changed, 18 insertions, 14 deletions
diff --git a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
index 016b70cedb0..5c529a7f6b6 100644
--- a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
+++ b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
@@ -2454,31 +2454,35 @@ static void lineart_main_load_geometries(
eEvaluationMode eval_mode = DEG_get_mode(depsgraph);
bool is_render = eval_mode == DAG_EVAL_RENDER;
- FOREACH_SCENE_OBJECT_BEGIN (scene, ob) {
+ int flags = DEG_ITER_OBJECT_FLAG_LINKED_DIRECTLY | DEG_ITER_OBJECT_FLAG_LINKED_VIA_SET |
+ DEG_ITER_OBJECT_FLAG_VISIBLE;
+
+ /* Instance duplicated & particles. */
+ if (allow_duplicates) {
+ flags |= DEG_ITER_OBJECT_FLAG_DUPLI;
+ }
+
+ /* XXX(Yiming): Temporary solution, this iterator is technially unsafe to use *during* depsgraph
+ * evaluation, see https://developer.blender.org/D14997 for detailed explainations. */
+ DEG_OBJECT_ITER_BEGIN (depsgraph, ob, flags) {
Object *eval_ob = DEG_get_evaluated_object(depsgraph, ob);
if (!eval_ob) {
continue;
}
+ /* DEG_OBJECT_ITER_BEGIN will include the instanced mesh of these curve object types, so don't
+ * load them twice. */
+ if (allow_duplicates && ELEM(ob->type, OB_CURVES_LEGACY, OB_FONT, OB_SURF)) {
+ continue;
+ }
+
if (BKE_object_visibility(eval_ob, eval_mode) & OB_VISIBLE_SELF) {
lineart_object_load_single_instance(
rb, depsgraph, scene, eval_ob, eval_ob, eval_ob->obmat, is_render, olti, thread_count);
}
- if (allow_duplicates) {
- ListBase *dupli = object_duplilist(depsgraph, scene, eval_ob);
- LISTBASE_FOREACH (DupliObject *, dob, dupli) {
- if (BKE_object_visibility(eval_ob, eval_mode) &
- (OB_VISIBLE_PARTICLES | OB_VISIBLE_INSTANCES)) {
- Object *ob_ref = (dob->type & OB_DUPLIPARTS) ? eval_ob : dob->ob;
- lineart_object_load_single_instance(
- rb, depsgraph, scene, dob->ob, ob_ref, dob->mat, is_render, olti, thread_count);
- }
- }
- free_object_duplilist(dupli);
- }
}
- FOREACH_SCENE_OBJECT_END;
+ DEG_OBJECT_ITER_END;
TaskPool *tp = BLI_task_pool_create(NULL, TASK_PRIORITY_HIGH);