From c914b11614fff23bca5b601da24f02ab51b9db52 Mon Sep 17 00:00:00 2001 From: Andrew Wiggin Date: Thu, 27 Oct 2011 17:39:15 +0000 Subject: [PATCH] perf improvement for array modifiers --- source/blender/modifiers/intern/MOD_array.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/source/blender/modifiers/intern/MOD_array.c b/source/blender/modifiers/intern/MOD_array.c index 5b94885f4af..57c8d39b825 100644 --- a/source/blender/modifiers/intern/MOD_array.c +++ b/source/blender/modifiers/intern/MOD_array.c @@ -392,6 +392,15 @@ static DerivedMesh *arrayModifier_doArray(ArrayModifierData *amd, if(count < 1) count = 1; + /* BMESH_TODO: bumping up the stack level avoids computing the normals + after every top-level operator execution (and this modifier has the + potential to execute a *lot* of top-level BMOps. There should be a + cleaner way to do this. One possibility: a "mirror" BMOp would + certainly help by compressing it all into one top-level BMOp that + executes a lot of second-level BMOps. */ + BMO_push(em->bm, NULL); + bmesh_begin_edit(em->bm, 0); + BMO_Init_Op(&weldop, "weldverts"); BMO_InitOpf(em->bm, &op, "dupe geom=%avef"); oldop = op; @@ -474,6 +483,10 @@ static DerivedMesh *arrayModifier_doArray(ArrayModifierData *amd, BMO_Finish_Op(em->bm, &weldop); + /* Bump the stack level back down to match the adjustment up above */ + bmesh_end_edit(em->bm, 0); + BMO_pop(em->bm); + BMEdit_RecalcTesselation(em); cddm = CDDM_from_BMEditMesh(em, NULL, 0);