Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/customdata.c
| Show First 20 Lines • Show All 2,589 Lines • ▼ Show 20 Lines | static CustomDataLayer *customData_add_layer__internal(CustomData *data, | ||||
| data->totlayer++; | data->totlayer++; | ||||
| /* keep layers ordered by type */ | /* keep layers ordered by type */ | ||||
| for (; index > 0 && data->layers[index - 1].type > type; index--) { | for (; index > 0 && data->layers[index - 1].type > type; index--) { | ||||
| data->layers[index] = data->layers[index - 1]; | data->layers[index] = data->layers[index - 1]; | ||||
| } | } | ||||
| /* Clear remaining data on the layer. The original data on the layer has been moved to another | |||||
| * index. Without this, it can happen that information from the previous layer at that index | |||||
| * leaks into the new layer. */ | |||||
| memset(data->layers + index, 0, sizeof(CustomDataLayer)); | |||||
| data->layers[index].type = type; | data->layers[index].type = type; | ||||
| data->layers[index].flag = flag; | data->layers[index].flag = flag; | ||||
| data->layers[index].data = newlayerdata; | data->layers[index].data = newlayerdata; | ||||
| /* Set default name if none exists. Note we only call DATA_() once | /* Set default name if none exists. Note we only call DATA_() once | ||||
| * we know there is a default name, to avoid overhead of locale lookups | * we know there is a default name, to avoid overhead of locale lookups | ||||
| * in the depsgraph. */ | * in the depsgraph. */ | ||||
| if (!name && typeInfo->defaultname) { | if (!name && typeInfo->defaultname) { | ||||
| ▲ Show 20 Lines • Show All 2,672 Lines • Show Last 20 Lines | |||||