Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <montagne29@wanadoo.fr>2018-11-26 13:30:46 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2018-11-26 23:07:50 +0300
commit8cd5edf8508a00df9791f7b0795b23c74e00c449 (patch)
tree1883be27017f0c76641d2a0eb43a076af70770da /source/blender/modifiers
parentc1adf938e6c8ecaec805f4cf95c73480de1bf980 (diff)
MOD_cast: do not compute mesh when not needed.
This modifier only uses mesh to get vgroup, which is only needed in case modified object is indeed a mesh! Building a mesh from curve here is not only useless and time-consuming, it will also easily fail the assert about same number of vertices! Also fixes crash when used on lattice. Related to T57972.
Diffstat (limited to 'source/blender/modifiers')
-rw-r--r--source/blender/modifiers/intern/MOD_cast.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/source/blender/modifiers/intern/MOD_cast.c b/source/blender/modifiers/intern/MOD_cast.c
index 74e19f3254a..959f77b0718 100644
--- a/source/blender/modifiers/intern/MOD_cast.c
+++ b/source/blender/modifiers/intern/MOD_cast.c
@@ -429,9 +429,13 @@ static void deformVerts(
int numVerts)
{
CastModifierData *cmd = (CastModifierData *)md;
- Mesh *mesh_src = MOD_get_mesh_eval(ctx->object, NULL, mesh, NULL, false, false);
+ Mesh *mesh_src = NULL;
- BLI_assert(mesh_src->totvert == 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 (cmd->type == MOD_CAST_TYPE_CUBOID) {
cuboid_do(cmd, ctx->object, mesh_src, vertexCos, numVerts);
@@ -440,7 +444,7 @@ static void deformVerts(
sphere_do(cmd, ctx->object, mesh_src, vertexCos, numVerts);
}
- if (mesh_src != mesh) {
+ if (!ELEM(mesh_src, NULL, mesh)) {
BKE_id_free(NULL, mesh_src);
}
}