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_armature.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_armature.c')
-rw-r--r--source/blender/modifiers/intern/MOD_armature.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/source/blender/modifiers/intern/MOD_armature.c b/source/blender/modifiers/intern/MOD_armature.c
index abbd7ba0fc8..f354ed3aada 100644
--- a/source/blender/modifiers/intern/MOD_armature.c
+++ b/source/blender/modifiers/intern/MOD_armature.c
@@ -110,17 +110,16 @@ static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphConte
}
}
-static void deformVerts(ModifierData *md, struct Depsgraph *UNUSED(depsgraph),
- Object *ob, Mesh *mesh,
+static void deformVerts(ModifierData *md, const ModifierEvalContext *ctx,
+ Mesh *mesh,
float (*vertexCos)[3],
- int numVerts,
- ModifierApplyFlag UNUSED(flag))
+ int numVerts)
{
ArmatureModifierData *amd = (ArmatureModifierData *) md;
modifier_vgroup_cache(md, vertexCos); /* if next modifier needs original vertices */
- armature_deform_verts(amd->object, ob, mesh, vertexCos, NULL,
+ armature_deform_verts(amd->object, ctx->object, mesh, vertexCos, NULL,
numVerts, amd->deformflag, (float(*)[3])amd->prevCos, amd->defgrp_name);
/* free cache */
@@ -131,7 +130,7 @@ static void deformVerts(ModifierData *md, struct Depsgraph *UNUSED(depsgraph),
}
static void deformVertsEM(
- ModifierData *md, struct Depsgraph *UNUSED(depsgraph), Object *ob, struct BMEditMesh *em,
+ ModifierData *md, const ModifierEvalContext *ctx, struct BMEditMesh *em,
Mesh *mesh, float (*vertexCos)[3], int numVerts)
{
ArmatureModifierData *amd = (ArmatureModifierData *) md;
@@ -147,7 +146,7 @@ static void deformVertsEM(
modifier_vgroup_cache(md, vertexCos); /* if next modifier needs original vertices */
- armature_deform_verts(amd->object, ob, mesh_src, vertexCos, NULL,
+ armature_deform_verts(amd->object, ctx->object, mesh_src, vertexCos, NULL,
numVerts, amd->deformflag, (float(*)[3])amd->prevCos, amd->defgrp_name);
/* free cache */
@@ -163,7 +162,7 @@ static void deformVertsEM(
}
static void deformMatricesEM(
- ModifierData *md, struct Depsgraph *UNUSED(depsgraph), Object *ob, struct BMEditMesh *em,
+ ModifierData *md, const ModifierEvalContext *ctx, struct BMEditMesh *em,
Mesh *mesh, float (*vertexCos)[3],
float (*defMats)[3][3], int numVerts)
{
@@ -178,7 +177,7 @@ static void deformMatricesEM(
BM_mesh_bm_to_me(em->bm, mesh_src, &params);
}
- armature_deform_verts(amd->object, ob, mesh_src, vertexCos, defMats, numVerts,
+ armature_deform_verts(amd->object, ctx->object, mesh_src, vertexCos, defMats, numVerts,
amd->deformflag, NULL, amd->defgrp_name);
if (!mesh) {
@@ -187,13 +186,13 @@ static void deformMatricesEM(
}
}
-static void deformMatrices(ModifierData *md, struct Depsgraph *UNUSED(depsgraph), Object *ob, Mesh *mesh,
+static void deformMatrices(ModifierData *md, const ModifierEvalContext *ctx, Mesh *mesh,
float (*vertexCos)[3], float (*defMats)[3][3], int numVerts)
{
ArmatureModifierData *amd = (ArmatureModifierData *) md;
- Mesh *mesh_src = mesh ? mesh : ob->data;
+ Mesh *mesh_src = mesh ? mesh : ctx->object->data;
- armature_deform_verts(amd->object, ob, mesh_src, vertexCos, defMats, numVerts,
+ armature_deform_verts(amd->object, ctx->object, mesh_src, vertexCos, defMats, numVerts,
amd->deformflag, NULL, amd->defgrp_name);
}