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_screw.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'source/blender/modifiers/intern/MOD_screw.c') diff --git a/source/blender/modifiers/intern/MOD_screw.c b/source/blender/modifiers/intern/MOD_screw.c index e53d11d9b01..6335c453955 100644 --- a/source/blender/modifiers/intern/MOD_screw.c +++ b/source/blender/modifiers/intern/MOD_screw.c @@ -184,14 +184,13 @@ static void copyData(ModifierData *md, ModifierData *target) modifier_copyData_generic(md, target); } -static DerivedMesh *applyModifier(ModifierData *md, struct Depsgraph *UNUSED(depsgraph), - Object *ob, DerivedMesh *derivedData, - ModifierApplyFlag flag) +static DerivedMesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, + DerivedMesh *derivedData) { DerivedMesh *dm = derivedData; DerivedMesh *result; ScrewModifierData *ltmd = (ScrewModifierData *) md; - const bool use_render_params = (flag & MOD_APPLY_RENDER) != 0; + const bool use_render_params = (ctx->flag & MOD_APPLY_RENDER) != 0; int *origindex; int mpoly_index = 0; @@ -279,7 +278,7 @@ static DerivedMesh *applyModifier(ModifierData *md, struct Depsgraph *UNUSED(dep if (ltmd->ob_axis) { /* calc the matrix relative to the axis object */ - invert_m4_m4(mtx_tmp_a, ob->obmat); + invert_m4_m4(mtx_tmp_a, ctx->object->obmat); copy_m4_m4(mtx_tx_inv, ltmd->ob_axis->obmat); mul_m4_m4m4(mtx_tx, mtx_tmp_a, mtx_tx_inv); -- cgit v1.2.3