From 334b55fd2e89d66023a499e1ce7f867d9789290d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Tue, 1 May 2018 17:33:04 +0200 Subject: Extract common modifier parameters into ModifierEvalContext struct The contents of the ModifierEvalContext struct are constant while iterating over the modifier stack. The struct thus should be only created once, outside any loop over the modifiers. --- source/blender/modifiers/intern/MOD_lattice.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'source/blender/modifiers/intern/MOD_lattice.c') diff --git a/source/blender/modifiers/intern/MOD_lattice.c b/source/blender/modifiers/intern/MOD_lattice.c index ecaaa5781a8..ac1107395b0 100644 --- a/source/blender/modifiers/intern/MOD_lattice.c +++ b/source/blender/modifiers/intern/MOD_lattice.c @@ -99,30 +99,29 @@ static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphConte DEG_add_object_relation(ctx->node, ctx->object, DEG_OB_COMP_TRANSFORM, "Lattice Modifier"); } -static void deformVerts(ModifierData *md, struct Depsgraph *UNUSED(depsgraph), - Object *ob, DerivedMesh *derivedData, +static void deformVerts(ModifierData *md, const ModifierEvalContext *ctx, + DerivedMesh *derivedData, float (*vertexCos)[3], - int numVerts, - ModifierApplyFlag UNUSED(flag)) + int numVerts) { LatticeModifierData *lmd = (LatticeModifierData *) md; modifier_vgroup_cache(md, vertexCos); /* if next modifier needs original vertices */ - lattice_deform_verts(lmd->object, ob, derivedData, + lattice_deform_verts(lmd->object, ctx->object, derivedData, vertexCos, numVerts, lmd->name, lmd->strength); } static void deformVertsEM( - ModifierData *md, struct Depsgraph *depsgraph, Object *ob, struct BMEditMesh *em, + ModifierData *md, const ModifierEvalContext *ctx, struct BMEditMesh *em, DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts) { DerivedMesh *dm = derivedData; if (!derivedData) dm = CDDM_from_editbmesh(em, false, false); - deformVerts(md, depsgraph, ob, dm, vertexCos, numVerts, 0); + deformVerts(md, ctx, dm, vertexCos, numVerts); if (!derivedData) dm->release(dm); } -- cgit v1.2.3