[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [42295] branches/bmesh/blender/source/ blender: cellalloc wasnt being used for deform weights when it should have been, checked all uses of MDeformWeight's to make sure this is ok.

Campbell Barton ideasman42 at gmail.com
Wed Nov 30 12:16:40 CET 2011


Revision: 42295
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=42295
Author:   campbellbarton
Date:     2011-11-30 11:16:33 +0000 (Wed, 30 Nov 2011)
Log Message:
-----------
cellalloc wasnt being used for deform weights when it should have been, checked all uses of MDeformWeight's to make sure this is ok.

Modified Paths:
--------------
    branches/bmesh/blender/source/blender/editors/sculpt_paint/paint_vertex.c
    branches/bmesh/blender/source/blender/modifiers/intern/MOD_weightvg_util.c

Modified: branches/bmesh/blender/source/blender/editors/sculpt_paint/paint_vertex.c
===================================================================
--- branches/bmesh/blender/source/blender/editors/sculpt_paint/paint_vertex.c	2011-11-30 11:04:57 UTC (rev 42294)
+++ branches/bmesh/blender/source/blender/editors/sculpt_paint/paint_vertex.c	2011-11-30 11:16:33 UTC (rev 42295)
@@ -46,6 +46,7 @@
 #include "BLI_memarena.h"
 #include "BLI_utildefines.h"
 #include "BLI_ghash.h"
+#include "BLI_cellalloc.h"
 
 #include "IMB_imbuf.h"
 #include "IMB_imbuf_types.h"
@@ -1546,7 +1547,7 @@
 	MDeformVert *dv= &me->dvert[index];
 	MDeformVert dv_test= {NULL};
 
-	dv_test.dw= MEM_dupallocN(dv->dw);
+	dv_test.dw= BLI_cellalloc_dupalloc(dv->dw);
 	dv_test.flag = dv->flag;
 	dv_test.totweight = dv->totweight;
 	/* do not multi-paint if a locked group is selected or the active group is locked
@@ -1574,19 +1575,19 @@
 		if(tdw->weight != oldw) {
 			if(neww > oldw) {
 				if(tdw->weight <= oldw) {
-					MEM_freeN(dv_test.dw);
+					BLI_cellalloc_free(dv_test.dw);
 					return TRUE;
 				}
 			}
 			else {
 				if(tdw->weight >= oldw) {
-					MEM_freeN(dv_test.dw);
+					BLI_cellalloc_free(dv_test.dw);
 					return TRUE;
 				}
 			}
 		}
 	}
-	MEM_freeN(dv_test.dw);
+	BLI_cellalloc_free(dv_test.dw);
 	return FALSE;
 }
 
@@ -1677,7 +1678,7 @@
 		
 		/* setup multi-paint */
 		if(wpi->defbase_tot_sel > 1 && wpi->do_multipaint) {
-			dv_copy.dw= MEM_dupallocN(dv->dw);
+			dv_copy.dw= BLI_cellalloc_dupalloc(dv->dw);
 			dv_copy.flag = dv->flag;
 			dv_copy.totweight = dv->totweight;
 			tdw = dw;
@@ -1731,7 +1732,7 @@
 			oldChange = 0;
 		}
 		if(dv_copy.dw) {
-			MEM_freeN(dv_copy.dw);
+			BLI_cellalloc_free(dv_copy.dw);
 		}
 #if 0
 		/* dv may have been altered greatly */

Modified: branches/bmesh/blender/source/blender/modifiers/intern/MOD_weightvg_util.c
===================================================================
--- branches/bmesh/blender/source/blender/modifiers/intern/MOD_weightvg_util.c	2011-11-30 11:04:57 UTC (rev 42294)
+++ branches/bmesh/blender/source/blender/modifiers/intern/MOD_weightvg_util.c	2011-11-30 11:16:33 UTC (rev 42295)
@@ -32,6 +32,7 @@
 #include "BLI_rand.h"
 #include "BLI_string.h"
 #include "BLI_utildefines.h"
+#include "BLI_cellalloc.h"
 
 #include "DNA_color_types.h"      /* CurveMapping. */
 #include "DNA_mesh_types.h"
@@ -229,10 +230,10 @@
 	 * groups have already been checked, so this has to remain low level. */
 	MDeformWeight *newdw;
 
-	newdw = MEM_callocN(sizeof(MDeformWeight)*(dv->totweight+1), "defvert_add_to group, new deformWeight");
+	newdw = BLI_cellalloc_calloc(sizeof(MDeformWeight)*(dv->totweight+1), "defvert_add_to group, new deformWeight");
 	if(dv->dw) {
 		memcpy(newdw, dv->dw, sizeof(MDeformWeight)*dv->totweight);
-		MEM_freeN(dv->dw);
+		BLI_cellalloc_free(dv->dw);
 	}
 	dv->dw = newdw;
 	dv->dw[dv->totweight].weight = weight;




More information about the Bf-blender-cvs mailing list