diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2018-11-27 22:10:41 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2018-11-27 23:17:06 +0300 |
commit | 2a578b37b3144ab4df7c605a95fabb699799b0dd (patch) | |
tree | 1ce3b6e0db47d9cd8457bb9681a9eb5c71558c3c /source/blender/modifiers/intern/MOD_warp.c | |
parent | 22e6ae11b46cb73640c3f48f7e5353d57d3e040b (diff) |
Modifiers: cleanup/harmonize deform modifiers code re. mesh source.
Also fixes a few issues (like meshdeform's EM variant not using editmesh
data), and adds a few optimizations (like only generating that source
mesh when we do have a vgroup defined in parameters, for modifiers only
using it to access vgroup)...
Diffstat (limited to 'source/blender/modifiers/intern/MOD_warp.c')
-rw-r--r-- | source/blender/modifiers/intern/MOD_warp.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/source/blender/modifiers/intern/MOD_warp.c b/source/blender/modifiers/intern/MOD_warp.c index ebe08b0becf..aa81b945b4c 100644 --- a/source/blender/modifiers/intern/MOD_warp.c +++ b/source/blender/modifiers/intern/MOD_warp.c @@ -317,10 +317,9 @@ static void deformVerts( WarpModifierData *wmd = (WarpModifierData *)md; Mesh *mesh_src = NULL; - if (ctx->object->type == OB_MESH) { - /* mesh_src is only needed for vgroups and textures, which only work on meshes. */ + if (wmd->defgrp_name[0] != '\0' || wmd->texture != NULL) { + /* mesh_src is only needed for vgroups and textures. */ mesh_src = MOD_deform_mesh_eval_get(ctx->object, NULL, mesh, NULL, numVerts, false, false); - BLI_assert(mesh_src->totvert == numVerts); } warpModifier_do(wmd, ctx, mesh_src, vertexCos, numVerts); @@ -335,14 +334,13 @@ static void deformVertsEM( Mesh *mesh, float (*vertexCos)[3], int numVerts) { WarpModifierData *wmd = (WarpModifierData *)md; - Mesh *mesh_src = mesh; + Mesh *mesh_src = NULL; - if (mesh_src == NULL) { - mesh_src = BKE_mesh_from_bmesh_for_eval_nomain(em->bm, 0); + if (wmd->defgrp_name[0] != '\0' || wmd->texture != NULL) { + /* mesh_src is only needed for vgroups and textures. */ + mesh_src = MOD_deform_mesh_eval_get(ctx->object, em, mesh, NULL, numVerts, false, false); } - BLI_assert(mesh_src->totvert == numVerts); - warpModifier_do(wmd, ctx, mesh_src, vertexCos, numVerts); if (!ELEM(mesh_src, NULL, mesh)) { |