diff options
author | YimingWu <xp8110@outlook.com> | 2022-05-13 19:03:40 +0300 |
---|---|---|
committer | YimingWu <xp8110@outlook.com> | 2022-05-13 19:04:16 +0300 |
commit | 870ad7d05db2e14164d818cd5320345fd8110a69 (patch) | |
tree | a5fb156e616ff6df071230974d9cad65d74fcb83 /source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c | |
parent | 5baa3ecda66337c0584f0bc6c6e7af0a6c0f6320 (diff) |
Fix T96781: LineArt proper object iterator.
This patch get rid of the _incorrectly used_ DG iterator in object loading,
and uses scene objects iteration to prevent problems.
Reviewed By: Sebastian Parborg (zeddb)
Differential Revision: https://developer.blender.org/D14907
Diffstat (limited to 'source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c')
-rw-r--r-- | source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c b/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c index 0e7df2a136d..a07ef2eb195 100644 --- a/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c +++ b/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c @@ -218,9 +218,18 @@ static void add_this_collection(Collection *c, if (!c) { return; } + bool default_add = true; + /* Do not do nested collection usage check, this is consistent with lineart calculation, because + * collection usage doesn't have a INHERIT mode. This might initially be derived from the fact + * that an object can be inside multiple collections, but might be irrelevant now with the way + * objects are iterated. Keep this logic for now. */ + if (c->lineart_usage & COLLECTION_LRT_EXCLUDE) { + default_add = false; + } FOREACH_COLLECTION_VISIBLE_OBJECT_RECURSIVE_BEGIN (c, ob, mode) { if (ELEM(ob->type, OB_MESH, OB_MBALL, OB_CURVES_LEGACY, OB_SURF, OB_FONT)) { - if (ob->lineart.usage != OBJECT_LRT_EXCLUDE) { + if ((ob->lineart.usage == OBJECT_LRT_INHERIT && default_add) || + ob->lineart.usage != OBJECT_LRT_EXCLUDE) { DEG_add_object_relation(ctx->node, ob, DEG_OB_COMP_GEOMETRY, "Line Art Modifier"); DEG_add_object_relation(ctx->node, ob, DEG_OB_COMP_TRANSFORM, "Line Art Modifier"); } @@ -239,15 +248,11 @@ static void updateDepsgraph(GpencilModifierData *md, DEG_add_object_relation(ctx->node, ctx->object, DEG_OB_COMP_TRANSFORM, "Line Art Modifier"); LineartGpencilModifierData *lmd = (LineartGpencilModifierData *)md; - if (lmd->source_type == LRT_SOURCE_OBJECT && lmd->source_object) { - DEG_add_object_relation( - ctx->node, lmd->source_object, DEG_OB_COMP_GEOMETRY, "Line Art Modifier"); - DEG_add_object_relation( - ctx->node, lmd->source_object, DEG_OB_COMP_TRANSFORM, "Line Art Modifier"); - } - else { - add_this_collection(ctx->scene->master_collection, ctx, mode); - } + + /* Always add whole master collection because line art will need the whole scene for + * visibility computation. Line art exclusion is handled inside #add_this_collection. */ + add_this_collection(ctx->scene->master_collection, ctx, mode); + if (lmd->calculation_flags & LRT_USE_CUSTOM_CAMERA && lmd->source_camera) { DEG_add_object_relation( ctx->node, lmd->source_camera, DEG_OB_COMP_TRANSFORM, "Line Art Modifier"); |