From 8a46e46d2c537401dee1d8186b10a7e69138c62a Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 30 Nov 2011 11:16:33 +0000 Subject: [PATCH] cellalloc wasnt being used for deform weights when it should have been, checked all uses of MDeformWeight's to make sure this is ok. --- source/blender/editors/sculpt_paint/paint_vertex.c | 13 +++++++------ source/blender/modifiers/intern/MOD_weightvg_util.c | 5 +++-- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index a988fa6db02..a2ae801e862 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -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 @@ static int apply_mp_locks_normalize(Mesh *me, const WeightPaintInfo *wpi, 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 @@ static int apply_mp_locks_normalize(Mesh *me, const WeightPaintInfo *wpi, 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 @@ static void do_weight_paint_vertex( /* vars which remain the same for every vert /* 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 @@ static void do_weight_paint_vertex( /* vars which remain the same for every vert 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 */ diff --git a/source/blender/modifiers/intern/MOD_weightvg_util.c b/source/blender/modifiers/intern/MOD_weightvg_util.c index e206000f41d..afaa29e9175 100644 --- a/source/blender/modifiers/intern/MOD_weightvg_util.c +++ b/source/blender/modifiers/intern/MOD_weightvg_util.c @@ -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 @@ static void defvert_add_to_group(MDeformVert *dv, int defgrp_idx, const float we * 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;