Fix T71259: Array Modifier Performance is slow

Was happening when object transform is animated.

Caused by overly aggressive dependency construction introduced a
while back in 9d4129eee649: we shouldn't add dependencies unless
we really need them.

This change removes unneeded transform dependency for cap objects
(since only their geometry is used), and also removes own transform
dependency if there is no offset object (which is the only case when
own transform is needed).

Differential Revision: https://developer.blender.org/D6184
This commit is contained in:
Sergey Sharybin 2019-11-04 14:14:03 +01:00
parent 8dfe2801ac
commit a1747b058d
Notes: blender-bot 2023-02-14 08:06:35 +01:00
Referenced by issue #71259, Array Modifier Performance Issues between 2.79 & 2.8x
1 changed files with 6 additions and 5 deletions

View File

@ -80,15 +80,12 @@ static void foreachObjectLink(ModifierData *md, Object *ob, ObjectWalkFunc walk,
static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphContext *ctx)
{
ArrayModifierData *amd = (ArrayModifierData *)md;
bool need_transform_dependency = false;
if (amd->start_cap != NULL) {
DEG_add_object_relation(
ctx->node, amd->start_cap, DEG_OB_COMP_TRANSFORM, "Array Modifier Start Cap");
DEG_add_object_relation(
ctx->node, amd->start_cap, DEG_OB_COMP_GEOMETRY, "Array Modifier Start Cap");
}
if (amd->end_cap != NULL) {
DEG_add_object_relation(
ctx->node, amd->end_cap, DEG_OB_COMP_TRANSFORM, "Array Modifier End Cap");
DEG_add_object_relation(
ctx->node, amd->end_cap, DEG_OB_COMP_GEOMETRY, "Array Modifier End Cap");
}
@ -100,8 +97,12 @@ static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphConte
if (amd->offset_ob != NULL) {
DEG_add_object_relation(
ctx->node, amd->offset_ob, DEG_OB_COMP_TRANSFORM, "Array Modifier Offset");
need_transform_dependency = true;
}
if (need_transform_dependency) {
DEG_add_modifier_to_transform_relation(ctx->node, "Array Modifier");
}
DEG_add_modifier_to_transform_relation(ctx->node, "Array Modifier");
}
BLI_INLINE float sum_v3(const float v[3])