CustomData: Add function to get name of default layer

Used by D14365
This commit is contained in:
Hans Goudey 2022-08-26 11:15:32 -05:00
parent 167e2fda15
commit cc9c4e2744
2 changed files with 12 additions and 0 deletions

View File

@ -450,6 +450,12 @@ int CustomData_get_stencil_layer(const struct CustomData *data, int type);
*/
const char *CustomData_get_active_layer_name(const struct CustomData *data, int type);
/**
* Returns name of the default layer of the given type or NULL
* if no such active layer is defined.
*/
const char *CustomData_get_render_layer_name(const struct CustomData *data, int type);
/**
* Copies the data from source to the data element at index in the first layer of type
* no effect if there is no layer of type.

View File

@ -2627,6 +2627,12 @@ const char *CustomData_get_active_layer_name(const CustomData *data, const int t
return layer_index < 0 ? nullptr : data->layers[layer_index].name;
}
const char *CustomData_get_render_layer_name(const CustomData *data, const int type)
{
const int layer_index = CustomData_get_render_layer_index(data, type);
return layer_index < 0 ? nullptr : data->layers[layer_index].name;
}
void CustomData_set_layer_active(CustomData *data, const int type, const int n)
{
for (int i = 0; i < data->totlayer; i++) {