diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2018-11-27 17:49:30 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2018-11-27 23:17:06 +0300 |
commit | 4543da6ca63d227ed9ad809fbbdd765acab7aba6 (patch) | |
tree | 3bd18a73841febadc8ffffbd1d3ec7a80388f5ad /source | |
parent | c89bb6f1658b98c607cc55594c7aebd683e4b339 (diff) |
MOD_simpledeform: do not compute mesh when not needed.
Related to T57972.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/modifiers/intern/MOD_simpledeform.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/source/blender/modifiers/intern/MOD_simpledeform.c b/source/blender/modifiers/intern/MOD_simpledeform.c index 86791e5bcbe..f37cda25c58 100644 --- a/source/blender/modifiers/intern/MOD_simpledeform.c +++ b/source/blender/modifiers/intern/MOD_simpledeform.c @@ -385,11 +385,18 @@ static void deformVerts( float (*vertexCos)[3], int numVerts) { - Mesh *mesh_src = MOD_get_mesh_eval(ctx->object, NULL, mesh, NULL, false, false); + SimpleDeformModifierData *sdmd = (SimpleDeformModifierData *)md; + Mesh *mesh_src = NULL; - SimpleDeformModifier_do((SimpleDeformModifierData *)md, ctx->object, mesh_src, vertexCos, numVerts); + if (ctx->object->type == OB_MESH) { + /* mesh_src is only needed for vgroups. */ + mesh_src = MOD_get_mesh_eval(ctx->object, NULL, mesh, NULL, false, false); + BLI_assert(mesh_src->totvert == numVerts); + } - if (mesh_src != mesh) { + SimpleDeformModifier_do(sdmd, ctx->object, mesh_src, vertexCos, numVerts); + + if (!ELEM(mesh_src, NULL, mesh)) { BKE_id_free(NULL, mesh_src); } } |