From 09e11ad6ef1187d581b64a9ac6ebbbb6f056f7d9 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 30 May 2013 17:36:43 +0000 Subject: modifier stack: lazy initialize normals many modifiers were calculating normals, when those normals were ignored by the next modifier. now flag normals as dirty and recalculate for modifiers that set use `dependsOnNormals()` callback. Quick test on mesh with 12 modifiers (mostly build type), calculated normals 6 times, now it only runs once - so this will give some speedup too. --- source/blender/modifiers/intern/MOD_util.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'source/blender/modifiers/intern/MOD_util.c') diff --git a/source/blender/modifiers/intern/MOD_util.c b/source/blender/modifiers/intern/MOD_util.c index 1084023fcf0..c3748ce0265 100644 --- a/source/blender/modifiers/intern/MOD_util.c +++ b/source/blender/modifiers/intern/MOD_util.c @@ -184,11 +184,9 @@ DerivedMesh *get_cddm(Object *ob, struct BMEditMesh *em, DerivedMesh *dm, float else { dm = CDDM_copy(dm); CDDM_apply_vert_coords(dm, vertexCos); + dm->dirty |= DM_DIRTY_NORMALS; } - if (dm) - CDDM_calc_normals(dm); - return dm; } @@ -204,7 +202,7 @@ DerivedMesh *get_dm(Object *ob, struct BMEditMesh *em, DerivedMesh *dm, float (* if (vertexCos) { CDDM_apply_vert_coords(dm, vertexCos); - //CDDM_calc_normals(dm); + dm->dirty |= DM_DIRTY_NORMALS; } if (orco) -- cgit v1.2.3