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.
This commit is contained in:
@@ -565,11 +565,7 @@ static DerivedMesh *arrayModifier_doArray(ArrayModifierData *amd,
|
||||
|
||||
if ((amd->offset_type & MOD_ARR_OFF_OBJ) && (amd->offset_ob)) {
|
||||
/* Update normals in case offset object has rotation. */
|
||||
|
||||
/* BMESH_TODO: check if normal recalc needed under any other
|
||||
* conditions? */
|
||||
|
||||
CDDM_calc_normals(result);
|
||||
result->dirty |= DM_DIRTY_NORMALS;
|
||||
}
|
||||
|
||||
BM_mesh_free(bm);
|
||||
@@ -591,9 +587,6 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
|
||||
|
||||
result = arrayModifier_doArray(amd, md->scene, ob, dm, 0);
|
||||
|
||||
//if (result != dm)
|
||||
// CDDM_calc_normals_mapping(result);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user