diff options
Diffstat (limited to 'source/blender/modifiers')
-rw-r--r-- | source/blender/modifiers/intern/MOD_cast.c | 22 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_shrinkwrap.c | 11 |
2 files changed, 24 insertions, 9 deletions
diff --git a/source/blender/modifiers/intern/MOD_cast.c b/source/blender/modifiers/intern/MOD_cast.c index b562152d906..ed4a53ba2f3 100644 --- a/source/blender/modifiers/intern/MOD_cast.c +++ b/source/blender/modifiers/intern/MOD_cast.c @@ -153,7 +153,9 @@ static void sphere_do(CastModifierData *cmd, /* 3) if we were given a vertex group name, * only those vertices should be affected */ - MOD_get_vgroup(ob, mesh, cmd->defgrp_name, &dvert, &defgrp_index); + if (cmd->defgrp_name[0] != '\0') { + MOD_get_vgroup(ob, mesh, cmd->defgrp_name, &dvert, &defgrp_index); + } if (flag & MOD_CAST_SIZE_FROM_RADIUS) { len = cmd->radius; @@ -244,11 +246,12 @@ static void cuboid_do(CastModifierData *cmd, int numVerts) { MDeformVert *dvert = NULL; + int defgrp_index; const bool invert_vgroup = (cmd->flag & MOD_CAST_INVERT_VGROUP) != 0; Object *ctrl_ob = NULL; - int i, defgrp_index; + int i; bool has_radius = false; short flag; float fac = cmd->fac; @@ -273,7 +276,9 @@ static void cuboid_do(CastModifierData *cmd, /* 3) if we were given a vertex group name, * only those vertices should be affected */ - MOD_get_vgroup(ob, mesh, cmd->defgrp_name, &dvert, &defgrp_index); + if (cmd->defgrp_name[0] != '\0') { + MOD_get_vgroup(ob, mesh, cmd->defgrp_name, &dvert, &defgrp_index); + } if (ctrl_ob) { if (flag & MOD_CAST_USE_OB_TRANSFORM) { @@ -491,10 +496,15 @@ static void deformVertsEM(ModifierData *md, int numVerts) { CastModifierData *cmd = (CastModifierData *)md; - Mesh *mesh_src = MOD_deform_mesh_eval_get( - ctx->object, editData, mesh, NULL, numVerts, false, false); + Mesh *mesh_src = NULL; - BLI_assert(mesh_src->totvert == numVerts); + if (cmd->defgrp_name[0] != '\0') { + mesh_src = MOD_deform_mesh_eval_get(ctx->object, editData, mesh, NULL, numVerts, false, false); + } + + if (mesh_src) { + BLI_assert(mesh_src->totvert == numVerts); + } if (cmd->type == MOD_CAST_TYPE_CUBOID) { cuboid_do(cmd, ctx, ctx->object, mesh_src, vertexCos, numVerts); diff --git a/source/blender/modifiers/intern/MOD_shrinkwrap.c b/source/blender/modifiers/intern/MOD_shrinkwrap.c index e76731caae2..842ec46f364 100644 --- a/source/blender/modifiers/intern/MOD_shrinkwrap.c +++ b/source/blender/modifiers/intern/MOD_shrinkwrap.c @@ -136,12 +136,17 @@ static void deformVertsEM(ModifierData *md, { ShrinkwrapModifierData *swmd = (ShrinkwrapModifierData *)md; struct Scene *scene = DEG_get_evaluated_scene(ctx->depsgraph); - Mesh *mesh_src = MOD_deform_mesh_eval_get( - ctx->object, editData, mesh, NULL, numVerts, false, false); + Mesh *mesh_src = NULL; + + if ((swmd->vgroup_name[0] != '\0') || (swmd->shrinkType == MOD_SHRINKWRAP_PROJECT)) { + mesh_src = MOD_deform_mesh_eval_get(ctx->object, editData, mesh, NULL, numVerts, false, false); + } struct MDeformVert *dvert = NULL; int defgrp_index = -1; - MOD_get_vgroup(ctx->object, mesh_src, swmd->vgroup_name, &dvert, &defgrp_index); + if (swmd->vgroup_name[0] != '\0') { + MOD_get_vgroup(ctx->object, mesh_src, swmd->vgroup_name, &dvert, &defgrp_index); + } shrinkwrapModifier_deform( swmd, ctx, scene, ctx->object, mesh_src, dvert, defgrp_index, vertexCos, numVerts); |