Add modifier_deformVerts_ensure_normals, modifier_applyModifier_ensure_normals
Same as `modwrap_deformVerts` and `modwrap_applyModifier` but for `Mesh`.
This commit is contained in:
parent
fee50f830d
commit
c43dbc2bc2
|
@ -498,6 +498,10 @@ void modifier_deformVerts(
|
|||
struct ModifierData *md, const struct ModifierEvalContext *ctx,
|
||||
struct Mesh *mesh, float (*vertexCos)[3], int numVerts);
|
||||
|
||||
void modifier_deformVerts_ensure_normals(
|
||||
struct ModifierData *md, const struct ModifierEvalContext *ctx,
|
||||
struct Mesh *mesh, float (*vertexCos)[3], int numVerts);
|
||||
|
||||
void modifier_deformMatrices(
|
||||
struct ModifierData *md, const struct ModifierEvalContext *ctx,
|
||||
struct Mesh *mesh, float (*vertexCos)[3], float (*defMats)[3][3], int numVerts);
|
||||
|
@ -516,6 +520,10 @@ struct Mesh *modifier_applyModifier(
|
|||
struct ModifierData *md, const struct ModifierEvalContext *ctx,
|
||||
struct Mesh *mesh);
|
||||
|
||||
struct Mesh *modifier_applyModifier_ensure_normals(
|
||||
struct ModifierData *md, const struct ModifierEvalContext *ctx,
|
||||
struct Mesh *mesh);
|
||||
|
||||
struct Mesh *modifier_applyModifierEM(
|
||||
struct ModifierData *md, const struct ModifierEvalContext *ctx,
|
||||
struct BMEditMesh *editData, struct Mesh *mesh);
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue