[Bf-blender-cvs] [a1747b058d7] blender-v2.81-release: Fix T71259: Array Modifier Performance is slow

Sergey Sharybin noreply at git.blender.org
Tue Nov 5 15:26:27 CET 2019


Commit: a1747b058d7f8e06e2f317736509d6bdb2d7ae2a
Author: Sergey Sharybin
Date:   Mon Nov 4 14:14:03 2019 +0100
Branches: blender-v2.81-release
https://developer.blender.org/rBa1747b058d7f8e06e2f317736509d6bdb2d7ae2a

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

===================================================================

M	source/blender/modifiers/intern/MOD_array.c

===================================================================

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,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])



More information about the Bf-blender-cvs mailing list