diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-08-18 15:48:35 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-08-18 15:48:35 +0400 |
commit | 626e6cf99e68e09d3cb349c731b7c424683c3d68 (patch) | |
tree | 53a62a340a7fcf86c729ed84074bb71b7130ccc2 | |
parent | 7e2f557dbacf5c5604935d52b7856b0fdd3ed7c1 (diff) |
skip allocating texture coords for the displace modifier when they are unused.
-rw-r--r-- | source/blender/modifiers/intern/MOD_displace.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/source/blender/modifiers/intern/MOD_displace.c b/source/blender/modifiers/intern/MOD_displace.c index 21cbc2b766c..1d84dbc78f9 100644 --- a/source/blender/modifiers/intern/MOD_displace.c +++ b/source/blender/modifiers/intern/MOD_displace.c @@ -183,11 +183,16 @@ static void displaceModifier_do( mvert = CDDM_get_verts(dm); modifier_get_vgroup(ob, dm, dmd->defgrp_name, &dvert, &defgrp_index); - tex_co = MEM_callocN(sizeof(*tex_co) * numVerts, - "displaceModifier_do tex_co"); - get_texture_coords((MappingInfoModifierData *)dmd, ob, dm, vertexCos, tex_co, numVerts); + if (dmd->texture) { + tex_co = MEM_callocN(sizeof(*tex_co) * numVerts, + "displaceModifier_do tex_co"); + get_texture_coords((MappingInfoModifierData *)dmd, ob, dm, vertexCos, tex_co, numVerts); - modifier_init_texture(dmd->modifier.scene, dmd->texture); + modifier_init_texture(dmd->modifier.scene, dmd->texture); + } + else { + tex_co = NULL; + } for (i = 0; i < numVerts; i++) { TexResult texres; @@ -236,7 +241,9 @@ static void displaceModifier_do( } } - MEM_freeN(tex_co); + if (tex_co) { + MEM_freeN(tex_co); + } } static void deformVerts(ModifierData *md, Object *ob, |