Fix bad pointer cast when modifier is used on non-mesh object

This commit is contained in:
2018-05-09 17:37:54 +02:00
parent b726ff4fc4
commit 4fe5a105f6
8 changed files with 61 additions and 67 deletions

View File

@@ -99,27 +99,26 @@ static void deformVerts(ModifierData *md, const ModifierEvalContext *ctx,
int numVerts)
{
LatticeModifierData *lmd = (LatticeModifierData *) md;
struct Mesh *mesh_src = mesh ? mesh : ctx->object->data;
struct Mesh *mesh_src = get_mesh(ctx->object, NULL, mesh, NULL, false, false);
modifier_vgroup_cache(md, vertexCos); /* if next modifier needs original vertices */
lattice_deform_verts(lmd->object, ctx->object, mesh_src,
vertexCos, numVerts, lmd->name, lmd->strength);
}
if (mesh_src != mesh) {
BKE_id_free(NULL, mesh_src);
}}
static void deformVertsEM(
ModifierData *md, const ModifierEvalContext *ctx, struct BMEditMesh *em,
struct Mesh *mesh, float (*vertexCos)[3], int numVerts)
{
struct Mesh *mesh_src = mesh;
if (!mesh) {
mesh_src = BKE_bmesh_to_mesh_nomain(em->bm, &(struct BMeshToMeshParams){0});
}
struct Mesh *mesh_src = get_mesh(ctx->object, em, mesh, NULL, false, false);
deformVerts(md, ctx, mesh_src, vertexCos, numVerts);
if (!mesh) {
if (mesh_src != mesh) {
BKE_id_free(NULL, mesh_src);
}
}