diff options
Diffstat (limited to 'source/blender/blenkernel/intern/customdata.c')
-rw-r--r-- | source/blender/blenkernel/intern/customdata.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c index 65ec6be5a60..999f411cece 100644 --- a/source/blender/blenkernel/intern/customdata.c +++ b/source/blender/blenkernel/intern/customdata.c @@ -1559,6 +1559,25 @@ void CustomData_free(CustomData *data, int totelem) CustomData_reset(data); } +void CustomData_free_typemask(struct CustomData *data, int totelem, CustomDataMask mask) +{ + int i; + + for (i = 0; i < data->totlayer; ++i) { + CustomDataLayer *layer = &data->layers[i]; + if (!(mask & CD_TYPE_AS_MASK(layer->type))) { + continue; + } + customData_free_layer__internal(layer, totelem); + } + + if (data->layers) + MEM_freeN(data->layers); + + CustomData_external_free(data); + CustomData_reset(data); +} + static void customData_update_offsets(CustomData *data) { const LayerTypeInfo *typeInfo; @@ -2876,6 +2895,17 @@ bool CustomData_has_interp(const struct CustomData *data) return false; } +bool CustomData_has_referenced(const struct CustomData *data) +{ + int i; + for (i = 0; i < data->totlayer; ++i) { + if (data->layers[i].flag & CD_FLAG_NOFREE) { + return true; + } + } + return false; +} + /* copies the "value" (e.g. mloopuv uv or mloopcol colors) from one block to * another, while not overwriting anything else (e.g. flags)*/ void CustomData_data_copy_value(int type, const void *source, void *dest) |