diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-11-04 16:14:03 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-11-05 16:48:44 +0300 |
commit | a1747b058d7f8e06e2f317736509d6bdb2d7ae2a (patch) | |
tree | 10ab816128f8276720719f432a3cb03b9b3e3595 /source/blender/modifiers/intern/MOD_array.c | |
parent | 8dfe2801ace57798f2df24a0c5b462a0b9c52443 (diff) |
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
Diffstat (limited to 'source/blender/modifiers/intern/MOD_array.c')
-rw-r--r-- | source/blender/modifiers/intern/MOD_array.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/source/blender/modifiers/intern/MOD_array.c b/source/blender/modifiers/intern/MOD_array.c index 644ac3a10e8..3b50cfe704a 100644 --- a/source/blender/modifiers/intern/MOD_array.c +++ b/source/blender/modifiers/intern/MOD_array.c @@ -80,16 +80,13 @@ 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"); } if (amd->curve_ob) { @@ -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]) |