diff options
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/modifiers/intern/MOD_cast.c | 3 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_curve.c | 7 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_displace.c | 8 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_hook.c | 4 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_laplaciandeform.c | 7 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_laplaciansmooth.c | 6 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_lattice.c | 7 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_meshdeform.c | 8 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_shrinkwrap.c | 13 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_simpledeform.c | 15 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_smooth.c | 16 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_warp.c | 14 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_wave.c | 6 |
13 files changed, 51 insertions, 63 deletions
diff --git a/source/blender/modifiers/intern/MOD_cast.c b/source/blender/modifiers/intern/MOD_cast.c index c80bbe5cc96..e79cceb118c 100644 --- a/source/blender/modifiers/intern/MOD_cast.c +++ b/source/blender/modifiers/intern/MOD_cast.c @@ -431,10 +431,9 @@ static void deformVerts( CastModifierData *cmd = (CastModifierData *)md; Mesh *mesh_src = NULL; - if (ctx->object->type == OB_MESH) { + if (ctx->object->type == OB_MESH && cmd->defgrp_name[0] != '\0') { /* mesh_src is only needed for vgroups. */ mesh_src = MOD_deform_mesh_eval_get(ctx->object, NULL, mesh, NULL, numVerts, false, false); - BLI_assert(mesh_src->totvert == numVerts); } if (cmd->type == MOD_CAST_TYPE_CUBOID) { diff --git a/source/blender/modifiers/intern/MOD_curve.c b/source/blender/modifiers/intern/MOD_curve.c index 6a0b276f0d5..e9a3dd3810b 100644 --- a/source/blender/modifiers/intern/MOD_curve.c +++ b/source/blender/modifiers/intern/MOD_curve.c @@ -114,10 +114,9 @@ static void deformVerts( CurveModifierData *cmd = (CurveModifierData *) md; Mesh *mesh_src = NULL; - if (ctx->object->type == OB_MESH) { + if (ctx->object->type == OB_MESH && cmd->name[0] != '\0') { /* mesh_src is only needed for vgroups. */ mesh_src = MOD_deform_mesh_eval_get(ctx->object, NULL, mesh, NULL, numVerts, false, false); - BLI_assert(mesh_src->totvert == numVerts); } struct MDeformVert *dvert = NULL; @@ -143,11 +142,9 @@ static void deformVertsEM( { Mesh *mesh_src = MOD_deform_mesh_eval_get(ctx->object, em, mesh, NULL, numVerts, false, false); - BLI_assert(mesh_src->totvert == numVerts); - deformVerts(md, ctx, mesh_src, vertexCos, numVerts); - if (mesh_src != mesh) { + if (!ELEM(mesh_src, NULL, mesh)) { BKE_id_free(NULL, mesh_src); } } diff --git a/source/blender/modifiers/intern/MOD_displace.c b/source/blender/modifiers/intern/MOD_displace.c index 9345733ea77..082c8f9c589 100644 --- a/source/blender/modifiers/intern/MOD_displace.c +++ b/source/blender/modifiers/intern/MOD_displace.c @@ -378,11 +378,9 @@ static void deformVerts( { Mesh *mesh_src = MOD_deform_mesh_eval_get(ctx->object, NULL, mesh, NULL, numVerts, false, false); - BLI_assert(mesh_src->totvert == numVerts); - displaceModifier_do((DisplaceModifierData *)md, ctx, mesh_src, vertexCos, numVerts); - if (mesh_src != mesh) { + if (!ELEM(mesh_src, NULL, mesh)) { BKE_id_free(NULL, mesh_src); } } @@ -393,11 +391,9 @@ static void deformVertsEM( { Mesh *mesh_src = MOD_deform_mesh_eval_get(ctx->object, editData, mesh, NULL, numVerts, false, false); - BLI_assert(mesh_src->totvert == numVerts); - displaceModifier_do((DisplaceModifierData *)md, ctx, mesh_src, vertexCos, numVerts); - if (mesh_src != mesh) { + if (!ELEM(mesh_src, NULL, mesh)) { BKE_id_free(NULL, mesh_src); } } diff --git a/source/blender/modifiers/intern/MOD_hook.c b/source/blender/modifiers/intern/MOD_hook.c index 186ad2dc352..9d893630b94 100644 --- a/source/blender/modifiers/intern/MOD_hook.c +++ b/source/blender/modifiers/intern/MOD_hook.c @@ -358,7 +358,7 @@ static void deformVerts( deformVerts_do(hmd, ctx->object, mesh_src, vertexCos, numVerts); - if (mesh_src != mesh) { + if (!ELEM(mesh_src, NULL, mesh)) { BKE_id_free(NULL, mesh_src); } } @@ -373,7 +373,7 @@ static void deformVertsEM( deformVerts_do(hmd, ctx->object, mesh_src, vertexCos, numVerts); - if (mesh_src != mesh) { + if (!ELEM(mesh_src, NULL, mesh)) { BKE_id_free(NULL, mesh_src); } } diff --git a/source/blender/modifiers/intern/MOD_laplaciandeform.c b/source/blender/modifiers/intern/MOD_laplaciandeform.c index 39085cc4588..ba45e6bf848 100644 --- a/source/blender/modifiers/intern/MOD_laplaciandeform.c +++ b/source/blender/modifiers/intern/MOD_laplaciandeform.c @@ -737,7 +737,8 @@ static void deformVerts( Mesh *mesh_src = MOD_deform_mesh_eval_get(ctx->object, NULL, mesh, NULL, numVerts, false, false); LaplacianDeformModifier_do((LaplacianDeformModifierData *)md, ctx->object, mesh_src, vertexCos, numVerts); - if (mesh_src != mesh) { + + if (!ELEM(mesh_src, NULL, mesh)) { BKE_id_free(NULL, mesh_src); } } @@ -747,9 +748,11 @@ static void deformVertsEM( Mesh *mesh, float (*vertexCos)[3], int numVerts) { Mesh *mesh_src = MOD_deform_mesh_eval_get(ctx->object, editData, mesh, NULL, numVerts, false, false); + LaplacianDeformModifier_do((LaplacianDeformModifierData *)md, ctx->object, mesh_src, vertexCos, numVerts); - if (mesh_src != mesh) { + + if (!ELEM(mesh_src, NULL, mesh)) { BKE_id_free(NULL, mesh_src); } } diff --git a/source/blender/modifiers/intern/MOD_laplaciansmooth.c b/source/blender/modifiers/intern/MOD_laplaciansmooth.c index 66c31b60bbd..1acec1d8b7a 100644 --- a/source/blender/modifiers/intern/MOD_laplaciansmooth.c +++ b/source/blender/modifiers/intern/MOD_laplaciansmooth.c @@ -512,8 +512,9 @@ static void deformVerts( laplaciansmoothModifier_do((LaplacianSmoothModifierData *)md, ctx->object, mesh_src, vertexCos, numVerts); - if (mesh_src != mesh) + if (!ELEM(mesh_src, NULL, mesh)) { BKE_id_free(NULL, mesh_src); + } } static void deformVertsEM( @@ -530,8 +531,9 @@ static void deformVertsEM( laplaciansmoothModifier_do((LaplacianSmoothModifierData *)md, ctx->object, mesh_src, vertexCos, numVerts); - if (mesh_src != mesh) + if (!ELEM(mesh_src, NULL, mesh)) { BKE_id_free(NULL, mesh_src); + } } diff --git a/source/blender/modifiers/intern/MOD_lattice.c b/source/blender/modifiers/intern/MOD_lattice.c index 0391924f37e..c183f54098c 100644 --- a/source/blender/modifiers/intern/MOD_lattice.c +++ b/source/blender/modifiers/intern/MOD_lattice.c @@ -107,9 +107,10 @@ static void deformVerts( lattice_deform_verts(lmd->object, ctx->object, mesh_src, vertexCos, numVerts, lmd->name, lmd->strength); - if (mesh_src != mesh) { + if (!ELEM(mesh_src, NULL, mesh)) { BKE_id_free(NULL, mesh_src); - }} + } +} static void deformVertsEM( ModifierData *md, const ModifierEvalContext *ctx, struct BMEditMesh *em, @@ -119,7 +120,7 @@ static void deformVertsEM( deformVerts(md, ctx, mesh_src, vertexCos, numVerts); - if (mesh_src != mesh) { + if (!ELEM(mesh_src, NULL, mesh)) { BKE_id_free(NULL, mesh_src); } } diff --git a/source/blender/modifiers/intern/MOD_meshdeform.c b/source/blender/modifiers/intern/MOD_meshdeform.c index b5e9d74c03c..9af76916788 100644 --- a/source/blender/modifiers/intern/MOD_meshdeform.c +++ b/source/blender/modifiers/intern/MOD_meshdeform.c @@ -421,23 +421,23 @@ static void deformVerts( meshdeformModifier_do(md, ctx, mesh_src, vertexCos, numVerts); - if (mesh_src && mesh_src != mesh) { + if (!ELEM(mesh_src, NULL, mesh)) { BKE_id_free(NULL, mesh_src); } } static void deformVertsEM( ModifierData *md, const ModifierEvalContext *ctx, - struct BMEditMesh *UNUSED(editData), + struct BMEditMesh *editData, Mesh *mesh, float (*vertexCos)[3], int numVerts) { - Mesh *mesh_src = MOD_deform_mesh_eval_get(ctx->object, NULL, mesh, NULL, numVerts, false, false); + Mesh *mesh_src = MOD_deform_mesh_eval_get(ctx->object, editData, mesh, NULL, numVerts, false, false); meshdeformModifier_do(md, ctx, mesh_src, vertexCos, numVerts); - if (mesh_src && mesh_src != mesh) { + if (!ELEM(mesh_src, NULL, mesh)) { BKE_id_free(NULL, mesh_src); } } diff --git a/source/blender/modifiers/intern/MOD_shrinkwrap.c b/source/blender/modifiers/intern/MOD_shrinkwrap.c index 3f2e9adbe46..dd4530b066f 100644 --- a/source/blender/modifiers/intern/MOD_shrinkwrap.c +++ b/source/blender/modifiers/intern/MOD_shrinkwrap.c @@ -112,15 +112,12 @@ static void deformVerts( if (ctx->object->type == OB_MESH) { /* mesh_src is only needed for vgroups. */ mesh_src = MOD_deform_mesh_eval_get(ctx->object, NULL, mesh, NULL, numVerts, false, false); - BLI_assert(mesh_src->totvert == numVerts); } struct MDeformVert *dvert = NULL; int defgrp_index = -1; MOD_get_vgroup(ctx->object, mesh_src, swmd->vgroup_name, &dvert, &defgrp_index); - BLI_assert(mesh_src == NULL || mesh_src->totvert == numVerts); - shrinkwrapModifier_deform(swmd, scene, ctx->object, mesh_src, dvert, defgrp_index, vertexCos, numVerts); if (!ELEM(mesh_src, NULL, mesh)) { @@ -135,13 +132,7 @@ static void deformVertsEM( { ShrinkwrapModifierData *swmd = (ShrinkwrapModifierData *)md; struct Scene *scene = DEG_get_evaluated_scene(ctx->depsgraph); - Mesh *mesh_src = mesh; - - if (mesh_src == NULL) { - mesh_src = BKE_mesh_from_bmesh_for_eval_nomain(editData->bm, 0); - } - - BLI_assert(mesh_src->totvert == numVerts); + Mesh *mesh_src = MOD_deform_mesh_eval_get(ctx->object, editData, mesh, NULL, numVerts, false, false); struct MDeformVert *dvert = NULL; int defgrp_index = -1; @@ -149,7 +140,7 @@ static void deformVertsEM( shrinkwrapModifier_deform(swmd, scene, ctx->object, mesh_src, dvert, defgrp_index, vertexCos, numVerts); - if (!mesh) { + if (!ELEM(mesh_src, NULL, mesh)) { BKE_id_free(NULL, mesh_src); } } diff --git a/source/blender/modifiers/intern/MOD_simpledeform.c b/source/blender/modifiers/intern/MOD_simpledeform.c index ffcf7767ddf..cab1a24fe85 100644 --- a/source/blender/modifiers/intern/MOD_simpledeform.c +++ b/source/blender/modifiers/intern/MOD_simpledeform.c @@ -388,10 +388,9 @@ static void deformVerts( SimpleDeformModifierData *sdmd = (SimpleDeformModifierData *)md; Mesh *mesh_src = NULL; - if (ctx->object->type == OB_MESH) { + if (ctx->object->type == OB_MESH && sdmd->vgroup_name[0] != '\0') { /* mesh_src is only needed for vgroups. */ mesh_src = MOD_deform_mesh_eval_get(ctx->object, NULL, mesh, NULL, numVerts, false, false); - BLI_assert(mesh_src->totvert == numVerts); } SimpleDeformModifier_do(sdmd, ctx->object, mesh_src, vertexCos, numVerts); @@ -408,11 +407,17 @@ static void deformVertsEM( float (*vertexCos)[3], int numVerts) { - Mesh *mesh_src = MOD_deform_mesh_eval_get(ctx->object, editData, mesh, NULL, numVerts, 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 && sdmd->vgroup_name[0] != '\0') { + /* mesh_src is only needed for vgroups. */ + mesh_src = MOD_deform_mesh_eval_get(ctx->object, editData, mesh, NULL, numVerts, false, false); + } - 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); } } diff --git a/source/blender/modifiers/intern/MOD_smooth.c b/source/blender/modifiers/intern/MOD_smooth.c index e2434985230..8b62c2c1d7d 100644 --- a/source/blender/modifiers/intern/MOD_smooth.c +++ b/source/blender/modifiers/intern/MOD_smooth.c @@ -216,11 +216,8 @@ static void deformVerts( SmoothModifierData *smd = (SmoothModifierData *)md; Mesh *mesh_src = NULL; - if (ctx->object->type == OB_MESH) { - /* mesh_src is needed for vgroups, and taking edges into account. */ - mesh_src = MOD_deform_mesh_eval_get(ctx->object, NULL, mesh, NULL, numVerts, false, false); - BLI_assert(mesh_src->totvert == numVerts); - } + /* mesh_src is needed for vgroups, and taking edges into account. */ + mesh_src = MOD_deform_mesh_eval_get(ctx->object, NULL, mesh, NULL, numVerts, false, false); smoothModifier_do(smd, ctx->object, mesh_src, vertexCos, numVerts); @@ -234,13 +231,10 @@ static void deformVertsEM( Mesh *mesh, float (*vertexCos)[3], int numVerts) { SmoothModifierData *smd = (SmoothModifierData *)md; - Mesh *mesh_src = mesh; - - if (mesh_src == NULL) { - mesh_src = BKE_mesh_from_bmesh_for_eval_nomain(editData->bm, 0); - } + Mesh *mesh_src = NULL; - BLI_assert(mesh_src->totvert == numVerts); + /* mesh_src is needed for vgroups, and taking edges into account. */ + mesh_src = MOD_deform_mesh_eval_get(ctx->object, editData, mesh, NULL, numVerts, false, false); smoothModifier_do(smd, ctx->object, mesh_src, vertexCos, numVerts); 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)) { diff --git a/source/blender/modifiers/intern/MOD_wave.c b/source/blender/modifiers/intern/MOD_wave.c index 9f864063c7b..0849b268f7f 100644 --- a/source/blender/modifiers/intern/MOD_wave.c +++ b/source/blender/modifiers/intern/MOD_wave.c @@ -314,8 +314,9 @@ static void deformVerts( waveModifier_do(wmd, ctx->depsgraph, ctx->object, mesh_src, vertexCos, numVerts); - if (mesh_src != mesh) + if (!ELEM(mesh_src, NULL, mesh)) { BKE_id_free(NULL, mesh_src); + } } static void deformVertsEM( @@ -333,8 +334,9 @@ static void deformVertsEM( waveModifier_do(wmd, ctx->depsgraph, ctx->object, mesh_src, vertexCos, numVerts); - if (mesh_src != mesh) + if (!ELEM(mesh_src, NULL, mesh)) { BKE_id_free(NULL, mesh_src); + } } |