From 01f9e13c301c850cf4b07725ac5e24b8d15dd53a Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 30 May 2018 10:28:24 +0200 Subject: Cleanup: use 'e' prefix for enum types --- source/blender/blenkernel/BKE_DerivedMesh.h | 10 ++++---- source/blender/blenkernel/BKE_cdderivedmesh.h | 2 +- source/blender/blenkernel/BKE_customdata.h | 26 +++++++++++-------- source/blender/blenkernel/intern/DerivedMesh.c | 12 ++++----- source/blender/blenkernel/intern/cdderivedmesh.c | 2 +- source/blender/blenkernel/intern/customdata.c | 32 ++++++++++++++---------- 6 files changed, 47 insertions(+), 37 deletions(-) (limited to 'source') diff --git a/source/blender/blenkernel/BKE_DerivedMesh.h b/source/blender/blenkernel/BKE_DerivedMesh.h index 50aa82b83d4..71c1d64eb27 100644 --- a/source/blender/blenkernel/BKE_DerivedMesh.h +++ b/source/blender/blenkernel/BKE_DerivedMesh.h @@ -398,19 +398,19 @@ void DM_set_only_copy(DerivedMesh *dm, CustomDataMask mask); * freed, see BKE_customdata.h for the different options */ void DM_add_vert_layer( - struct DerivedMesh *dm, int type, CDAllocType alloctype, + struct DerivedMesh *dm, int type, eCDAllocType alloctype, void *layer); void DM_add_edge_layer( - struct DerivedMesh *dm, int type, CDAllocType alloctype, + struct DerivedMesh *dm, int type, eCDAllocType alloctype, void *layer); void DM_add_tessface_layer( - struct DerivedMesh *dm, int type, CDAllocType alloctype, + struct DerivedMesh *dm, int type, eCDAllocType alloctype, void *layer); void DM_add_loop_layer( - DerivedMesh *dm, int type, CDAllocType alloctype, + DerivedMesh *dm, int type, eCDAllocType alloctype, void *layer); void DM_add_poly_layer( - struct DerivedMesh *dm, int type, CDAllocType alloctype, + struct DerivedMesh *dm, int type, eCDAllocType alloctype, void *layer); /* custom data access functions diff --git a/source/blender/blenkernel/BKE_cdderivedmesh.h b/source/blender/blenkernel/BKE_cdderivedmesh.h index 27eb57bd1b2..74a90cd20f7 100644 --- a/source/blender/blenkernel/BKE_cdderivedmesh.h +++ b/source/blender/blenkernel/BKE_cdderivedmesh.h @@ -55,7 +55,7 @@ struct DerivedMesh *CDDM_new(int numVerts, int numEdges, int numFaces, struct DerivedMesh *CDDM_from_mesh(struct Mesh *mesh); /* creates a CDDerivedMesh from the given Mesh with custom allocation type. */ -struct DerivedMesh *CDDM_from_mesh_ex(struct Mesh *mesh, CDAllocType alloctype, CustomDataMask mask); +struct DerivedMesh *CDDM_from_mesh_ex(struct Mesh *mesh, eCDAllocType alloctype, CustomDataMask mask); struct DerivedMesh *CDDM_from_bmesh(struct BMesh *bm, const bool use_mdisps); diff --git a/source/blender/blenkernel/BKE_customdata.h b/source/blender/blenkernel/BKE_customdata.h index 89d34977843..85c894864d5 100644 --- a/source/blender/blenkernel/BKE_customdata.h +++ b/source/blender/blenkernel/BKE_customdata.h @@ -67,14 +67,14 @@ extern const CustomDataMask CD_MASK_EVERYTHING; * CD_NUMTYPES elements, that indicate if a layer can be copied. */ /* add/copy/merge allocation types */ -typedef enum CDAllocType { +typedef enum eCDAllocType { CD_ASSIGN = 0, /* use the data pointer */ CD_CALLOC = 1, /* allocate blank memory */ CD_DEFAULT = 2, /* allocate and set to default */ CD_REFERENCE = 3, /* use data pointers, set layer flag NOFREE */ CD_DUPLICATE = 4, /* do a full copy of all layers, only allowed if source * has same number of elements */ -} CDAllocType; +} eCDAllocType; #define CD_TYPE_AS_MASK(_type) (CustomDataMask)((CustomDataMask)1 << (CustomDataMask)(_type)) @@ -122,16 +122,18 @@ void CustomData_data_add(int type, void *data1, const void *data2); /* initializes a CustomData object with the same layer setup as source. * mask is a bitfield where (mask & (1 << (layer type))) indicates * if a layer should be copied or not. alloctype must be one of the above. */ -void CustomData_copy(const struct CustomData *source, struct CustomData *dest, - CustomDataMask mask, CDAllocType alloctype, int totelem); +void CustomData_copy( + const struct CustomData *source, struct CustomData *dest, + CustomDataMask mask, eCDAllocType alloctype, int totelem); /* BMESH_TODO, not really a public function but readfile.c needs it */ void CustomData_update_typemap(struct CustomData *data); /* same as the above, except that this will preserve existing layers, and only * add the layers that were not there yet */ -bool CustomData_merge(const struct CustomData *source, struct CustomData *dest, - CustomDataMask mask, CDAllocType alloctype, int totelem); +bool CustomData_merge( + const struct CustomData *source, struct CustomData *dest, + CustomDataMask mask, eCDAllocType alloctype, int totelem); /* Reallocate custom data to a new element count. * Only affects on data layers which are owned by the CustomData itself, @@ -146,7 +148,7 @@ void CustomData_realloc(struct CustomData *data, int totelem); * consistent with the new layout.*/ bool CustomData_bmesh_merge( const struct CustomData *source, struct CustomData *dest, - CustomDataMask mask, CDAllocType alloctype, struct BMesh *bm, const char htype); + CustomDataMask mask, eCDAllocType alloctype, struct BMesh *bm, const char htype); /** NULL's all members and resets the typemap. */ void CustomData_reset(struct CustomData *data); @@ -166,11 +168,13 @@ void CustomData_free_temporary(struct CustomData *data, int totelem); * backed by an external data array. the different allocation types are * defined above. returns the data of the layer. */ -void *CustomData_add_layer(struct CustomData *data, int type, CDAllocType alloctype, - void *layer, int totelem); +void *CustomData_add_layer( + struct CustomData *data, int type, eCDAllocType alloctype, + void *layer, int totelem); /*same as above but accepts a name */ -void *CustomData_add_layer_named(struct CustomData *data, int type, CDAllocType alloctype, - void *layer, int totelem, const char *name); +void *CustomData_add_layer_named( + struct CustomData *data, int type, eCDAllocType alloctype, + void *layer, int totelem, const char *name); /* frees the active or first data layer with the give type. * returns 1 on success, 0 if no layer with the given type is found diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c index 5ed7f6664a1..d2a3732a31d 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.c +++ b/source/blender/blenkernel/intern/DerivedMesh.c @@ -716,7 +716,7 @@ void DM_to_mesh(DerivedMesh *dm, Mesh *me, Object *ob, CustomDataMask mask, bool Mesh tmp = *me; int totvert, totedge /*, totface */ /* UNUSED */, totloop, totpoly; int did_shapekeys = 0; - CDAllocType alloctype = CD_DUPLICATE; + eCDAllocType alloctype = CD_DUPLICATE; if (take_ownership && dm->type == DM_TYPE_CDDM && dm->needsFree) { bool has_any_referenced_layers = @@ -911,27 +911,27 @@ static void mesh_set_only_copy(Mesh *mesh, CustomDataMask mask) #endif } -void DM_add_vert_layer(DerivedMesh *dm, int type, CDAllocType alloctype, void *layer) +void DM_add_vert_layer(DerivedMesh *dm, int type, eCDAllocType alloctype, void *layer) { CustomData_add_layer(&dm->vertData, type, alloctype, layer, dm->numVertData); } -void DM_add_edge_layer(DerivedMesh *dm, int type, CDAllocType alloctype, void *layer) +void DM_add_edge_layer(DerivedMesh *dm, int type, eCDAllocType alloctype, void *layer) { CustomData_add_layer(&dm->edgeData, type, alloctype, layer, dm->numEdgeData); } -void DM_add_tessface_layer(DerivedMesh *dm, int type, CDAllocType alloctype, void *layer) +void DM_add_tessface_layer(DerivedMesh *dm, int type, eCDAllocType alloctype, void *layer) { CustomData_add_layer(&dm->faceData, type, alloctype, layer, dm->numTessFaceData); } -void DM_add_loop_layer(DerivedMesh *dm, int type, CDAllocType alloctype, void *layer) +void DM_add_loop_layer(DerivedMesh *dm, int type, eCDAllocType alloctype, void *layer) { CustomData_add_layer(&dm->loopData, type, alloctype, layer, dm->numLoopData); } -void DM_add_poly_layer(DerivedMesh *dm, int type, CDAllocType alloctype, void *layer) +void DM_add_poly_layer(DerivedMesh *dm, int type, eCDAllocType alloctype, void *layer) { CustomData_add_layer(&dm->polyData, type, alloctype, layer, dm->numPolyData); } diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c index 346cea7150e..773ef90aac8 100644 --- a/source/blender/blenkernel/intern/cdderivedmesh.c +++ b/source/blender/blenkernel/intern/cdderivedmesh.c @@ -597,7 +597,7 @@ DerivedMesh *CDDM_from_mesh(Mesh *mesh) return CDDM_from_mesh_ex(mesh, CD_REFERENCE, CD_MASK_MESH); } -DerivedMesh *CDDM_from_mesh_ex(Mesh *mesh, CDAllocType alloctype, CustomDataMask mask) +DerivedMesh *CDDM_from_mesh_ex(Mesh *mesh, eCDAllocType alloctype, CustomDataMask mask) { CDDerivedMesh *cddm = cdDM_create(__func__); DerivedMesh *dm = &cddm->dm; diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c index 0c854551463..aa67eafaa98 100644 --- a/source/blender/blenkernel/intern/customdata.c +++ b/source/blender/blenkernel/intern/customdata.c @@ -1397,8 +1397,9 @@ void customData_mask_layers__print(CustomDataMask mask) /********************* CustomData functions *********************/ static void customData_update_offsets(CustomData *data); -static CustomDataLayer *customData_add_layer__internal(CustomData *data, int type, CDAllocType alloctype, void *layerdata, - int totelem, const char *name); +static CustomDataLayer *customData_add_layer__internal( + CustomData *data, int type, eCDAllocType alloctype, void *layerdata, + int totelem, const char *name); void CustomData_update_typemap(CustomData *data) { @@ -1427,8 +1428,9 @@ static bool customdata_typemap_is_valid(const CustomData *data) } #endif -bool CustomData_merge(const struct CustomData *source, struct CustomData *dest, - CustomDataMask mask, CDAllocType alloctype, int totelem) +bool CustomData_merge( + const struct CustomData *source, struct CustomData *dest, + CustomDataMask mask, eCDAllocType alloctype, int totelem) { /*const LayerTypeInfo *typeInfo;*/ CustomDataLayer *layer, *newlayer; @@ -1510,8 +1512,9 @@ void CustomData_realloc(CustomData *data, int totelem) } } -void CustomData_copy(const struct CustomData *source, struct CustomData *dest, - CustomDataMask mask, CDAllocType alloctype, int totelem) +void CustomData_copy( + const struct CustomData *source, struct CustomData *dest, + CustomDataMask mask, eCDAllocType alloctype, int totelem) { CustomData_reset(dest); @@ -1810,8 +1813,9 @@ static int customData_resize(CustomData *data, int amount) return 1; } -static CustomDataLayer *customData_add_layer__internal(CustomData *data, int type, CDAllocType alloctype, void *layerdata, - int totelem, const char *name) +static CustomDataLayer *customData_add_layer__internal( + CustomData *data, int type, eCDAllocType alloctype, void *layerdata, + int totelem, const char *name) { const LayerTypeInfo *typeInfo = layerType_getInfo(type); int flag = 0, index = data->totlayer; @@ -1898,8 +1902,9 @@ static CustomDataLayer *customData_add_layer__internal(CustomData *data, int typ return &data->layers[index]; } -void *CustomData_add_layer(CustomData *data, int type, CDAllocType alloctype, - void *layerdata, int totelem) +void *CustomData_add_layer( + CustomData *data, int type, eCDAllocType alloctype, + void *layerdata, int totelem) { CustomDataLayer *layer; const LayerTypeInfo *typeInfo = layerType_getInfo(type); @@ -1915,8 +1920,9 @@ void *CustomData_add_layer(CustomData *data, int type, CDAllocType alloctype, } /*same as above but accepts a name*/ -void *CustomData_add_layer_named(CustomData *data, int type, CDAllocType alloctype, - void *layerdata, int totelem, const char *name) +void *CustomData_add_layer_named( + CustomData *data, int type, eCDAllocType alloctype, + void *layerdata, int totelem, const char *name) { CustomDataLayer *layer; @@ -2673,7 +2679,7 @@ void CustomData_bmesh_init_pool(CustomData *data, int totelem, const char htype) bool CustomData_bmesh_merge( const CustomData *source, CustomData *dest, - CustomDataMask mask, CDAllocType alloctype, BMesh *bm, const char htype) + CustomDataMask mask, eCDAllocType alloctype, BMesh *bm, const char htype) { BMHeader *h; BMIter iter; -- cgit v1.2.3