Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/customdata.c
| Show First 20 Lines • Show All 3,459 Lines • ▼ Show 20 Lines | void CustomData_bmesh_copy_data(const CustomData *source, | ||||
| const LayerTypeInfo *typeInfo; | const LayerTypeInfo *typeInfo; | ||||
| int dest_i, src_i; | int dest_i, src_i; | ||||
| if (*dest_block == NULL) { | if (*dest_block == NULL) { | ||||
| CustomData_bmesh_alloc_block(dest, dest_block); | CustomData_bmesh_alloc_block(dest, dest_block); | ||||
| if (*dest_block) { | if (*dest_block) { | ||||
| memset(*dest_block, 0, dest->totsize); | memset(*dest_block, 0, dest->totsize); | ||||
| } | } | ||||
| /* set to default for layers present in dest but not source */ | |||||
| for (int lay = 0; lay < dest->totlayer; ++lay) { | |||||
| int layer_type = dest->layers[lay].type; | |||||
| typeInfo = layerType_getInfo(layer_type); | |||||
| if (!typeInfo->set_default) { | |||||
| continue; | |||||
| } | |||||
| if (CustomData_has_layer(source, layer_type)) { | |||||
| continue; | |||||
| } | |||||
| void *dest_data = POINTER_OFFSET(*dest_block, dest->layers[lay].offset); | |||||
| typeInfo->set_default(dest_data, typeInfo->size); | |||||
| } | |||||
| } | } | ||||
| /* copies a layer at a time */ | /* copies a layer at a time */ | ||||
| dest_i = 0; | dest_i = 0; | ||||
| for (src_i = 0; src_i < source->totlayer; ++src_i) { | for (src_i = 0; src_i < source->totlayer; ++src_i) { | ||||
| /* find the first dest layer with type >= the source type | /* find the first dest layer with type >= the source type | ||||
| * (this should work because layers are ordered by type) | * (this should work because layers are ordered by type) | ||||
| ▲ Show 20 Lines • Show All 1,304 Lines • Show Last 20 Lines | |||||