[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [49983] trunk/blender/source/blender/ modifiers/intern/MOD_displace.c: skip allocating texture coords for the displace modifier when they are unused .

Campbell Barton ideasman42 at gmail.com
Sat Aug 18 13:48:36 CEST 2012


Revision: 49983
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=49983
Author:   campbellbarton
Date:     2012-08-18 11:48:35 +0000 (Sat, 18 Aug 2012)
Log Message:
-----------
skip allocating texture coords for the displace modifier when they are unused.

Modified Paths:
--------------
    trunk/blender/source/blender/modifiers/intern/MOD_displace.c

Modified: trunk/blender/source/blender/modifiers/intern/MOD_displace.c
===================================================================
--- trunk/blender/source/blender/modifiers/intern/MOD_displace.c	2012-08-18 06:06:35 UTC (rev 49982)
+++ trunk/blender/source/blender/modifiers/intern/MOD_displace.c	2012-08-18 11:48:35 UTC (rev 49983)
@@ -183,11 +183,16 @@
 	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 @@
 		}
 	}
 
-	MEM_freeN(tex_co);
+	if (tex_co) {
+		MEM_freeN(tex_co);
+	}
 }
 
 static void deformVerts(ModifierData *md, Object *ob,




More information about the Bf-blender-cvs mailing list