Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/customdata.cc
| Show First 20 Lines • Show All 2,774 Lines • ▼ Show 20 Lines | |||||
| void CustomData_free_layers(CustomData *data, int type, int totelem) | void CustomData_free_layers(CustomData *data, int type, int totelem) | ||||
| { | { | ||||
| const int index = CustomData_get_layer_index(data, type); | const int index = CustomData_get_layer_index(data, type); | ||||
| while (CustomData_free_layer(data, type, totelem, index)) { | while (CustomData_free_layer(data, type, totelem, index)) { | ||||
| /* pass */ | /* pass */ | ||||
| } | } | ||||
| } | } | ||||
| void CustomData_free_layers_anonymous(struct CustomData *data, int totelem) | |||||
| { | |||||
| while (true) { | |||||
HooglyBoogly: Hmm, theoretically there would be other ways to implement this without a while loop, but that… | |||||
| bool found_anonymous_layer = false; | |||||
| for (int i = 0; i < data->totlayer; i++) { | |||||
| const CustomDataLayer *layer = &data->layers[i]; | |||||
| if (layer->anonymous_id != NULL) { | |||||
| CustomData_free_layer(data, layer->type, totelem, i); | |||||
| found_anonymous_layer = true; | |||||
| break; | |||||
| } | |||||
| } | |||||
| if (!found_anonymous_layer) { | |||||
| break; | |||||
| } | |||||
| } | |||||
| } | |||||
| bool CustomData_has_layer(const CustomData *data, int type) | bool CustomData_has_layer(const CustomData *data, int type) | ||||
| { | { | ||||
| return (CustomData_get_layer_index(data, type) != -1); | return (CustomData_get_layer_index(data, type) != -1); | ||||
| } | } | ||||
| int CustomData_number_of_layers(const CustomData *data, int type) | int CustomData_number_of_layers(const CustomData *data, int type) | ||||
| { | { | ||||
| int number = 0; | int number = 0; | ||||
| ▲ Show 20 Lines • Show All 2,454 Lines • Show Last 20 Lines | |||||
Hmm, theoretically there would be other ways to implement this without a while loop, but that doesn't look worth it, since CustomData_free_layer handles many other things too.