diff options
author | Yiming Wu <xp8110@outlook.com> | 2022-06-02 06:21:07 +0300 |
---|---|---|
committer | Yiming Wu <xp8110@outlook.com> | 2022-06-02 06:21:07 +0300 |
commit | e3363451667299b1cbc85b04bcec3f106e5dc216 (patch) | |
tree | a2b812327db8480ca703ffb97c9f402b984ec19c /source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c | |
parent | 90da8c5f4a8e1d8002b6e4d448f80833250289a3 (diff) | |
parent | 110c90b3cfc94daead190dfb9adbc4761e6960b8 (diff) |
Merge remote-tracking branch 'origin/master' into temp-lineart-contained
Diffstat (limited to 'source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c')
-rw-r--r-- | source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c | 37 |
1 files changed, 23 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 e2329580594..b40be609677 100644 --- a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c +++ b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c @@ -2491,31 +2491,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); @@ -4446,6 +4450,11 @@ static void lineart_main_add_triangles(LineartRenderBuffer *rb) double t_elapsed = PIL_check_seconds_timer() - t_start; printf("Line art intersection time: %f\n", t_elapsed); } + + if (G.debug_value == 4000) { + double t_elapsed = PIL_check_seconds_timer() - t_start; + printf("Line art intersection time: %f\n", t_elapsed); + } } /** |