forked from bartvdbraak/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.
This commit is contained in:
parent
df5af02dec
commit
8a46e46d2c
@ -46,6 +46,7 @@
|
|||||||
#include "BLI_memarena.h"
|
#include "BLI_memarena.h"
|
||||||
#include "BLI_utildefines.h"
|
#include "BLI_utildefines.h"
|
||||||
#include "BLI_ghash.h"
|
#include "BLI_ghash.h"
|
||||||
|
#include "BLI_cellalloc.h"
|
||||||
|
|
||||||
#include "IMB_imbuf.h"
|
#include "IMB_imbuf.h"
|
||||||
#include "IMB_imbuf_types.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= &me->dvert[index];
|
||||||
MDeformVert dv_test= {NULL};
|
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.flag = dv->flag;
|
||||||
dv_test.totweight = dv->totweight;
|
dv_test.totweight = dv->totweight;
|
||||||
/* do not multi-paint if a locked group is selected or the active group is locked
|
/* 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(tdw->weight != oldw) {
|
||||||
if(neww > oldw) {
|
if(neww > oldw) {
|
||||||
if(tdw->weight <= oldw) {
|
if(tdw->weight <= oldw) {
|
||||||
MEM_freeN(dv_test.dw);
|
BLI_cellalloc_free(dv_test.dw);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if(tdw->weight >= oldw) {
|
if(tdw->weight >= oldw) {
|
||||||
MEM_freeN(dv_test.dw);
|
BLI_cellalloc_free(dv_test.dw);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MEM_freeN(dv_test.dw);
|
BLI_cellalloc_free(dv_test.dw);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1677,7 +1678,7 @@ static void do_weight_paint_vertex( /* vars which remain the same for every vert
|
|||||||
|
|
||||||
/* setup multi-paint */
|
/* setup multi-paint */
|
||||||
if(wpi->defbase_tot_sel > 1 && wpi->do_multipaint) {
|
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.flag = dv->flag;
|
||||||
dv_copy.totweight = dv->totweight;
|
dv_copy.totweight = dv->totweight;
|
||||||
tdw = dw;
|
tdw = dw;
|
||||||
@ -1731,7 +1732,7 @@ static void do_weight_paint_vertex( /* vars which remain the same for every vert
|
|||||||
oldChange = 0;
|
oldChange = 0;
|
||||||
}
|
}
|
||||||
if(dv_copy.dw) {
|
if(dv_copy.dw) {
|
||||||
MEM_freeN(dv_copy.dw);
|
BLI_cellalloc_free(dv_copy.dw);
|
||||||
}
|
}
|
||||||
#if 0
|
#if 0
|
||||||
/* dv may have been altered greatly */
|
/* dv may have been altered greatly */
|
||||||
|
@ -32,6 +32,7 @@
|
|||||||
#include "BLI_rand.h"
|
#include "BLI_rand.h"
|
||||||
#include "BLI_string.h"
|
#include "BLI_string.h"
|
||||||
#include "BLI_utildefines.h"
|
#include "BLI_utildefines.h"
|
||||||
|
#include "BLI_cellalloc.h"
|
||||||
|
|
||||||
#include "DNA_color_types.h" /* CurveMapping. */
|
#include "DNA_color_types.h" /* CurveMapping. */
|
||||||
#include "DNA_mesh_types.h"
|
#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. */
|
* groups have already been checked, so this has to remain low level. */
|
||||||
MDeformWeight *newdw;
|
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) {
|
if(dv->dw) {
|
||||||
memcpy(newdw, dv->dw, sizeof(MDeformWeight)*dv->totweight);
|
memcpy(newdw, dv->dw, sizeof(MDeformWeight)*dv->totweight);
|
||||||
MEM_freeN(dv->dw);
|
BLI_cellalloc_free(dv->dw);
|
||||||
}
|
}
|
||||||
dv->dw = newdw;
|
dv->dw = newdw;
|
||||||
dv->dw[dv->totweight].weight = weight;
|
dv->dw[dv->totweight].weight = weight;
|
||||||
|
Loading…
Reference in New Issue
Block a user