Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSybren A. Stüvel <sybren@stuvel.eu>2018-05-01 18:33:04 +0300
committerSybren A. Stüvel <sybren@stuvel.eu>2018-05-01 19:02:17 +0300
commit334b55fd2e89d66023a499e1ce7f867d9789290d (patch)
tree3afcc711d6a9eeda85d9ae069ce1ac9cfc9fcb89 /source/blender/modifiers/intern/MOD_cloth.c
parent6b9f1ffe6e56ee4d55f4cde5c724c31a3a90292b (diff)
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.
Diffstat (limited to 'source/blender/modifiers/intern/MOD_cloth.c')
-rw-r--r--source/blender/modifiers/intern/MOD_cloth.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/source/blender/modifiers/intern/MOD_cloth.c b/source/blender/modifiers/intern/MOD_cloth.c
index 84cad91b32e..315ea73d086 100644
--- a/source/blender/modifiers/intern/MOD_cloth.c
+++ b/source/blender/modifiers/intern/MOD_cloth.c
@@ -69,8 +69,9 @@ static void initData(ModifierData *md)
cloth_init(clmd);
}
-static void deformVerts(ModifierData *md, struct Depsgraph *depsgraph, Object *ob, DerivedMesh *derivedData, float (*vertexCos)[3],
- int numVerts, ModifierApplyFlag UNUSED(flag))
+static void deformVerts(ModifierData *md, const ModifierEvalContext *ctx,
+ DerivedMesh *derivedData, float (*vertexCos)[3],
+ int numVerts)
{
DerivedMesh *dm;
ClothModifierData *clmd = (ClothModifierData *) md;
@@ -83,7 +84,7 @@ static void deformVerts(ModifierData *md, struct Depsgraph *depsgraph, Object *o
return;
}
- dm = get_dm(ob, NULL, derivedData, NULL, false, false);
+ dm = get_dm(ctx->object, NULL, derivedData, NULL, false, false);
if (dm == derivedData)
dm = CDDM_copy(dm);
@@ -94,7 +95,7 @@ static void deformVerts(ModifierData *md, struct Depsgraph *depsgraph, Object *o
* Also hopefully new cloth system will arrive soon..
*/
if (derivedData == NULL && clmd->sim_parms->shapekey_rest) {
- KeyBlock *kb = BKE_keyblock_from_key(BKE_key_from_object(ob),
+ KeyBlock *kb = BKE_keyblock_from_key(BKE_key_from_object(ctx->object),
clmd->sim_parms->shapekey_rest);
if (kb && kb->data != NULL) {
float (*layerorco)[3];
@@ -109,7 +110,7 @@ static void deformVerts(ModifierData *md, struct Depsgraph *depsgraph, Object *o
CDDM_apply_vert_coords(dm, vertexCos);
- clothModifier_do(clmd, depsgraph, md->scene, ob, dm, vertexCos);
+ clothModifier_do(clmd, ctx->depsgraph, md->scene, ctx->object, dm, vertexCos);
dm->release(dm);
}