diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-02-20 02:17:30 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-02-20 02:17:30 +0400 |
commit | a368e6771a5f707f41f5959c345943cad07ef7e8 (patch) | |
tree | 818fb646c7651482c400f861fd789078ebaa4e72 /source/blender/blenkernel/intern/customdata.c | |
parent | be674afdadaa1ab966147755e224e8bbda6807db (diff) |
- remove some unused editmesh functions.
- copy & rename EditMesh stricts for use with scanfill (remove unused members)
Diffstat (limited to 'source/blender/blenkernel/intern/customdata.c')
-rw-r--r-- | source/blender/blenkernel/intern/customdata.c | 281 |
1 files changed, 0 insertions, 281 deletions
diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c index a4c1fd87009..6cb8b65dbaf 100644 --- a/source/blender/blenkernel/intern/customdata.c +++ b/source/blender/blenkernel/intern/customdata.c @@ -2154,287 +2154,6 @@ void CustomData_set(const CustomData *data, int index, int type, void *source) memcpy(dest, source, typeInfo->size); } -/* EditMesh functions */ - -void CustomData_em_free_block(CustomData *data, void **block) -{ - const LayerTypeInfo *typeInfo; - int i; - - if(!*block) return; - - for(i = 0; i < data->totlayer; ++i) { - if(!(data->layers[i].flag & CD_FLAG_NOFREE)) { - typeInfo = layerType_getInfo(data->layers[i].type); - - if(typeInfo->free) { - int offset = data->layers[i].offset; - typeInfo->free((char*)*block + offset, 1, typeInfo->size); - } - } - } - - MEM_freeN(*block); - *block = NULL; -} - -static void CustomData_em_alloc_block(CustomData *data, void **block) -{ - /* TODO: optimize free/alloc */ - - if (*block) - CustomData_em_free_block(data, block); - - if (data->totsize > 0) - *block = MEM_callocN(data->totsize, "CustomData EM block"); - else - *block = NULL; -} - -void CustomData_em_copy_data(const CustomData *source, CustomData *dest, - void *src_block, void **dest_block) -{ - const LayerTypeInfo *typeInfo; - int dest_i, src_i; - - if (!*dest_block) - CustomData_em_alloc_block(dest, dest_block); - - /* copies a layer at a time */ - dest_i = 0; - for(src_i = 0; src_i < source->totlayer; ++src_i) { - - /* find the first dest layer with type >= the source type - * (this should work because layers are ordered by type) - */ - while(dest_i < dest->totlayer - && dest->layers[dest_i].type < source->layers[src_i].type) - ++dest_i; - - /* if there are no more dest layers, we're done */ - if(dest_i >= dest->totlayer) return; - - /* if we found a matching layer, copy the data */ - if(dest->layers[dest_i].type == source->layers[src_i].type && - strcmp(dest->layers[dest_i].name, source->layers[src_i].name) == 0) { - char *src_data = (char*)src_block + source->layers[src_i].offset; - char *dest_data = (char*)*dest_block + dest->layers[dest_i].offset; - - typeInfo = layerType_getInfo(source->layers[src_i].type); - - if(typeInfo->copy) - typeInfo->copy(src_data, dest_data, 1); - else - memcpy(dest_data, src_data, typeInfo->size); - - /* if there are multiple source & dest layers of the same type, - * we don't want to copy all source layers to the same dest, so - * increment dest_i - */ - ++dest_i; - } - } -} - -void CustomData_em_validate_data(CustomData *data, void *block, int sub_elements) -{ - int i; - for(i = 0; i < data->totlayer; i++) { - const LayerTypeInfo *typeInfo = layerType_getInfo(data->layers[i].type); - char *leayer_data = (char*)block + data->layers[i].offset; - - if(typeInfo->validate) - typeInfo->validate(leayer_data, sub_elements); - } -} - -void *CustomData_em_get(const CustomData *data, void *block, int type) -{ - int layer_index; - - /* get the layer index of the first layer of type */ - layer_index = CustomData_get_active_layer_index(data, type); - if(layer_index < 0) return NULL; - - return (char *)block + data->layers[layer_index].offset; -} - -void *CustomData_em_get_n(const CustomData *data, void *block, int type, int n) -{ - int layer_index; - - /* get the layer index of the first layer of type */ - layer_index = CustomData_get_layer_index_n(data, type, n); - if(layer_index < 0) return NULL; - - return (char *)block + data->layers[layer_index].offset; -} - -void CustomData_em_set(CustomData *data, void *block, int type, void *source) -{ - void *dest = CustomData_em_get(data, block, type); - const LayerTypeInfo *typeInfo = layerType_getInfo(type); - - if(!dest) return; - - if(typeInfo->copy) - typeInfo->copy(source, dest, 1); - else - memcpy(dest, source, typeInfo->size); -} - -void CustomData_em_set_n(CustomData *data, void *block, int type, int n, void *source) -{ - void *dest = CustomData_em_get_n(data, block, type, n); - const LayerTypeInfo *typeInfo = layerType_getInfo(type); - - if(!dest) return; - - if(typeInfo->copy) - typeInfo->copy(source, dest, 1); - else - memcpy(dest, source, typeInfo->size); -} - -void CustomData_em_interp(CustomData *data, void **src_blocks, float *weights, - float *sub_weights, int count, void *dest_block) -{ - int i, j; - void *source_buf[SOURCE_BUF_SIZE]; - void **sources = source_buf; - - /* slow fallback in case we're interpolating a ridiculous number of - * elements - */ - if(count > SOURCE_BUF_SIZE) - sources = MEM_callocN(sizeof(*sources) * count, - "CustomData_interp sources"); - - /* interpolates a layer at a time */ - for(i = 0; i < data->totlayer; ++i) { - CustomDataLayer *layer = &data->layers[i]; - const LayerTypeInfo *typeInfo = layerType_getInfo(layer->type); - - if(typeInfo->interp) { - for(j = 0; j < count; ++j) - sources[j] = (char *)src_blocks[j] + layer->offset; - - typeInfo->interp(sources, weights, sub_weights, count, - (char *)dest_block + layer->offset); - } - } - - if(count > SOURCE_BUF_SIZE) MEM_freeN(sources); -} - -void CustomData_em_set_default(CustomData *data, void **block) -{ - const LayerTypeInfo *typeInfo; - int i; - - if (!*block) - CustomData_em_alloc_block(data, block); - - for(i = 0; i < data->totlayer; ++i) { - int offset = data->layers[i].offset; - - typeInfo = layerType_getInfo(data->layers[i].type); - - if(typeInfo->set_default) - typeInfo->set_default((char*)*block + offset, 1); - } -} - -void CustomData_to_em_block(const CustomData *source, CustomData *dest, - int src_index, void **dest_block) -{ - const LayerTypeInfo *typeInfo; - int dest_i, src_i, src_offset; - - if (!*dest_block) - CustomData_em_alloc_block(dest, dest_block); - - /* copies a layer at a time */ - dest_i = 0; - for(src_i = 0; src_i < source->totlayer; ++src_i) { - - /* find the first dest layer with type >= the source type - * (this should work because layers are ordered by type) - */ - while(dest_i < dest->totlayer - && dest->layers[dest_i].type < source->layers[src_i].type) - ++dest_i; - - /* if there are no more dest layers, we're done */ - if(dest_i >= dest->totlayer) return; - - /* if we found a matching layer, copy the data */ - if(dest->layers[dest_i].type == source->layers[src_i].type) { - int offset = dest->layers[dest_i].offset; - char *src_data = source->layers[src_i].data; - char *dest_data = (char*)*dest_block + offset; - - typeInfo = layerType_getInfo(dest->layers[dest_i].type); - src_offset = src_index * typeInfo->size; - - if(typeInfo->copy) - typeInfo->copy(src_data + src_offset, dest_data, 1); - else - memcpy(dest_data, src_data + src_offset, typeInfo->size); - - /* if there are multiple source & dest layers of the same type, - * we don't want to copy all source layers to the same dest, so - * increment dest_i - */ - ++dest_i; - } - } -} - -void CustomData_from_em_block(const CustomData *source, CustomData *dest, - void *src_block, int dest_index) -{ - const LayerTypeInfo *typeInfo; - int dest_i, src_i, dest_offset; - - /* copies a layer at a time */ - dest_i = 0; - for(src_i = 0; src_i < source->totlayer; ++src_i) { - - /* find the first dest layer with type >= the source type - * (this should work because layers are ordered by type) - */ - while(dest_i < dest->totlayer - && dest->layers[dest_i].type < source->layers[src_i].type) - ++dest_i; - - /* if there are no more dest layers, we're done */ - if(dest_i >= dest->totlayer) return; - - /* if we found a matching layer, copy the data */ - if(dest->layers[dest_i].type == source->layers[src_i].type) { - int offset = source->layers[src_i].offset; - char *src_data = (char*)src_block + offset; - char *dest_data = dest->layers[dest_i].data; - - typeInfo = layerType_getInfo(dest->layers[dest_i].type); - dest_offset = dest_index * typeInfo->size; - - if(typeInfo->copy) - typeInfo->copy(src_data, dest_data + dest_offset, 1); - else - memcpy(dest_data + dest_offset, src_data, typeInfo->size); - - /* if there are multiple source & dest layers of the same type, - * we don't want to copy all source layers to the same dest, so - * increment dest_i - */ - ++dest_i; - } - } - -} - /*Bmesh functions*/ /*needed to convert to/from different face reps*/ void CustomData_to_bmeshpoly(CustomData *fdata, CustomData *pdata, CustomData *ldata, |