Changeset View
Changeset View
Standalone View
Standalone View
source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
| Show First 20 Lines • Show All 92 Lines • ▼ Show 20 Lines | |||||
| static void add_this_collection(Collection *c, | static void add_this_collection(Collection *c, | ||||
| const ModifierUpdateDepsgraphContext *ctx, | const ModifierUpdateDepsgraphContext *ctx, | ||||
| const int mode) | const int mode) | ||||
| { | { | ||||
| if (!c) { | if (!c) { | ||||
| return; | 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) { | 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 (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_GEOMETRY, "Line Art Modifier"); | ||||
| DEG_add_object_relation(ctx->node, ob, DEG_OB_COMP_TRANSFORM, "Line Art Modifier"); | DEG_add_object_relation(ctx->node, ob, DEG_OB_COMP_TRANSFORM, "Line Art Modifier"); | ||||
| } | } | ||||
| } | } | ||||
| if (ob->type == OB_EMPTY && (ob->transflag & OB_DUPLICOLLECTION)) { | if (ob->type == OB_EMPTY && (ob->transflag & OB_DUPLICOLLECTION)) { | ||||
| add_this_collection(ob->instance_collection, ctx, mode); | add_this_collection(ob->instance_collection, ctx, mode); | ||||
| } | } | ||||
| } | } | ||||
| FOREACH_COLLECTION_VISIBLE_OBJECT_RECURSIVE_END; | FOREACH_COLLECTION_VISIBLE_OBJECT_RECURSIVE_END; | ||||
| } | } | ||||
| static void updateDepsgraph(GpencilModifierData *md, | static void updateDepsgraph(GpencilModifierData *md, | ||||
| const ModifierUpdateDepsgraphContext *ctx, | const ModifierUpdateDepsgraphContext *ctx, | ||||
| const int mode) | const int mode) | ||||
| { | { | ||||
| DEG_add_object_relation(ctx->node, ctx->object, DEG_OB_COMP_TRANSFORM, "Line Art Modifier"); | DEG_add_object_relation(ctx->node, ctx->object, DEG_OB_COMP_TRANSFORM, "Line Art Modifier"); | ||||
| LineartGpencilModifierData *lmd = (LineartGpencilModifierData *)md; | LineartGpencilModifierData *lmd = (LineartGpencilModifierData *)md; | ||||
| if (lmd->source_type == LRT_SOURCE_OBJECT && lmd->source_object) { | |||||
| DEG_add_object_relation( | /* Always add whole master collection because line art will need the whole scene for | ||||
| ctx->node, lmd->source_object, DEG_OB_COMP_GEOMETRY, "Line Art Modifier"); | * visibility computation. Line art exclusion is handled inside #add_this_collection. */ | ||||
| DEG_add_object_relation( | add_this_collection(ctx->scene->master_collection, ctx, mode); | ||||
| ctx->node, lmd->source_object, DEG_OB_COMP_TRANSFORM, "Line Art Modifier"); | |||||
| } | |||||
| else { | |||||
| add_this_collection(ctx->scene->master_collection, ctx, mode); | |||||
| } | |||||
| if (lmd->calculation_flags & LRT_USE_CUSTOM_CAMERA && lmd->source_camera) { | if (lmd->calculation_flags & LRT_USE_CUSTOM_CAMERA && lmd->source_camera) { | ||||
| DEG_add_object_relation( | DEG_add_object_relation( | ||||
| ctx->node, lmd->source_camera, DEG_OB_COMP_TRANSFORM, "Line Art Modifier"); | ctx->node, lmd->source_camera, DEG_OB_COMP_TRANSFORM, "Line Art Modifier"); | ||||
| DEG_add_object_relation( | DEG_add_object_relation( | ||||
| ctx->node, lmd->source_camera, DEG_OB_COMP_PARAMETERS, "Line Art Modifier"); | ctx->node, lmd->source_camera, DEG_OB_COMP_PARAMETERS, "Line Art Modifier"); | ||||
| } | } | ||||
| else if (ctx->scene->camera) { | else if (ctx->scene->camera) { | ||||
| DEG_add_object_relation( | DEG_add_object_relation( | ||||
| ▲ Show 20 Lines • Show All 92 Lines • Show Last 20 Lines | |||||