svn merge ^/trunk/blender -r42290:42292
[blender.git] / source / blender / blenkernel / intern / deform.c
index 1f09d98d697c359d92ed4641a5bcd6371c03095a..49ca4e139cc8770d14c8ad10aa34aef3d8170b00 100644 (file)
@@ -45,6 +45,9 @@
 #include "BLI_utildefines.h"
 
 
+#include "BLI_cellalloc.h"
+
+
 void defgroup_copy_list(ListBase *outbase, ListBase *inbase)
 {
        bDeformGroup *defgroup, *defgroupn;
@@ -83,10 +86,10 @@ void defvert_copy(MDeformVert *dvert_dst, const MDeformVert *dvert_src)
        }
        else {
                if (dvert_dst->dw)
-                       MEM_freeN(dvert_dst->dw);
+                       BLI_cellalloc_free(dvert_dst->dw);
 
                if (dvert_src->totweight)
-                       dvert_dst->dw= MEM_dupallocN(dvert_src->dw);
+                       dvert_dst->dw= BLI_cellalloc_dupalloc(dvert_src->dw);
                else
                        dvert_dst->dw= NULL;
 
@@ -558,10 +561,10 @@ MDeformWeight *defvert_verify_index(MDeformVert *dvert, const int defgroup)
        if (dw_new)
                return dw_new;
 
-       dw_new= MEM_callocN(sizeof(MDeformWeight)*(dvert->totweight+1), "deformWeight");
+       dw_new= BLI_cellalloc_calloc(sizeof(MDeformWeight)*(dvert->totweight+1), "deformWeight");
        if (dvert->dw) {
                memcpy(dw_new, dvert->dw, sizeof(MDeformWeight)*dvert->totweight);
-               MEM_freeN(dvert->dw);
+               BLI_cellalloc_free(dvert->dw);
        }
        dvert->dw= dw_new;
        dw_new += dvert->totweight;
@@ -603,17 +606,17 @@ void defvert_remove_index(MDeformVert *dvert, int defgroup, MDeformWeight *dw)
         * this deform weight, and reshuffle the others.
         */
        if (dvert->totweight) {
-               dw_new = MEM_mallocN(sizeof(MDeformWeight)*(dvert->totweight), __func__);
+               dw_new = BLI_cellalloc_malloc(sizeof(MDeformWeight)*(dvert->totweight), __func__);
                if (dvert->dw){
                        memcpy(dw_new, dvert->dw, sizeof(MDeformWeight)*i);
                        memcpy(dw_new+i, dvert->dw+i+1, sizeof(MDeformWeight)*(dvert->totweight-i));
-                       MEM_freeN(dvert->dw);
+                       BLI_cellalloc_free(dvert->dw);
                }
                dvert->dw = dw_new;
        }
        else {
                /* If there are no other deform weights left then just remove this one. */
-               MEM_freeN(dvert->dw);
+               BLI_cellalloc_free(dvert->dw);
                dvert->dw = NULL;
        }
 }