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:
authorMai Lavelle <mai.lavelle@gmail.com>2018-04-24 11:08:16 +0300
committerMai Lavelle <mai.lavelle@gmail.com>2018-05-16 13:07:50 +0300
commitc43dbc2bc2a6b35095d18db7edcdd9be245c045c (patch)
tree0e6063d95bf106305a76019c9a2e89f650ee4138 /source/blender/blenkernel/intern/modifier.c
parentfee50f830dee21c6b666e016c71a517b263c7a3f (diff)
Add modifier_deformVerts_ensure_normals, modifier_applyModifier_ensure_normals
Same as `modwrap_deformVerts` and `modwrap_applyModifier` but for `Mesh`.
Diffstat (limited to 'source/blender/blenkernel/intern/modifier.c')
-rw-r--r--source/blender/blenkernel/intern/modifier.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/modifier.c b/source/blender/blenkernel/intern/modifier.c
index cb97cee4547..b49df101fe6 100644
--- a/source/blender/blenkernel/intern/modifier.c
+++ b/source/blender/blenkernel/intern/modifier.c
@@ -901,6 +901,19 @@ void modifier_deformVerts(struct ModifierData *md, const ModifierEvalContext *ct
}
}
+void modifier_deformVerts_ensure_normals(struct ModifierData *md, const ModifierEvalContext *ctx,
+ struct Mesh *mesh,
+ float (*vertexCos)[3], int numVerts)
+{
+ const ModifierTypeInfo *mti = modifierType_getInfo(md->type);
+ BLI_assert(!mesh || CustomData_has_layer(&mesh->pdata, CD_NORMAL) == false);
+
+ if (mesh && mti->dependsOnNormals && mti->dependsOnNormals(md)) {
+ BKE_mesh_calc_normals(mesh);
+ }
+ modifier_deformVerts(md, ctx, mesh, vertexCos, numVerts);
+}
+
void modifier_deformMatrices(struct ModifierData *md, const ModifierEvalContext *ctx,
struct Mesh *mesh,
float (*vertexCos)[3], float (*defMats)[3][3], int numVerts)
@@ -993,6 +1006,18 @@ struct Mesh *modifier_applyModifier(struct ModifierData *md, const ModifierEvalC
}
}
+struct Mesh *modifier_applyModifier_ensure_normals(struct ModifierData *md, const ModifierEvalContext *ctx,
+ struct Mesh *mesh)
+{
+ const ModifierTypeInfo *mti = modifierType_getInfo(md->type);
+ BLI_assert(CustomData_has_layer(&mesh->pdata, CD_NORMAL) == false);
+
+ if (mti->dependsOnNormals && mti->dependsOnNormals(md)) {
+ BKE_mesh_calc_normals(mesh);
+ }
+ return modifier_applyModifier(md, ctx, mesh);
+}
+
struct Mesh *modifier_applyModifierEM(struct ModifierData *md, const ModifierEvalContext *ctx,
struct BMEditMesh *editData,
struct Mesh *mesh)