Commit: a58dc25b077bfacf88bcdb8077633f30a049b96a Author: Jacques Lucke Date: Wed Jun 10 15:47:31 2020 +0200 Branches: master https://developer.blender.org/rBa58dc25b077bfacf88bcdb8077633f30a049b96a
Cleanup: improve custom data type names This is related to T76659. This just renames data type names to `CD_PROP_STRING`, `CD_PROP_FLOAT` and `CD_PROP_INT32`. It makes them a bit more specific and removes unnecessary abbreviations. Reviewers: brecht Differential Revision: https://developer.blender.org/D7980 =================================================================== M source/blender/blenkernel/intern/customdata.c M source/blender/blenkernel/intern/multires_unsubdivide.c M source/blender/bmesh/tools/bmesh_bevel.c M source/blender/editors/mesh/editmesh_tools.c M source/blender/editors/mesh/editmesh_utils.c M source/blender/editors/sculpt_paint/sculpt_dyntopo.c M source/blender/makesdna/DNA_customdata_types.h M source/blender/makesrna/intern/rna_mesh.c M source/blender/modifiers/intern/MOD_weighted_normal.c M source/blender/python/bmesh/bmesh_py_types_customdata.c M tests/gtests/bmesh/bmesh_core_test.cc =================================================================== diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c index 331762eee49..7dd4d1178ef 100644 --- a/source/blender/blenkernel/intern/customdata.c +++ b/source/blender/blenkernel/intern/customdata.c @@ -1549,7 +1549,7 @@ static const LayerTypeInfo LAYERTYPEINFO[CD_NUMTYPES] = { layerCopyValue_normal}, /* 9: CD_FACEMAP */ {sizeof(int), "", 0, NULL, NULL, NULL, NULL, NULL, layerDefault_fmap, NULL}, - /* 10: CD_PROP_FLT */ + /* 10: CD_PROP_FLOAT */ {sizeof(MFloatProperty), "MFloatProperty", 1, @@ -1560,9 +1560,9 @@ static const LayerTypeInfo LAYERTYPEINFO[CD_NUMTYPES] = { NULL, NULL, layerValidate_propFloat}, - /* 11: CD_PROP_INT */ + /* 11: CD_PROP_INT32 */ {sizeof(MIntProperty), "MIntProperty", 1, N_("Int"), layerCopy_propInt, NULL, NULL, NULL}, - /* 12: CD_PROP_STR */ + /* 12: CD_PROP_STRING */ {sizeof(MStringProperty), "MStringProperty", 1, @@ -4289,7 +4289,7 @@ int CustomData_layertype_layers_max(const int type) static bool CustomData_is_property_layer(int type) { - if ((type == CD_PROP_FLT) || (type == CD_PROP_INT) || (type == CD_PROP_STR)) { + if ((type == CD_PROP_FLOAT) || (type == CD_PROP_INT32) || (type == CD_PROP_STRING)) { return true; } return false; diff --git a/source/blender/blenkernel/intern/multires_unsubdivide.c b/source/blender/blenkernel/intern/multires_unsubdivide.c index e5000e7774f..6bd7b6b6a98 100644 --- a/source/blender/blenkernel/intern/multires_unsubdivide.c +++ b/source/blender/blenkernel/intern/multires_unsubdivide.c @@ -896,14 +896,14 @@ static const char vname[] = "v_remap_index"; static void multires_unsubdivide_free_original_datalayers(Mesh *mesh) { - const int l_layer_index = CustomData_get_named_layer_index(&mesh->ldata, CD_PROP_INT, lname); + const int l_layer_index = CustomData_get_named_layer_index(&mesh->ldata, CD_PROP_INT32, lname); if (l_layer_index != -1) { - CustomData_free_layer(&mesh->ldata, CD_PROP_INT, mesh->totloop, l_layer_index); + CustomData_free_layer(&mesh->ldata, CD_PROP_INT32, mesh->totloop, l_layer_index); } - const int v_layer_index = CustomData_get_named_layer_index(&mesh->vdata, CD_PROP_INT, vname); + const int v_layer_index = CustomData_get_named_layer_index(&mesh->vdata, CD_PROP_INT32, vname); if (v_layer_index != -1) { - CustomData_free_layer(&mesh->vdata, CD_PROP_INT, mesh->totvert, v_layer_index); + CustomData_free_layer(&mesh->vdata, CD_PROP_INT32, mesh->totvert, v_layer_index); } } @@ -916,10 +916,10 @@ static void multires_unsubdivide_add_original_index_datalayers(Mesh *mesh) multires_unsubdivide_free_original_datalayers(mesh); int *l_index = CustomData_add_layer_named( - &mesh->ldata, CD_PROP_INT, CD_CALLOC, NULL, mesh->totloop, lname); + &mesh->ldata, CD_PROP_INT32, CD_CALLOC, NULL, mesh->totloop, lname); int *v_index = CustomData_add_layer_named( - &mesh->vdata, CD_PROP_INT, CD_CALLOC, NULL, mesh->totvert, vname); + &mesh->vdata, CD_PROP_INT32, CD_CALLOC, NULL, mesh->totvert, vname); /* Initialize these data-layer with the indices in the current mesh. */ for (int i = 0; i < mesh->totloop; i++) { @@ -951,7 +951,7 @@ static void multires_unsubdivide_prepare_original_bmesh_for_extract( bm_original_mesh, BM_VERT | BM_EDGE | BM_FACE, BM_ELEM_SELECT, false); /* Get the mapping data-layer. */ - context->base_to_orig_vmap = CustomData_get_layer_named(&base_mesh->vdata, CD_PROP_INT, vname); + context->base_to_orig_vmap = CustomData_get_layer_named(&base_mesh->vdata, CD_PROP_INT32, vname); /* Tag the base mesh vertices in the original mesh. */ for (int i = 0; i < base_mesh->totvert; i++) { @@ -1013,7 +1013,7 @@ static void multires_unsubdivide_extract_grids(MultiresUnsubdivideContext *conte int *orig_to_base_vmap = MEM_calloc_arrayN(sizeof(int), bm_original_mesh->totvert, "orig vmap"); int *base_to_orig_vmap = MEM_calloc_arrayN(sizeof(int), base_mesh->totvert, "base vmap"); - context->base_to_orig_vmap = CustomData_get_layer_named(&base_mesh->vdata, CD_PROP_INT, vname); + context->base_to_orig_vmap = CustomData_get_layer_named(&base_mesh->vdata, CD_PROP_INT32, vname); for (int i = 0; i < base_mesh->totvert; i++) { base_to_orig_vmap[i] = context->base_to_orig_vmap[i]; } @@ -1034,7 +1034,7 @@ static void multires_unsubdivide_extract_grids(MultiresUnsubdivideContext *conte multires_unsubdivide_add_original_index_datalayers(base_mesh); const int base_l_layer_index = CustomData_get_named_layer_index( - &base_mesh->ldata, CD_PROP_INT, lname); + &base_mesh->ldata, CD_PROP_INT32, lname); BMesh *bm_base_mesh = get_bmesh_from_mesh(base_mesh); BMIter iter, iter_a, iter_b; BMVert *v; @@ -1045,7 +1045,7 @@ static void multires_unsubdivide_extract_grids(MultiresUnsubdivideContext *conte /* Get the data-layer that contains the loops indices. */ const int base_l_offset = CustomData_get_n_offset( - &bm_base_mesh->ldata, CD_PROP_INT, base_l_layer_index); + &bm_base_mesh->ldata, CD_PROP_INT32, base_l_layer_index); /* Main loop for extracting the grids. Iterates over the base mesh vertices. */ BM_ITER_MESH (v, &iter, bm_base_mesh, BM_VERTS_OF_MESH) { diff --git a/source/blender/bmesh/tools/bmesh_bevel.c b/source/blender/bmesh/tools/bmesh_bevel.c index 720eb34bda7..00b647555cf 100644 --- a/source/blender/bmesh/tools/bmesh_bevel.c +++ b/source/blender/bmesh/tools/bmesh_bevel.c @@ -2220,14 +2220,15 @@ static void bevel_set_weighted_normal_face_strength(BMesh *bm, BevelParams *bp) int mode = bp->face_strength_mode; bool do_set_strength; const char *wn_layer_id = MOD_WEIGHTEDNORMALS_FACEWEIGHT_CDLAYER_ID; - int cd_prop_int_idx = CustomData_get_named_layer_index(&bm->pdata, CD_PROP_INT, wn_layer_id); + int cd_prop_int_idx = CustomData_get_named_layer_index(&bm->pdata, CD_PROP_INT32, wn_layer_id); if (cd_prop_int_idx == -1) { - BM_data_layer_add_named(bm, &bm->pdata, CD_PROP_INT, wn_layer_id); - cd_prop_int_idx = CustomData_get_named_layer_index(&bm->pdata, CD_PROP_INT, wn_layer_id); + BM_data_layer_add_named(bm, &bm->pdata, CD_PROP_INT32, wn_layer_id); + cd_prop_int_idx = CustomData_get_named_layer_index(&bm->pdata, CD_PROP_INT32, wn_layer_id); } - cd_prop_int_idx -= CustomData_get_layer_index(&bm->pdata, CD_PROP_INT); - const int cd_prop_int_offset = CustomData_get_n_offset(&bm->pdata, CD_PROP_INT, cd_prop_int_idx); + cd_prop_int_idx -= CustomData_get_layer_index(&bm->pdata, CD_PROP_INT32); + const int cd_prop_int_offset = CustomData_get_n_offset( + &bm->pdata, CD_PROP_INT32, cd_prop_int_idx); BM_ITER_MESH (f, &fiter, bm, BM_FACES_OF_MESH) { fkind = get_face_kind(bp, f); diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index 684bb73dc0e..142bc119958 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -9372,14 +9372,14 @@ static int edbm_mod_weighted_strength_exec(bContext *C, wmOperator *op) BM_select_history_clear(bm); const char *layer_id = MOD_WEIGHTEDNORMALS_FACEWEIGHT_CDLAYER_ID; - int cd_prop_int_index = CustomData_get_named_layer_index(&bm->pdata, CD_PROP_INT, layer_id); + int cd_prop_int_index = CustomData_get_named_layer_index(&bm->pdata, CD_PROP_INT32, layer_id); if (cd_prop_int_index == -1) { - BM_data_layer_add_named(bm, &bm->pdata, CD_PROP_INT, layer_id); - cd_prop_int_index = CustomData_get_named_layer_index(&bm->pdata, CD_PROP_INT, layer_id); + BM_data_layer_add_named(bm, &bm->pdata, CD_PROP_INT32, layer_id); + cd_prop_int_index = CustomData_get_named_layer_index(&bm->pdata, CD_PROP_INT32, layer_id); } - cd_prop_int_index -= CustomData_get_layer_index(&bm->pdata, CD_PROP_INT); + cd_prop_int_index -= CustomData_get_layer_index(&bm->pdata, CD_PROP_INT32); const int cd_prop_int_offset = CustomData_get_n_offset( - &bm->pdata, CD_PROP_INT, cd_prop_int_index); + &bm->pdata, CD_PROP_INT32, cd_prop_int_index); BM_mesh_elem_index_ensure(bm, BM_FACE); diff --git a/source/blender/editors/mesh/editmesh_utils.c b/source/blender/editors/mesh/editmesh_utils.c index b5346a9061a..6c9973dc209 100644 --- a/source/blender/editors/mesh/editmesh_utils.c +++ b/source/blender/editors/mesh/editmesh_utils.c @@ -1089,16 +1089,16 @@ void EDBM_verts_mirror_cache_begin_ex(BMEditMesh *em, if (r_index == NULL) { const char *layer_id = BM_CD_LAYER_ID; - em->mirror_cdlayer = CustomData_get_named_layer_index(&bm->vdata, CD_PROP_INT, layer_id); + em->mirror_cdlayer = CustomData_get_named_layer_index(&bm->vdata, CD_PROP_INT32, layer_id); if (em->mirror_cdlayer == -1) { - BM_data_layer_add_named(bm, &bm->vdata, CD_PROP_INT, layer_id); - em->mirror_cdlayer = CustomData_get_named_layer_index(&bm->vdata, CD_PROP_INT, layer_id); + BM_data_layer_add_named(bm, &bm->vdata, CD_PROP_INT32, layer_id); + em->mirror_cdlayer = CustomData_get_named_layer_index(&bm->vdata, CD_PROP_INT32, layer_id); } cd_vmirr_offset = CustomData_get_n_offset( &bm->vdata, - CD_PROP_INT, - em->mirror_cdlayer - CustomData_get_layer_index(&bm->vdata, CD_PROP_INT)); + CD_PROP_INT32, + em->mirror_cdlayer - CustomData_get_layer_index(&bm->vdata, CD_PROP_INT32)); bm->vdata.layers[em->mirror_cdlayer].flag |= CD_FLAG_TEMPORARY; } diff --git a/source/blender/editors/sculpt_paint/sculpt_dyntopo.c b/source/blender/editors/sculpt_paint/sculpt_dyntopo.c index eefd8529dbf..f07d22ed639 100644 --- a/source/blender/editors/sculpt_paint/sculpt_dyntopo.c +++ b/source/blender/editors/sculpt_paint/sculpt_dyntopo.c @@ -114,29 +114,31 @@ void SCULPT_dyntopo_node_layers_add(SculptSession *ss) char layer_id[] = "_dyntopo_node_id"; - cd_node_layer_index = CustomData_get_named_layer_index(&ss->bm->vdata, CD_PROP_INT, layer_id); + cd_node_layer_index = CustomData_get_named_layer_index(&ss->bm->vdata, CD_PROP_INT32, layer_id); if (cd_node_layer_index == -1) { - BM_data_layer_add_named(ss->bm, &ss->bm->vdata, CD_PRO @@ Diff output truncated at 10240 characters. @@ _______________________________________________ Bf-blender-cvs mailing list [email protected] https://lists.blender.org/mailman/listinfo/bf-blender-cvs
