Sculpt IPMask: Free ghash when finishing

This commit is contained in:
Pablo Dobarro 2021-02-26 01:31:49 +01:00
parent d8a4ebb068
commit 4e8c430c6e
3 changed files with 15 additions and 5 deletions

View File

@ -345,11 +345,6 @@ typedef enum MaskFilterStepDirectionType {
MASK_FILTER_STEP_DIRECTION_BACKWARD,
} MaskFilterStepDirectionType;
typedef struct MaskFilterDeltaStep {
int totelem;
int *index;
float *delta;
} MaskFilterDeltaStep;
/* Grown/Shrink vertex callbacks. */
static float sculpt_ipmask_vertex_grow_cb(SculptSession *ss, const int vertex, float *current_mask) {

View File

@ -174,6 +174,12 @@ void SCULPT_filter_cache_init(bContext *C, Object *ob, Sculpt *sd, const int und
copy_m4_m4(ss->filter_cache->viewmat_inv, vc.rv3d->viewinv);
}
static void mask_filter_delta_step_free(void *delta_step_free) {
MaskFilterDeltaStep *delta_step = (MaskFilterDeltaStep *)delta_step_free;
MEM_SAFE_FREE(delta_step->delta);
MEM_SAFE_FREE(delta_step->index);
MEM_SAFE_FREE(delta_step);
}
void SCULPT_filter_cache_free(SculptSession *ss)
{
if (ss->filter_cache->cloth_sim) {
@ -182,6 +188,9 @@ void SCULPT_filter_cache_free(SculptSession *ss)
if (ss->filter_cache->automasking) {
SCULPT_automasking_cache_free(ss->filter_cache->automasking);
}
if (ss->filter_cache->mask_delta_step) {
BLI_ghash_free(ss->filter_cache->mask_delta_step, NULL, mask_filter_delta_step_free);
}
MEM_SAFE_FREE(ss->filter_cache->nodes);
MEM_SAFE_FREE(ss->filter_cache->mask_update_it);
MEM_SAFE_FREE(ss->filter_cache->prev_mask);

View File

@ -1299,6 +1299,12 @@ typedef struct ExpandCache {
/* IPMask filter vertex callback function. */
typedef float(SculptIPMaskFilterStepVertexCB)(struct SculptSession *, int, float *);
typedef struct MaskFilterDeltaStep {
int totelem;
int *index;
float *delta;
} MaskFilterDeltaStep;
typedef struct FilterCache {
bool enabled_axis[3];
bool enabled_force_axis[3];