Cleanup: use eCustomDataType instead of int

This makes the APIs more correct and simplifies debugging, because
some debuggers can now show the enum name instead of the integer.

Pull Request: https://projects.blender.org/blender/blender/pulls/106268
This commit is contained in:
Jacques Lucke 2023-03-29 17:10:49 +02:00
parent 431d9858c5
commit 84c93f3a06
21 changed files with 373 additions and 269 deletions

@ -146,10 +146,10 @@ struct DerivedMesh {
* from the derived mesh (this gives a pointer to the actual data, not * from the derived mesh (this gives a pointer to the actual data, not
* a copy) * a copy)
*/ */
void *(*getVertDataArray)(DerivedMesh *dm, int type); void *(*getVertDataArray)(DerivedMesh *dm, eCustomDataType type);
void *(*getEdgeDataArray)(DerivedMesh *dm, int type); void *(*getEdgeDataArray)(DerivedMesh *dm, eCustomDataType type);
void *(*getLoopDataArray)(DerivedMesh *dm, int type); void *(*getLoopDataArray)(DerivedMesh *dm, eCustomDataType type);
void *(*getPolyDataArray)(DerivedMesh *dm, int type); void *(*getPolyDataArray)(DerivedMesh *dm, eCustomDataType type);
/** Optional grid access for subsurf */ /** Optional grid access for subsurf */
int (*getNumGrids)(DerivedMesh *dm); int (*getNumGrids)(DerivedMesh *dm);
@ -228,10 +228,10 @@ void DM_set_only_copy(DerivedMesh *dm, const struct CustomData_MeshMasks *mask);
* \note these return pointers - any change modifies the internals of the mesh. * \note these return pointers - any change modifies the internals of the mesh.
* \{ */ * \{ */
void *DM_get_vert_data_layer(struct DerivedMesh *dm, int type); void *DM_get_vert_data_layer(struct DerivedMesh *dm, eCustomDataType type);
void *DM_get_edge_data_layer(struct DerivedMesh *dm, int type); void *DM_get_edge_data_layer(struct DerivedMesh *dm, eCustomDataType type);
void *DM_get_poly_data_layer(struct DerivedMesh *dm, int type); void *DM_get_poly_data_layer(struct DerivedMesh *dm, eCustomDataType type);
void *DM_get_loop_data_layer(struct DerivedMesh *dm, int type); void *DM_get_loop_data_layer(struct DerivedMesh *dm, eCustomDataType type);
/** \} */ /** \} */

@ -57,8 +57,11 @@ bool BKE_attribute_allow_procedural_access(const char *attribute_name);
/** /**
* Create a new attribute layer. * Create a new attribute layer.
*/ */
struct CustomDataLayer *BKE_id_attribute_new( struct CustomDataLayer *BKE_id_attribute_new(struct ID *id,
struct ID *id, const char *name, int type, eAttrDomain domain, struct ReportList *reports); const char *name,
eCustomDataType type,
eAttrDomain domain,
struct ReportList *reports);
bool BKE_id_attribute_remove(struct ID *id, const char *name, struct ReportList *reports); bool BKE_id_attribute_remove(struct ID *id, const char *name, struct ReportList *reports);
/** /**
@ -70,7 +73,7 @@ struct CustomDataLayer *BKE_id_attribute_duplicate(struct ID *id,
struct CustomDataLayer *BKE_id_attribute_find(const struct ID *id, struct CustomDataLayer *BKE_id_attribute_find(const struct ID *id,
const char *name, const char *name,
int type, eCustomDataType type,
eAttrDomain domain); eAttrDomain domain);
struct CustomDataLayer *BKE_id_attribute_search(struct ID *id, struct CustomDataLayer *BKE_id_attribute_search(struct ID *id,

@ -136,26 +136,26 @@ bool CustomData_has_referenced(const struct CustomData *data);
* another, while not overwriting anything else (e.g. flags). probably only * another, while not overwriting anything else (e.g. flags). probably only
* implemented for `mloopuv/mloopcol`, for now. * implemented for `mloopuv/mloopcol`, for now.
*/ */
void CustomData_data_copy_value(int type, const void *source, void *dest); void CustomData_data_copy_value(eCustomDataType type, const void *source, void *dest);
void CustomData_data_set_default_value(int type, void *elem); void CustomData_data_set_default_value(eCustomDataType type, void *elem);
/** /**
* Mixes the "value" (e.g. `mloopuv` UV or `mloopcol` colors) from one block into * Mixes the "value" (e.g. `mloopuv` UV or `mloopcol` colors) from one block into
* another, while not overwriting anything else (e.g. flags). * another, while not overwriting anything else (e.g. flags).
*/ */
void CustomData_data_mix_value( void CustomData_data_mix_value(
int type, const void *source, void *dest, int mixmode, float mixfactor); eCustomDataType type, const void *source, void *dest, int mixmode, float mixfactor);
/** /**
* Compares if data1 is equal to data2. type is a valid #CustomData type * Compares if data1 is equal to data2. type is a valid #CustomData type
* enum (e.g. #CD_PROP_FLOAT). the layer type's equal function is used to compare * enum (e.g. #CD_PROP_FLOAT). the layer type's equal function is used to compare
* the data, if it exists, otherwise #memcmp is used. * the data, if it exists, otherwise #memcmp is used.
*/ */
bool CustomData_data_equals(int type, const void *data1, const void *data2); bool CustomData_data_equals(eCustomDataType type, const void *data1, const void *data2);
void CustomData_data_initminmax(int type, void *min, void *max); void CustomData_data_initminmax(eCustomDataType type, void *min, void *max);
void CustomData_data_dominmax(int type, const void *data, void *min, void *max); void CustomData_data_dominmax(eCustomDataType type, const void *data, void *min, void *max);
void CustomData_data_multiply(int type, void *data, float fac); void CustomData_data_multiply(eCustomDataType type, void *data, float fac);
void CustomData_data_add(int type, void *data1, const void *data2); void CustomData_data_add(eCustomDataType type, void *data1, const void *data2);
/** /**
* Initializes a CustomData object with the same layer setup as source. * Initializes a CustomData object with the same layer setup as source.
@ -256,7 +256,7 @@ const void *CustomData_add_layer_named_with_data(struct CustomData *data,
int totelem, int totelem,
const char *name); const char *name);
void *CustomData_add_layer_anonymous(struct CustomData *data, void *CustomData_add_layer_anonymous(struct CustomData *data,
int type, eCustomDataType type,
eCDAllocType alloctype, eCDAllocType alloctype,
void *layer, void *layer,
int totelem, int totelem,
@ -268,7 +268,7 @@ void *CustomData_add_layer_anonymous(struct CustomData *data,
* *
* In edit-mode, use #EDBM_data_layer_free instead of this function. * In edit-mode, use #EDBM_data_layer_free instead of this function.
*/ */
bool CustomData_free_layer(struct CustomData *data, int type, int totelem, int index); bool CustomData_free_layer(struct CustomData *data, eCustomDataType type, int totelem, int index);
bool CustomData_free_layer_named(struct CustomData *data, const char *name, const int totelem); bool CustomData_free_layer_named(struct CustomData *data, const char *name, const int totelem);
/** /**
@ -277,23 +277,23 @@ bool CustomData_free_layer_named(struct CustomData *data, const char *name, cons
* *
* In edit-mode, use #EDBM_data_layer_free instead of this function. * In edit-mode, use #EDBM_data_layer_free instead of this function.
*/ */
bool CustomData_free_layer_active(struct CustomData *data, int type, int totelem); bool CustomData_free_layer_active(struct CustomData *data, eCustomDataType type, int totelem);
/** /**
* Same as above, but free all layers with type. * Same as above, but free all layers with type.
*/ */
void CustomData_free_layers(struct CustomData *data, int type, int totelem); void CustomData_free_layers(struct CustomData *data, eCustomDataType type, int totelem);
/** /**
* Returns true if a layer with the specified type exists. * Returns true if a layer with the specified type exists.
*/ */
bool CustomData_has_layer(const struct CustomData *data, int type); bool CustomData_has_layer(const struct CustomData *data, eCustomDataType type);
/** /**
* Returns the number of layers with this type. * Returns the number of layers with this type.
*/ */
int CustomData_number_of_layers(const struct CustomData *data, int type); int CustomData_number_of_layers(const struct CustomData *data, eCustomDataType type);
int CustomData_number_of_anonymous_layers(const struct CustomData *data, int type); int CustomData_number_of_anonymous_layers(const struct CustomData *data, eCustomDataType type);
int CustomData_number_of_layers_typemask(const struct CustomData *data, eCustomDataMask mask); int CustomData_number_of_layers_typemask(const struct CustomData *data, eCustomDataMask mask);
/** /**
@ -329,7 +329,10 @@ void CustomData_copy_data_named(const struct CustomData *source,
int source_index, int source_index,
int dest_index, int dest_index,
int count); int count);
void CustomData_copy_elements(int type, void *src_data_ofs, void *dst_data_ofs, int count); void CustomData_copy_elements(eCustomDataType type,
void *src_data_ofs,
void *dst_data_ofs,
int count);
void CustomData_bmesh_copy_data(const struct CustomData *source, void CustomData_bmesh_copy_data(const struct CustomData *source,
struct CustomData *dest, struct CustomData *dest,
void *src_block, void *src_block,
@ -345,7 +348,7 @@ void CustomData_bmesh_copy_data_exclude_by_type(const struct CustomData *source,
*/ */
void CustomData_copy_layer_type_data(const struct CustomData *source, void CustomData_copy_layer_type_data(const struct CustomData *source,
struct CustomData *destination, struct CustomData *destination,
int type, eCustomDataType type,
int source_index, int source_index,
int destination_index, int destination_index,
int count); int count);
@ -410,18 +413,25 @@ void CustomData_swap(struct CustomData *data, int index_a, int index_b);
* Retrieve a pointer to an element of the active layer of the given \a type, chosen by the * Retrieve a pointer to an element of the active layer of the given \a type, chosen by the
* \a index, if it exists. * \a index, if it exists.
*/ */
void *CustomData_get_for_write(struct CustomData *data, int index, int type, int totelem); void *CustomData_get_for_write(struct CustomData *data,
int index,
eCustomDataType type,
int totelem);
/** /**
* Retrieve a pointer to an element of the \a nth layer of the given \a type, chosen by the * Retrieve a pointer to an element of the \a nth layer of the given \a type, chosen by the
* \a index, if it exists. * \a index, if it exists.
*/ */
void *CustomData_get_n_for_write(struct CustomData *data, int type, int index, int n, int totelem); void *CustomData_get_n_for_write(
struct CustomData *data, eCustomDataType type, int index, int n, int totelem);
/* BMesh Custom Data Functions. /* BMesh Custom Data Functions.
* Should replace edit-mesh ones with these as well, due to more efficient memory alloc. */ * Should replace edit-mesh ones with these as well, due to more efficient memory alloc. */
void *CustomData_bmesh_get(const struct CustomData *data, void *block, int type); void *CustomData_bmesh_get(const struct CustomData *data, void *block, eCustomDataType type);
void *CustomData_bmesh_get_n(const struct CustomData *data, void *block, int type, int n); void *CustomData_bmesh_get_n(const struct CustomData *data,
void *block,
eCustomDataType type,
int n);
/** /**
* Gets from the layer at physical index `n`, * Gets from the layer at physical index `n`,
@ -429,95 +439,109 @@ void *CustomData_bmesh_get_n(const struct CustomData *data, void *block, int typ
*/ */
void *CustomData_bmesh_get_layer_n(const struct CustomData *data, void *block, int n); void *CustomData_bmesh_get_layer_n(const struct CustomData *data, void *block, int n);
bool CustomData_set_layer_name(struct CustomData *data, int type, int n, const char *name); bool CustomData_set_layer_name(struct CustomData *data,
const char *CustomData_get_layer_name(const struct CustomData *data, int type, int n); eCustomDataType type,
int n,
const char *name);
const char *CustomData_get_layer_name(const struct CustomData *data, eCustomDataType type, int n);
/** /**
* Retrieve the data array of the active layer of the given \a type, if it exists. Return null * Retrieve the data array of the active layer of the given \a type, if it exists. Return null
* otherwise. * otherwise.
*/ */
const void *CustomData_get_layer(const struct CustomData *data, int type); const void *CustomData_get_layer(const struct CustomData *data, eCustomDataType type);
void *CustomData_get_layer_for_write(struct CustomData *data, int type, int totelem); void *CustomData_get_layer_for_write(struct CustomData *data, eCustomDataType type, int totelem);
/** /**
* Retrieve the data array of the \a nth layer of the given \a type, if it exists. Return null * Retrieve the data array of the \a nth layer of the given \a type, if it exists. Return null
* otherwise. * otherwise.
*/ */
const void *CustomData_get_layer_n(const struct CustomData *data, int type, int n); const void *CustomData_get_layer_n(const struct CustomData *data, eCustomDataType type, int n);
void *CustomData_get_layer_n_for_write(struct CustomData *data, int type, int n, int totelem); void *CustomData_get_layer_n_for_write(struct CustomData *data,
eCustomDataType type,
int n,
int totelem);
/** /**
* Retrieve the data array of the layer with the given \a name and \a type, if it exists. Return * Retrieve the data array of the layer with the given \a name and \a type, if it exists. Return
* null otherwise. * null otherwise.
*/ */
const void *CustomData_get_layer_named(const struct CustomData *data, int type, const char *name); const void *CustomData_get_layer_named(const struct CustomData *data,
eCustomDataType type,
const char *name);
void *CustomData_get_layer_named_for_write(CustomData *data, void *CustomData_get_layer_named_for_write(CustomData *data,
int type, eCustomDataType type,
const char *name, const char *name,
int totelem); int totelem);
int CustomData_get_offset(const struct CustomData *data, int type); int CustomData_get_offset(const struct CustomData *data, eCustomDataType type);
int CustomData_get_offset_named(const struct CustomData *data, int type, const char *name); int CustomData_get_offset_named(const struct CustomData *data,
int CustomData_get_n_offset(const struct CustomData *data, int type, int n); eCustomDataType type,
const char *name);
int CustomData_get_n_offset(const struct CustomData *data, eCustomDataType type, int n);
int CustomData_get_layer_index(const struct CustomData *data, int type); int CustomData_get_layer_index(const struct CustomData *data, eCustomDataType type);
int CustomData_get_layer_index_n(const struct CustomData *data, int type, int n); int CustomData_get_layer_index_n(const struct CustomData *data, eCustomDataType type, int n);
int CustomData_get_named_layer_index(const struct CustomData *data, int type, const char *name); int CustomData_get_named_layer_index(const struct CustomData *data,
eCustomDataType type,
const char *name);
int CustomData_get_named_layer_index_notype(const struct CustomData *data, const char *name); int CustomData_get_named_layer_index_notype(const struct CustomData *data, const char *name);
int CustomData_get_active_layer_index(const struct CustomData *data, int type); int CustomData_get_active_layer_index(const struct CustomData *data, eCustomDataType type);
int CustomData_get_render_layer_index(const struct CustomData *data, int type); int CustomData_get_render_layer_index(const struct CustomData *data, eCustomDataType type);
int CustomData_get_clone_layer_index(const struct CustomData *data, int type); int CustomData_get_clone_layer_index(const struct CustomData *data, eCustomDataType type);
int CustomData_get_stencil_layer_index(const struct CustomData *data, int type); int CustomData_get_stencil_layer_index(const struct CustomData *data, eCustomDataType type);
int CustomData_get_named_layer(const struct CustomData *data, int type, const char *name); int CustomData_get_named_layer(const struct CustomData *data,
int CustomData_get_active_layer(const struct CustomData *data, int type); eCustomDataType type,
int CustomData_get_render_layer(const struct CustomData *data, int type); const char *name);
int CustomData_get_clone_layer(const struct CustomData *data, int type); int CustomData_get_active_layer(const struct CustomData *data, eCustomDataType type);
int CustomData_get_stencil_layer(const struct CustomData *data, int type); int CustomData_get_render_layer(const struct CustomData *data, eCustomDataType type);
int CustomData_get_clone_layer(const struct CustomData *data, eCustomDataType type);
int CustomData_get_stencil_layer(const struct CustomData *data, eCustomDataType type);
/** /**
* Returns name of the active layer of the given type or NULL * Returns name of the active layer of the given type or NULL
* if no such active layer is defined. * if no such active layer is defined.
*/ */
const char *CustomData_get_active_layer_name(const struct CustomData *data, int type); const char *CustomData_get_active_layer_name(const struct CustomData *data, eCustomDataType type);
/** /**
* Returns name of the default layer of the given type or NULL * Returns name of the default layer of the given type or NULL
* if no such active layer is defined. * if no such active layer is defined.
*/ */
const char *CustomData_get_render_layer_name(const struct CustomData *data, int type); const char *CustomData_get_render_layer_name(const struct CustomData *data, eCustomDataType type);
bool CustomData_layer_is_anonymous(const struct CustomData *data, int type, int n); bool CustomData_layer_is_anonymous(const struct CustomData *data, eCustomDataType type, int n);
void CustomData_bmesh_set(const struct CustomData *data, void CustomData_bmesh_set(const struct CustomData *data,
void *block, void *block,
int type, eCustomDataType type,
const void *source); const void *source);
void CustomData_bmesh_set_n( void CustomData_bmesh_set_n(
struct CustomData *data, void *block, int type, int n, const void *source); struct CustomData *data, void *block, eCustomDataType type, int n, const void *source);
/** /**
* Sets the nth layer of type as active. * Sets the nth layer of type as active.
*/ */
void CustomData_set_layer_active(struct CustomData *data, int type, int n); void CustomData_set_layer_active(struct CustomData *data, eCustomDataType type, int n);
void CustomData_set_layer_render(struct CustomData *data, int type, int n); void CustomData_set_layer_render(struct CustomData *data, eCustomDataType type, int n);
void CustomData_set_layer_clone(struct CustomData *data, int type, int n); void CustomData_set_layer_clone(struct CustomData *data, eCustomDataType type, int n);
void CustomData_set_layer_stencil(struct CustomData *data, int type, int n); void CustomData_set_layer_stencil(struct CustomData *data, eCustomDataType type, int n);
/** /**
* For using with an index from #CustomData_get_active_layer_index and * For using with an index from #CustomData_get_active_layer_index and
* #CustomData_get_render_layer_index. * #CustomData_get_render_layer_index.
*/ */
void CustomData_set_layer_active_index(struct CustomData *data, int type, int n); void CustomData_set_layer_active_index(struct CustomData *data, eCustomDataType type, int n);
void CustomData_set_layer_render_index(struct CustomData *data, int type, int n); void CustomData_set_layer_render_index(struct CustomData *data, eCustomDataType type, int n);
void CustomData_set_layer_clone_index(struct CustomData *data, int type, int n); void CustomData_set_layer_clone_index(struct CustomData *data, eCustomDataType type, int n);
void CustomData_set_layer_stencil_index(struct CustomData *data, int type, int n); void CustomData_set_layer_stencil_index(struct CustomData *data, eCustomDataType type, int n);
/** /**
* Adds flag to the layer flags. * Adds flag to the layer flags.
*/ */
void CustomData_set_layer_flag(struct CustomData *data, int type, int flag); void CustomData_set_layer_flag(struct CustomData *data, eCustomDataType type, int flag);
void CustomData_clear_layer_flag(struct CustomData *data, int type, int flag); void CustomData_clear_layer_flag(struct CustomData *data, eCustomDataType type, int flag);
void CustomData_bmesh_set_default(struct CustomData *data, void **block); void CustomData_bmesh_set_default(struct CustomData *data, void **block);
void CustomData_bmesh_free_block(struct CustomData *data, void **block); void CustomData_bmesh_free_block(struct CustomData *data, void **block);
@ -537,27 +561,29 @@ void CustomData_bmesh_free_block_data_exclude_by_type(struct CustomData *data,
/** /**
* Query info over types. * Query info over types.
*/ */
void CustomData_file_write_info(int type, const char **r_struct_name, int *r_struct_num); void CustomData_file_write_info(eCustomDataType type,
int CustomData_sizeof(int type); const char **r_struct_name,
int *r_struct_num);
int CustomData_sizeof(eCustomDataType type);
/** /**
* Get the name of a layer type. * Get the name of a layer type.
*/ */
const char *CustomData_layertype_name(int type); const char *CustomData_layertype_name(eCustomDataType type);
/** /**
* Can only ever be one of these. * Can only ever be one of these.
*/ */
bool CustomData_layertype_is_singleton(int type); bool CustomData_layertype_is_singleton(eCustomDataType type);
/** /**
* Has dynamically allocated members. * Has dynamically allocated members.
* This is useful to know if operations such as #memcmp are * This is useful to know if operations such as #memcmp are
* valid when comparing data from two layers. * valid when comparing data from two layers.
*/ */
bool CustomData_layertype_is_dynamic(int type); bool CustomData_layertype_is_dynamic(eCustomDataType type);
/** /**
* \return Maximum number of layers of given \a type, -1 means 'no limit'. * \return Maximum number of layers of given \a type, -1 means 'no limit'.
*/ */
int CustomData_layertype_layers_max(int type); int CustomData_layertype_layers_max(eCustomDataType type);
#ifdef __cplusplus #ifdef __cplusplus
@ -572,7 +598,7 @@ int CustomData_name_max_length_calc(blender::StringRef name);
void CustomData_set_layer_unique_name(struct CustomData *data, int index); void CustomData_set_layer_unique_name(struct CustomData *data, int index);
void CustomData_validate_layer_name(const struct CustomData *data, void CustomData_validate_layer_name(const struct CustomData *data,
int type, eCustomDataType type,
const char *name, const char *name,
char *outname); char *outname);
@ -596,10 +622,16 @@ bool CustomData_layer_validate(struct CustomDataLayer *layer, uint totitems, boo
/* External file storage */ /* External file storage */
void CustomData_external_add( void CustomData_external_add(struct CustomData *data,
struct CustomData *data, struct ID *id, int type, int totelem, const char *filepath); struct ID *id,
void CustomData_external_remove(struct CustomData *data, struct ID *id, int type, int totelem); eCustomDataType type,
bool CustomData_external_test(struct CustomData *data, int type); int totelem,
const char *filepath);
void CustomData_external_remove(struct CustomData *data,
struct ID *id,
eCustomDataType type,
int totelem);
bool CustomData_external_test(struct CustomData *data, eCustomDataType type);
void CustomData_external_write( void CustomData_external_write(
struct CustomData *data, struct ID *id, eCustomDataMask mask, int totelem, int free); struct CustomData *data, struct ID *id, eCustomDataMask mask, int totelem, int free);
@ -674,7 +706,7 @@ enum {
typedef struct CustomDataTransferLayerMap { typedef struct CustomDataTransferLayerMap {
struct CustomDataTransferLayerMap *next, *prev; struct CustomDataTransferLayerMap *next, *prev;
int data_type; eCustomDataType data_type;
int mix_mode; int mix_mode;
float mix_factor; float mix_factor;
/** If non-NULL, array of weights, one for each dest item, replaces mix_factor. */ /** If non-NULL, array of weights, one for each dest item, replaces mix_factor. */

@ -366,12 +366,12 @@ static void mesh_set_only_copy(Mesh *mesh, const CustomData_MeshMasks *mask)
#endif #endif
} }
void *DM_get_vert_data_layer(DerivedMesh *dm, int type) void *DM_get_vert_data_layer(DerivedMesh *dm, const eCustomDataType type)
{ {
return CustomData_get_layer_for_write(&dm->vertData, type, dm->getNumVerts(dm)); return CustomData_get_layer_for_write(&dm->vertData, type, dm->getNumVerts(dm));
} }
void *DM_get_edge_data_layer(DerivedMesh *dm, int type) void *DM_get_edge_data_layer(DerivedMesh *dm, const eCustomDataType type)
{ {
if (type == CD_MEDGE) { if (type == CD_MEDGE) {
return dm->getEdgeArray(dm); return dm->getEdgeArray(dm);
@ -380,12 +380,12 @@ void *DM_get_edge_data_layer(DerivedMesh *dm, int type)
return CustomData_get_layer_for_write(&dm->edgeData, type, dm->getNumEdges(dm)); return CustomData_get_layer_for_write(&dm->edgeData, type, dm->getNumEdges(dm));
} }
void *DM_get_poly_data_layer(DerivedMesh *dm, int type) void *DM_get_poly_data_layer(DerivedMesh *dm, const eCustomDataType type)
{ {
return CustomData_get_layer_for_write(&dm->polyData, type, dm->getNumPolys(dm)); return CustomData_get_layer_for_write(&dm->polyData, type, dm->getNumPolys(dm));
} }
void *DM_get_loop_data_layer(DerivedMesh *dm, int type) void *DM_get_loop_data_layer(DerivedMesh *dm, const eCustomDataType type)
{ {
return CustomData_get_layer_for_write(&dm->loopData, type, dm->getNumLoops(dm)); return CustomData_get_layer_for_write(&dm->loopData, type, dm->getNumLoops(dm));
} }
@ -488,7 +488,8 @@ static Mesh *create_orco_mesh(Object *ob, Mesh *me, BMEditMesh *em, int layer)
return mesh; return mesh;
} }
static void add_orco_mesh(Object *ob, BMEditMesh *em, Mesh *mesh, Mesh *mesh_orco, int layer) static void add_orco_mesh(
Object *ob, BMEditMesh *em, Mesh *mesh, Mesh *mesh_orco, const eCustomDataType layer)
{ {
float(*orco)[3], (*layerorco)[3]; float(*orco)[3], (*layerorco)[3];
int totvert, free; int totvert, free;

@ -268,8 +268,11 @@ bool BKE_id_attribute_calc_unique_name(ID *id, const char *name, char *outname)
return BLI_uniquename_cb(unique_name_cb, &data, nullptr, '.', outname, maxlength); return BLI_uniquename_cb(unique_name_cb, &data, nullptr, '.', outname, maxlength);
} }
CustomDataLayer *BKE_id_attribute_new( CustomDataLayer *BKE_id_attribute_new(ID *id,
ID *id, const char *name, const int type, const eAttrDomain domain, ReportList *reports) const char *name,
const eCustomDataType type,
const eAttrDomain domain,
ReportList *reports)
{ {
using namespace blender::bke; using namespace blender::bke;
DomainInfo info[ATTR_DOMAIN_NUM]; DomainInfo info[ATTR_DOMAIN_NUM];
@ -500,7 +503,7 @@ bool BKE_id_attribute_remove(ID *id, const char *name, ReportList *reports)
CustomDataLayer *BKE_id_attribute_find(const ID *id, CustomDataLayer *BKE_id_attribute_find(const ID *id,
const char *name, const char *name,
const int type, const eCustomDataType type,
const eAttrDomain domain) const eAttrDomain domain)
{ {
if (!name) { if (!name) {

@ -478,9 +478,10 @@ GAttributeWriter CustomDataAttributeProvider::try_get_for_write(
if (!custom_data_layer_matches_attribute_id(layer, attribute_id)) { if (!custom_data_layer_matches_attribute_id(layer, attribute_id)) {
continue; continue;
} }
CustomData_get_layer_named_for_write(custom_data, layer.type, layer.name, element_num); CustomData_get_layer_named_for_write(
custom_data, eCustomDataType(layer.type), layer.name, element_num);
const CPPType *type = custom_data_type_to_cpp_type((eCustomDataType)layer.type); const CPPType *type = custom_data_type_to_cpp_type(eCustomDataType(layer.type));
if (type == nullptr) { if (type == nullptr) {
continue; continue;
} }
@ -502,7 +503,7 @@ bool CustomDataAttributeProvider::try_delete(void *owner, const AttributeIDRef &
const CustomDataLayer &layer = custom_data->layers[i]; const CustomDataLayer &layer = custom_data->layers[i];
if (this->type_is_supported((eCustomDataType)layer.type) && if (this->type_is_supported((eCustomDataType)layer.type) &&
custom_data_layer_matches_attribute_id(layer, attribute_id)) { custom_data_layer_matches_attribute_id(layer, attribute_id)) {
CustomData_free_layer(custom_data, layer.type, element_num, i); CustomData_free_layer(custom_data, eCustomDataType(layer.type), element_num, i);
return true; return true;
} }
} }
@ -668,7 +669,7 @@ bool CustomDataAttributes::remove(const AttributeIDRef &attribute_id)
for (const int i : IndexRange(data.totlayer)) { for (const int i : IndexRange(data.totlayer)) {
const CustomDataLayer &layer = data.layers[i]; const CustomDataLayer &layer = data.layers[i];
if (custom_data_layer_matches_attribute_id(layer, attribute_id)) { if (custom_data_layer_matches_attribute_id(layer, attribute_id)) {
CustomData_free_layer(&data, layer.type, size_, i); CustomData_free_layer(&data, eCustomDataType(layer.type), size_, i);
return true; return true;
} }
} }

File diff suppressed because it is too large Load Diff

@ -516,7 +516,7 @@ void data_transfer_layersmapping_add_item(ListBase *r_map,
BLI_assert(data_dst != nullptr); BLI_assert(data_dst != nullptr);
item->data_type = cddata_type; item->data_type = eCustomDataType(cddata_type);
item->mix_mode = mix_mode; item->mix_mode = mix_mode;
item->mix_factor = mix_factor; item->mix_factor = mix_factor;
item->mix_weights = mix_weights; item->mix_weights = mix_weights;
@ -581,7 +581,7 @@ static void data_transfer_layersmapping_add_item_cd(ListBase *r_map,
* according to given parameters. * according to given parameters.
*/ */
static bool data_transfer_layersmapping_cdlayers_multisrc_to_dst(ListBase *r_map, static bool data_transfer_layersmapping_cdlayers_multisrc_to_dst(ListBase *r_map,
const int cddata_type, const eCustomDataType cddata_type,
const int mix_mode, const int mix_mode,
const float mix_factor, const float mix_factor,
const float *mix_weights, const float *mix_weights,
@ -730,7 +730,7 @@ static bool data_transfer_layersmapping_cdlayers_multisrc_to_dst(ListBase *r_map
} }
static bool data_transfer_layersmapping_cdlayers(ListBase *r_map, static bool data_transfer_layersmapping_cdlayers(ListBase *r_map,
const int cddata_type, const eCustomDataType cddata_type,
const int mix_mode, const int mix_mode,
const float mix_factor, const float mix_factor,
const float *mix_weights, const float *mix_weights,
@ -856,7 +856,7 @@ static bool data_transfer_layersmapping_cdlayers(ListBase *r_map,
} }
} }
else if (fromlayers == DT_LAYERS_ALL_SRC) { else if (fromlayers == DT_LAYERS_ALL_SRC) {
int num_src = CustomData_number_of_layers(cd_src, cddata_type); int num_src = CustomData_number_of_layers(cd_src, eCustomDataType(cddata_type));
bool *use_layers_src = num_src ? static_cast<bool *>(MEM_mallocN( bool *use_layers_src = num_src ? static_cast<bool *>(MEM_mallocN(
sizeof(*use_layers_src) * size_t(num_src), __func__)) : sizeof(*use_layers_src) * size_t(num_src), __func__)) :
nullptr; nullptr;
@ -923,7 +923,7 @@ static bool data_transfer_layersmapping_generate(ListBase *r_map,
cd_dst = &me_dst->vdata; cd_dst = &me_dst->vdata;
if (!data_transfer_layersmapping_cdlayers(r_map, if (!data_transfer_layersmapping_cdlayers(r_map,
cddata_type, eCustomDataType(cddata_type),
mix_mode, mix_mode,
mix_factor, mix_factor,
mix_weights, mix_weights,
@ -975,7 +975,7 @@ static bool data_transfer_layersmapping_generate(ListBase *r_map,
cd_dst = &me_dst->edata; cd_dst = &me_dst->edata;
if (!data_transfer_layersmapping_cdlayers(r_map, if (!data_transfer_layersmapping_cdlayers(r_map,
cddata_type, eCustomDataType(cddata_type),
mix_mode, mix_mode,
mix_factor, mix_factor,
mix_weights, mix_weights,
@ -1048,7 +1048,7 @@ static bool data_transfer_layersmapping_generate(ListBase *r_map,
cd_dst = &me_dst->ldata; cd_dst = &me_dst->ldata;
if (!data_transfer_layersmapping_cdlayers(r_map, if (!data_transfer_layersmapping_cdlayers(r_map,
cddata_type, eCustomDataType(cddata_type),
mix_mode, mix_mode,
mix_factor, mix_factor,
mix_weights, mix_weights,
@ -1079,7 +1079,7 @@ static bool data_transfer_layersmapping_generate(ListBase *r_map,
cd_dst = &me_dst->pdata; cd_dst = &me_dst->pdata;
if (!data_transfer_layersmapping_cdlayers(r_map, if (!data_transfer_layersmapping_cdlayers(r_map,
cddata_type, eCustomDataType(cddata_type),
mix_mode, mix_mode,
mix_factor, mix_factor,
mix_weights, mix_weights,

@ -374,7 +374,7 @@ static void copy_vert_attributes(Mesh *dest_mesh,
CustomData *target_cd = &dest_mesh->vdata; CustomData *target_cd = &dest_mesh->vdata;
const CustomData *source_cd = &orig_me->vdata; const CustomData *source_cd = &orig_me->vdata;
for (int source_layer_i = 0; source_layer_i < source_cd->totlayer; ++source_layer_i) { for (int source_layer_i = 0; source_layer_i < source_cd->totlayer; ++source_layer_i) {
int ty = source_cd->layers[source_layer_i].type; const eCustomDataType ty = eCustomDataType(source_cd->layers[source_layer_i].type);
if (StringRef(source_cd->layers->name) == "position") { if (StringRef(source_cd->layers->name) == "position") {
continue; continue;
} }
@ -400,7 +400,7 @@ static void copy_poly_attributes(Mesh *dest_mesh,
CustomData *target_cd = &dest_mesh->pdata; CustomData *target_cd = &dest_mesh->pdata;
const CustomData *source_cd = &orig_me->pdata; const CustomData *source_cd = &orig_me->pdata;
for (int source_layer_i = 0; source_layer_i < source_cd->totlayer; ++source_layer_i) { for (int source_layer_i = 0; source_layer_i < source_cd->totlayer; ++source_layer_i) {
int ty = source_cd->layers[source_layer_i].type; const eCustomDataType ty = eCustomDataType(source_cd->layers[source_layer_i].type);
if (ty == CD_MPOLY) { if (ty == CD_MPOLY) {
continue; continue;
} }
@ -435,7 +435,7 @@ static void copy_edge_attributes(Mesh *dest_mesh,
CustomData *target_cd = &dest_mesh->edata; CustomData *target_cd = &dest_mesh->edata;
const CustomData *source_cd = &orig_me->edata; const CustomData *source_cd = &orig_me->edata;
for (int source_layer_i = 0; source_layer_i < source_cd->totlayer; ++source_layer_i) { for (int source_layer_i = 0; source_layer_i < source_cd->totlayer; ++source_layer_i) {
int ty = source_cd->layers[source_layer_i].type; const eCustomDataType ty = eCustomDataType(source_cd->layers[source_layer_i].type);
if (ty == CD_MEDGE) { if (ty == CD_MEDGE) {
continue; continue;
} }
@ -602,7 +602,7 @@ static void copy_or_interp_loop_attributes(Mesh *dest_mesh,
interp_weights_poly_v2(weights.data(), cos_2d, orig_poly->totloop, co); interp_weights_poly_v2(weights.data(), cos_2d, orig_poly->totloop, co);
} }
for (int source_layer_i = 0; source_layer_i < source_cd->totlayer; ++source_layer_i) { for (int source_layer_i = 0; source_layer_i < source_cd->totlayer; ++source_layer_i) {
int ty = source_cd->layers[source_layer_i].type; const eCustomDataType ty = eCustomDataType(source_cd->layers[source_layer_i].type);
if (STR_ELEM(source_cd->layers[source_layer_i].name, ".corner_vert", ".corner_edge")) { if (STR_ELEM(source_cd->layers[source_layer_i].name, ".corner_vert", ".corner_edge")) {
continue; continue;
} }

@ -375,21 +375,21 @@ void BKE_remesh_reproject_vertex_paint(Mesh *target, const Mesh *source)
while ((layer = BKE_id_attribute_from_index( while ((layer = BKE_id_attribute_from_index(
const_cast<ID *>(&source->id), i++, ATTR_DOMAIN_MASK_COLOR, CD_MASK_COLOR_ALL))) { const_cast<ID *>(&source->id), i++, ATTR_DOMAIN_MASK_COLOR, CD_MASK_COLOR_ALL))) {
eAttrDomain domain = BKE_id_attribute_domain(&source->id, layer); eAttrDomain domain = BKE_id_attribute_domain(&source->id, layer);
const eCustomDataType type = eCustomDataType(layer->type);
CustomData *target_cdata = domain == ATTR_DOMAIN_POINT ? &target->vdata : &target->ldata; CustomData *target_cdata = domain == ATTR_DOMAIN_POINT ? &target->vdata : &target->ldata;
const CustomData *source_cdata = domain == ATTR_DOMAIN_POINT ? &source->vdata : &source->ldata; const CustomData *source_cdata = domain == ATTR_DOMAIN_POINT ? &source->vdata : &source->ldata;
/* Check attribute exists in target. */ /* Check attribute exists in target. */
int layer_i = CustomData_get_named_layer_index(target_cdata, layer->type, layer->name); int layer_i = CustomData_get_named_layer_index(target_cdata, type, layer->name);
if (layer_i == -1) { if (layer_i == -1) {
int elem_num = domain == ATTR_DOMAIN_POINT ? target->totvert : target->totloop; int elem_num = domain == ATTR_DOMAIN_POINT ? target->totvert : target->totloop;
CustomData_add_layer_named( CustomData_add_layer_named(target_cdata, type, CD_SET_DEFAULT, elem_num, layer->name);
target_cdata, eCustomDataType(layer->type), CD_SET_DEFAULT, elem_num, layer->name); layer_i = CustomData_get_named_layer_index(target_cdata, type, layer->name);
layer_i = CustomData_get_named_layer_index(target_cdata, layer->type, layer->name);
} }
size_t data_size = CustomData_sizeof(layer->type); size_t data_size = CustomData_sizeof(type);
void *target_data = target_cdata->layers[layer_i].data; void *target_data = target_cdata->layers[layer_i].data;
void *source_data = layer->data; void *source_data = layer->data;
const Span<float3> target_positions = target->vert_positions(); const Span<float3> target_positions = target->vert_positions();

@ -935,12 +935,13 @@ static bool mesh_validate_customdata(CustomData *data,
while (i < data->totlayer) { while (i < data->totlayer) {
CustomDataLayer *layer = &data->layers[i]; CustomDataLayer *layer = &data->layers[i];
const eCustomDataType type = eCustomDataType(layer->type);
bool ok = true; bool ok = true;
/* Count layers when the type changes. */ /* Count layers when the type changes. */
if (layer_num_type != layer->type) { if (layer_num_type != type) {
layer_num = CustomData_number_of_layers(data, layer->type); layer_num = CustomData_number_of_layers(data, type);
layer_num_type = layer->type; layer_num_type = type;
} }
/* Validate active index, for a time this could be set to a negative value, see: #105860. */ /* Validate active index, for a time this could be set to a negative value, see: #105860. */
@ -975,33 +976,33 @@ static bool mesh_validate_customdata(CustomData *data,
} }
} }
if (CustomData_layertype_is_singleton(layer->type)) { if (CustomData_layertype_is_singleton(type)) {
if (layer_num > 1) { if (layer_num > 1) {
PRINT_ERR("\tCustomDataLayer type %d is a singleton, found %d in Mesh structure\n", PRINT_ERR("\tCustomDataLayer type %d is a singleton, found %d in Mesh structure\n",
layer->type, type,
layer_num); layer_num);
ok = false; ok = false;
} }
} }
if (mask != 0) { if (mask != 0) {
eCustomDataMask layer_typemask = CD_TYPE_AS_MASK(layer->type); eCustomDataMask layer_typemask = CD_TYPE_AS_MASK(type);
if ((layer_typemask & mask) == 0) { if ((layer_typemask & mask) == 0) {
PRINT_ERR("\tCustomDataLayer type %d which isn't in the mask\n", layer->type); PRINT_ERR("\tCustomDataLayer type %d which isn't in the mask\n", type);
ok = false; ok = false;
} }
} }
if (ok == false) { if (ok == false) {
if (do_fixes) { if (do_fixes) {
CustomData_free_layer(data, layer->type, 0, i); CustomData_free_layer(data, type, 0, i);
has_fixes = true; has_fixes = true;
} }
} }
if (ok) { if (ok) {
if (CustomData_layer_validate(layer, totitems, do_fixes)) { if (CustomData_layer_validate(layer, totitems, do_fixes)) {
PRINT_ERR("\tCustomDataLayer type %d has some invalid data\n", layer->type); PRINT_ERR("\tCustomDataLayer type %d has some invalid data\n", type);
has_fixes = do_fixes; has_fixes = do_fixes;
} }
i++; i++;

@ -1660,7 +1660,9 @@ void BKE_object_link_modifiers(Object *ob_dst, const Object *ob_src)
/** /**
* Copy CCG related data. Used to sync copy of mesh with reshaped original mesh. * Copy CCG related data. Used to sync copy of mesh with reshaped original mesh.
*/ */
static void copy_ccg_data(Mesh *mesh_destination, Mesh *mesh_source, int layer_type) static void copy_ccg_data(Mesh *mesh_destination,
Mesh *mesh_source,
const eCustomDataType layer_type)
{ {
BLI_assert(mesh_destination->totloop == mesh_source->totloop); BLI_assert(mesh_destination->totloop == mesh_source->totloop);
CustomData *data_destination = &mesh_destination->ldata; CustomData *data_destination = &mesh_destination->ldata;

@ -1207,7 +1207,7 @@ static void ccgDM_release(DerivedMesh *dm)
} }
} }
static void *ccgDM_get_vert_data_layer(DerivedMesh *dm, int type) static void *ccgDM_get_vert_data_layer(DerivedMesh *dm, const eCustomDataType type)
{ {
if (type == CD_ORIGINDEX) { if (type == CD_ORIGINDEX) {
/* create origindex on demand to save memory */ /* create origindex on demand to save memory */
@ -1249,7 +1249,7 @@ static void *ccgDM_get_vert_data_layer(DerivedMesh *dm, int type)
return DM_get_vert_data_layer(dm, type); return DM_get_vert_data_layer(dm, type);
} }
static void *ccgDM_get_edge_data_layer(DerivedMesh *dm, int type) static void *ccgDM_get_edge_data_layer(DerivedMesh *dm, const eCustomDataType type)
{ {
if (type == CD_ORIGINDEX) { if (type == CD_ORIGINDEX) {
/* create origindex on demand to save memory */ /* create origindex on demand to save memory */
@ -1292,7 +1292,7 @@ static void *ccgDM_get_edge_data_layer(DerivedMesh *dm, int type)
return DM_get_edge_data_layer(dm, type); return DM_get_edge_data_layer(dm, type);
} }
static void *ccgDM_get_poly_data_layer(DerivedMesh *dm, int type) static void *ccgDM_get_poly_data_layer(DerivedMesh *dm, const eCustomDataType type)
{ {
if (type == CD_ORIGINDEX) { if (type == CD_ORIGINDEX) {
/* create origindex on demand to save memory */ /* create origindex on demand to save memory */

@ -903,7 +903,9 @@ struct PBVHBatches {
if (need_aliases) { if (need_aliases) {
CustomData *cdata = get_cdata(domain, args); CustomData *cdata = get_cdata(domain, args);
int layer_i = cdata ? CustomData_get_named_layer_index(cdata, type, name.c_str()) : -1; int layer_i = cdata ? CustomData_get_named_layer_index(
cdata, eCustomDataType(type), name.c_str()) :
-1;
CustomDataLayer *layer = layer_i != -1 ? cdata->layers + layer_i : nullptr; CustomDataLayer *layer = layer_i != -1 ? cdata->layers + layer_i : nullptr;
if (layer) { if (layer) {
@ -924,8 +926,8 @@ struct PBVHBatches {
break; break;
} }
const char *active_name = CustomData_get_active_layer_name(cdata, type); const char *active_name = CustomData_get_active_layer_name(cdata, eCustomDataType(type));
const char *render_name = CustomData_get_render_layer_name(cdata, type); const char *render_name = CustomData_get_render_layer_name(cdata, eCustomDataType(type));
is_active = active_name && STREQ(layer->name, active_name); is_active = active_name && STREQ(layer->name, active_name);
is_render = render_name && STREQ(layer->name, render_name); is_render = render_name && STREQ(layer->name, render_name);

@ -3135,7 +3135,7 @@ bool EDBM_select_interior_faces(BMEditMesh *em)
#define USE_LINKED_SELECT_DEFAULT_HACK #define USE_LINKED_SELECT_DEFAULT_HACK
struct DelimitData { struct DelimitData {
int cd_loop_type; eCustomDataType cd_loop_type;
int cd_loop_offset; int cd_loop_offset;
}; };
@ -3219,7 +3219,7 @@ static void select_linked_delimit_validate(BMesh *bm, int *delimit)
static void select_linked_delimit_begin(BMesh *bm, int delimit) static void select_linked_delimit_begin(BMesh *bm, int delimit)
{ {
DelimitData delimit_data = {0}; DelimitData delimit_data{};
if (delimit & BMO_DELIM_UV) { if (delimit & BMO_DELIM_UV) {
delimit_data.cd_loop_type = CD_PROP_FLOAT2; delimit_data.cd_loop_type = CD_PROP_FLOAT2;

@ -596,7 +596,9 @@ void MESH_OT_uv_texture_remove(wmOperatorType *ot)
/* *** CustomData clear functions, we need an operator for each *** */ /* *** CustomData clear functions, we need an operator for each *** */
static int mesh_customdata_clear_exec__internal(bContext *C, char htype, int type) static int mesh_customdata_clear_exec__internal(bContext *C,
char htype,
const eCustomDataType type)
{ {
Mesh *me = ED_mesh_context(C); Mesh *me = ED_mesh_context(C);
@ -621,7 +623,7 @@ static int mesh_customdata_clear_exec__internal(bContext *C, char htype, int typ
return OPERATOR_CANCELLED; return OPERATOR_CANCELLED;
} }
static int mesh_customdata_add_exec__internal(bContext *C, char htype, int type) static int mesh_customdata_add_exec__internal(bContext *C, char htype, const eCustomDataType type)
{ {
Mesh *mesh = ED_mesh_context(C); Mesh *mesh = ED_mesh_context(C);

@ -1169,7 +1169,7 @@ static bool bake_targets_output_vertex_colors(BakeTargets *targets, Object *ob)
if (em) { if (em) {
/* Copy to bmesh. */ /* Copy to bmesh. */
const int active_color_offset = CustomData_get_offset_named( const int active_color_offset = CustomData_get_offset_named(
&em->bm->vdata, active_color_layer->type, active_color_layer->name); &em->bm->vdata, eCustomDataType(active_color_layer->type), active_color_layer->name);
BMVert *v; BMVert *v;
BMIter viter; BMIter viter;
int i = 0; int i = 0;
@ -1204,7 +1204,7 @@ static bool bake_targets_output_vertex_colors(BakeTargets *targets, Object *ob)
if (em) { if (em) {
/* Copy to bmesh. */ /* Copy to bmesh. */
const int active_color_offset = CustomData_get_offset_named( const int active_color_offset = CustomData_get_offset_named(
&em->bm->ldata, active_color_layer->type, active_color_layer->name); &em->bm->ldata, eCustomDataType(active_color_layer->type), active_color_layer->name);
BMFace *f; BMFace *f;
BMIter fiter; BMIter fiter;
int i = 0; int i = 0;

@ -133,7 +133,7 @@ typedef struct UndoSculpt {
typedef struct SculptAttrRef { typedef struct SculptAttrRef {
eAttrDomain domain; eAttrDomain domain;
int type; eCustomDataType type;
char name[MAX_CUSTOMDATA_LAYER_NAME]; char name[MAX_CUSTOMDATA_LAYER_NAME];
bool was_set; bool was_set;
} SculptAttrRef; } SculptAttrRef;

@ -1458,7 +1458,7 @@ static void customdata_weld(
/* interpolates a layer at a time */ /* interpolates 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++) {
const int type = source->layers[src_i].type; const eCustomDataType type = eCustomDataType(source->layers[src_i].type);
/* 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)
@ -1507,7 +1507,7 @@ static void customdata_weld(
for (dest_i = 0; dest_i < dest->totlayer; dest_i++) { for (dest_i = 0; dest_i < dest->totlayer; dest_i++) {
CustomDataLayer *layer_dst = &dest->layers[dest_i]; CustomDataLayer *layer_dst = &dest->layers[dest_i];
const int type = layer_dst->type; const eCustomDataType type = eCustomDataType(layer_dst->type);
if (type == CD_MEDGE) { if (type == CD_MEDGE) {
/* Pass. */ /* Pass. */
} }

@ -109,7 +109,9 @@ extern "C" char build_hash[];
#include <cerrno> #include <cerrno>
const char *bc_CustomData_get_layer_name(const struct CustomData *data, int type, int n) const char *bc_CustomData_get_layer_name(const struct CustomData *data,
const eCustomDataType type,
int n)
{ {
int layer_index = CustomData_get_layer_index(data, type); int layer_index = CustomData_get_layer_index(data, type);
if (layer_index < 0) { if (layer_index < 0) {
@ -119,7 +121,7 @@ const char *bc_CustomData_get_layer_name(const struct CustomData *data, int type
return data->layers[layer_index + n].name; return data->layers[layer_index + n].name;
} }
const char *bc_CustomData_get_active_layer_name(const CustomData *data, int type) const char *bc_CustomData_get_active_layer_name(const CustomData *data, const eCustomDataType type)
{ {
/* get the layer index of the active layer of type */ /* get the layer index of the active layer of type */
int layer_index = CustomData_get_active_layer_index(data, type); int layer_index = CustomData_get_active_layer_index(data, type);

@ -125,8 +125,11 @@ extern Mesh *bc_get_mesh_copy(BlenderContext &blender_context,
extern Object *bc_get_assigned_armature(Object *ob); extern Object *bc_get_assigned_armature(Object *ob);
extern bool bc_has_object_type(LinkNode *export_set, short obtype); extern bool bc_has_object_type(LinkNode *export_set, short obtype);
extern const char *bc_CustomData_get_layer_name(const CustomData *data, int type, int n); extern const char *bc_CustomData_get_layer_name(const CustomData *data,
extern const char *bc_CustomData_get_active_layer_name(const CustomData *data, int type); eCustomDataType type,
int n);
extern const char *bc_CustomData_get_active_layer_name(const CustomData *data,
eCustomDataType type);
extern void bc_bubble_sort_by_Object_name(LinkNode *export_set); extern void bc_bubble_sort_by_Object_name(LinkNode *export_set);
/** /**