diff options
51 files changed, 188 insertions, 170 deletions
diff --git a/source/blender/blenkernel/intern/DerivedMesh.cc b/source/blender/blenkernel/intern/DerivedMesh.cc index 33f0c331e46..4b4507a425f 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.cc +++ b/source/blender/blenkernel/intern/DerivedMesh.cc @@ -1745,13 +1745,13 @@ static void object_get_datamask(const Depsgraph *depsgraph, /* check if we need tfaces & mcols due to face select or texture paint */ if ((ob->mode & OB_MODE_TEXTURE_PAINT) || editing) { - r_mask->lmask |= CD_MASK_MLOOPUV | CD_MASK_MLOOPCOL; + r_mask->lmask |= CD_MASK_MLOOPUV | CD_MASK_PROP_BYTE_COLOR; r_mask->fmask |= CD_MASK_MTFACE; } /* check if we need mcols due to vertex paint or weightpaint */ if (ob->mode & OB_MODE_VERTEX_PAINT) { - r_mask->lmask |= CD_MASK_MLOOPCOL; + r_mask->lmask |= CD_MASK_PROP_BYTE_COLOR; } if (ob->mode & OB_MODE_WEIGHT_PAINT) { diff --git a/source/blender/blenkernel/intern/attribute.c b/source/blender/blenkernel/intern/attribute.c index 307868ce6d9..9b8ae4b3804 100644 --- a/source/blender/blenkernel/intern/attribute.c +++ b/source/blender/blenkernel/intern/attribute.c @@ -622,10 +622,10 @@ CustomDataLayer *BKE_id_attributes_color_find(const ID *id, const char *name) layer = BKE_id_attribute_find(id, name, CD_PROP_COLOR, ATTR_DOMAIN_CORNER); } if (layer == NULL) { - layer = BKE_id_attribute_find(id, name, CD_MLOOPCOL, ATTR_DOMAIN_POINT); + layer = BKE_id_attribute_find(id, name, CD_PROP_BYTE_COLOR, ATTR_DOMAIN_POINT); } if (layer == NULL) { - layer = BKE_id_attribute_find(id, name, CD_MLOOPCOL, ATTR_DOMAIN_CORNER); + layer = BKE_id_attribute_find(id, name, CD_PROP_BYTE_COLOR, ATTR_DOMAIN_CORNER); } return layer; } diff --git a/source/blender/blenkernel/intern/attribute_access.cc b/source/blender/blenkernel/intern/attribute_access.cc index 0ae9fa4356b..7e1fc8ca02c 100644 --- a/source/blender/blenkernel/intern/attribute_access.cc +++ b/source/blender/blenkernel/intern/attribute_access.cc @@ -73,7 +73,7 @@ static int attribute_data_type_complexity(const CustomDataType data_type) case CD_PROP_COLOR: return 6; #if 0 /* These attribute types are not supported yet. */ - case CD_MLOOPCOL: + case CD_PROP_BYTE_COLOR: return 3; case CD_PROP_STRING: return 6; diff --git a/source/blender/blenkernel/intern/customdata.cc b/source/blender/blenkernel/intern/customdata.cc index 6dd9460aaa9..6b6ee5b04ea 100644 --- a/source/blender/blenkernel/intern/customdata.cc +++ b/source/blender/blenkernel/intern/customdata.cc @@ -1716,7 +1716,7 @@ static const LayerTypeInfo LAYERTYPEINFO[CD_NUMTYPES] = { nullptr, nullptr, layerMaxNum_tface}, - /* 17: CD_MLOOPCOL */ + /* 17: CD_PROP_BYTE_COLOR */ {sizeof(MLoopCol), "MLoopCol", 1, @@ -2059,7 +2059,7 @@ const CustomData_MeshMasks CD_MASK_MESH = { (CD_MASK_MPOLY | CD_MASK_FACEMAP | CD_MASK_FREESTYLE_FACE | CD_MASK_PROP_ALL | CD_MASK_SCULPT_FACE_SETS), /* lmask */ - (CD_MASK_MLOOP | CD_MASK_MDISPS | CD_MASK_MLOOPUV | CD_MASK_MLOOPCOL | + (CD_MASK_MLOOP | CD_MASK_MDISPS | CD_MASK_MLOOPUV | CD_MASK_PROP_BYTE_COLOR | CD_MASK_CUSTOMLOOPNORMAL | CD_MASK_GRID_PAINT_MASK | CD_MASK_PROP_ALL), }; const CustomData_MeshMasks CD_MASK_DERIVEDMESH = { @@ -2072,8 +2072,9 @@ const CustomData_MeshMasks CD_MASK_DERIVEDMESH = { (CD_MASK_ORIGINDEX | CD_MASK_FREESTYLE_FACE | CD_MASK_FACEMAP | CD_MASK_PROP_ALL | CD_MASK_SCULPT_FACE_SETS), /* lmask */ - (CD_MASK_MLOOPUV | CD_MASK_MLOOPCOL | CD_MASK_CUSTOMLOOPNORMAL | CD_MASK_PREVIEW_MLOOPCOL | - CD_MASK_ORIGSPACE_MLOOP | CD_MASK_PROP_ALL), /* XXX MISSING CD_MASK_MLOOPTANGENT ? */ + (CD_MASK_MLOOPUV | CD_MASK_PROP_BYTE_COLOR | CD_MASK_CUSTOMLOOPNORMAL | + CD_MASK_PREVIEW_MLOOPCOL | CD_MASK_ORIGSPACE_MLOOP | + CD_MASK_PROP_ALL), /* XXX MISSING CD_MASK_MLOOPTANGENT ? */ }; const CustomData_MeshMasks CD_MASK_BMESH = { /* vmask */ (CD_MASK_MDEFORMVERT | CD_MASK_BWEIGHT | CD_MASK_MVERT_SKIN | CD_MASK_SHAPEKEY | @@ -2084,7 +2085,7 @@ const CustomData_MeshMasks CD_MASK_BMESH = { /* pmask */ (CD_MASK_FREESTYLE_FACE | CD_MASK_FACEMAP | CD_MASK_PROP_ALL | CD_MASK_SCULPT_FACE_SETS), /* lmask */ - (CD_MASK_MDISPS | CD_MASK_MLOOPUV | CD_MASK_MLOOPCOL | CD_MASK_CUSTOMLOOPNORMAL | + (CD_MASK_MDISPS | CD_MASK_MLOOPUV | CD_MASK_PROP_BYTE_COLOR | CD_MASK_CUSTOMLOOPNORMAL | CD_MASK_GRID_PAINT_MASK | CD_MASK_PROP_ALL), }; const CustomData_MeshMasks CD_MASK_EVERYTHING = { @@ -2104,7 +2105,7 @@ const CustomData_MeshMasks CD_MASK_EVERYTHING = { CD_MASK_FREESTYLE_FACE | CD_MASK_PROP_ALL | CD_MASK_SCULPT_FACE_SETS), /* lmask */ (CD_MASK_MLOOP | CD_MASK_BM_ELEM_PYPTR | CD_MASK_MDISPS | CD_MASK_NORMAL | CD_MASK_MLOOPUV | - CD_MASK_MLOOPCOL | CD_MASK_CUSTOMLOOPNORMAL | CD_MASK_MLOOPTANGENT | + CD_MASK_PROP_BYTE_COLOR | CD_MASK_CUSTOMLOOPNORMAL | CD_MASK_MLOOPTANGENT | CD_MASK_PREVIEW_MLOOPCOL | CD_MASK_ORIGSPACE_MLOOP | CD_MASK_GRID_PAINT_MASK | CD_MASK_PROP_ALL), }; @@ -3486,7 +3487,7 @@ void CustomData_to_bmeshpoly(CustomData *fdata, CustomData *ldata, int totloop) } else if (fdata->layers[i].type == CD_MCOL) { CustomData_add_layer_named( - ldata, CD_MLOOPCOL, CD_CALLOC, nullptr, totloop, fdata->layers[i].name); + ldata, CD_PROP_BYTE_COLOR, CD_CALLOC, nullptr, totloop, fdata->layers[i].name); } else if (fdata->layers[i].type == CD_MDISPS) { CustomData_add_layer_named( @@ -3509,7 +3510,7 @@ void CustomData_from_bmeshpoly(CustomData *fdata, CustomData *ldata, int total) CustomData_add_layer_named( fdata, CD_MTFACE, CD_CALLOC, nullptr, total, ldata->layers[i].name); } - if (ldata->layers[i].type == CD_MLOOPCOL) { + if (ldata->layers[i].type == CD_PROP_BYTE_COLOR) { CustomData_add_layer_named(fdata, CD_MCOL, CD_CALLOC, nullptr, total, ldata->layers[i].name); } else if (ldata->layers[i].type == CD_PREVIEW_MLOOPCOL) { @@ -3544,7 +3545,7 @@ bool CustomData_from_bmeshpoly_test(CustomData *fdata, CustomData *ldata, bool f if (!LAYER_CMP(ldata, CD_MLOOPUV, fdata, CD_MTFACE)) { return false; } - if (!LAYER_CMP(ldata, CD_MLOOPCOL, fdata, CD_MCOL)) { + if (!LAYER_CMP(ldata, CD_PROP_BYTE_COLOR, fdata, CD_MCOL)) { return false; } if (!LAYER_CMP(ldata, CD_PREVIEW_MLOOPCOL, fdata, CD_PREVIEW_MCOL)) { @@ -3586,17 +3587,17 @@ void CustomData_bmesh_update_active_layers(CustomData *fdata, CustomData *ldata) CustomData_set_layer_stencil(fdata, CD_MTFACE, act); } - if (CustomData_has_layer(ldata, CD_MLOOPCOL)) { - act = CustomData_get_active_layer(ldata, CD_MLOOPCOL); + if (CustomData_has_layer(ldata, CD_PROP_BYTE_COLOR)) { + act = CustomData_get_active_layer(ldata, CD_PROP_BYTE_COLOR); CustomData_set_layer_active(fdata, CD_MCOL, act); - act = CustomData_get_render_layer(ldata, CD_MLOOPCOL); + act = CustomData_get_render_layer(ldata, CD_PROP_BYTE_COLOR); CustomData_set_layer_render(fdata, CD_MCOL, act); - act = CustomData_get_clone_layer(ldata, CD_MLOOPCOL); + act = CustomData_get_clone_layer(ldata, CD_PROP_BYTE_COLOR); CustomData_set_layer_clone(fdata, CD_MCOL, act); - act = CustomData_get_stencil_layer(ldata, CD_MLOOPCOL); + act = CustomData_get_stencil_layer(ldata, CD_PROP_BYTE_COLOR); CustomData_set_layer_stencil(fdata, CD_MCOL, act); } } @@ -3621,16 +3622,16 @@ void CustomData_bmesh_do_versions_update_active_layers(CustomData *fdata, Custom if (CustomData_has_layer(fdata, CD_MCOL)) { act = CustomData_get_active_layer(fdata, CD_MCOL); - CustomData_set_layer_active(ldata, CD_MLOOPCOL, act); + CustomData_set_layer_active(ldata, CD_PROP_BYTE_COLOR, act); act = CustomData_get_render_layer(fdata, CD_MCOL); - CustomData_set_layer_render(ldata, CD_MLOOPCOL, act); + CustomData_set_layer_render(ldata, CD_PROP_BYTE_COLOR, act); act = CustomData_get_clone_layer(fdata, CD_MCOL); - CustomData_set_layer_clone(ldata, CD_MLOOPCOL, act); + CustomData_set_layer_clone(ldata, CD_PROP_BYTE_COLOR, act); act = CustomData_get_stencil_layer(fdata, CD_MCOL); - CustomData_set_layer_stencil(ldata, CD_MLOOPCOL, act); + CustomData_set_layer_stencil(ldata, CD_PROP_BYTE_COLOR, act); } } diff --git a/source/blender/blenkernel/intern/data_transfer.c b/source/blender/blenkernel/intern/data_transfer.c index 2369ce88ebc..f1365256fed 100644 --- a/source/blender/blenkernel/intern/data_transfer.c +++ b/source/blender/blenkernel/intern/data_transfer.c @@ -217,7 +217,7 @@ int BKE_object_data_transfer_dttype_to_cdtype(const int dtdata_type) return CD_FAKE_LNOR; case DT_TYPE_MLOOPCOL_VERT: case DT_TYPE_MLOOPCOL_LOOP: - return CD_MLOOPCOL; + return CD_PROP_BYTE_COLOR; case DT_TYPE_MPROPCOL_VERT: case DT_TYPE_MPROPCOL_LOOP: return CD_PROP_COLOR; diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c index 01fd53d1ea2..22341f98375 100644 --- a/source/blender/blenkernel/intern/dynamicpaint.c +++ b/source/blender/blenkernel/intern/dynamicpaint.c @@ -336,7 +336,7 @@ bool dynamicPaint_outputLayerExists(struct DynamicPaintSurface *surface, Object if (surface->format == MOD_DPAINT_SURFACE_F_VERTEX) { if (surface->type == MOD_DPAINT_SURFACE_T_PAINT) { Mesh *me = ob->data; - return (CustomData_get_named_layer_index(&me->ldata, CD_MLOOPCOL, name) != -1); + return (CustomData_get_named_layer_index(&me->ldata, CD_PROP_BYTE_COLOR, name) != -1); } if (surface->type == MOD_DPAINT_SURFACE_T_WEIGHT) { return (BKE_object_defgroup_name_index(ob, name) != -1); @@ -1664,7 +1664,7 @@ static void dynamicPaint_setInitialColor(const Scene *scene, DynamicPaintSurface const MLoop *mloop = mesh->mloop; const int totloop = mesh->totloop; const MLoopCol *col = CustomData_get_layer_named( - &mesh->ldata, CD_MLOOPCOL, surface->init_layername); + &mesh->ldata, CD_PROP_BYTE_COLOR, surface->init_layername); if (!col) { return; } @@ -1676,7 +1676,7 @@ static void dynamicPaint_setInitialColor(const Scene *scene, DynamicPaintSurface else if (surface->format == MOD_DPAINT_SURFACE_F_IMAGESEQ) { const MLoopTri *mlooptri = BKE_mesh_runtime_looptri_ensure(mesh); MLoopCol *col = CustomData_get_layer_named( - &mesh->ldata, CD_MLOOPCOL, surface->init_layername); + &mesh->ldata, CD_PROP_BYTE_COLOR, surface->init_layername); if (!col) { return; } @@ -1940,20 +1940,28 @@ static Mesh *dynamicPaint_Modifier_apply(DynamicPaintModifierData *pmd, Object * /* paint layer */ MLoopCol *mloopcol = CustomData_get_layer_named( - &result->ldata, CD_MLOOPCOL, surface->output_name); + &result->ldata, CD_PROP_BYTE_COLOR, surface->output_name); /* if output layer is lost from a constructive modifier, re-add it */ if (!mloopcol && dynamicPaint_outputLayerExists(surface, ob, 0)) { - mloopcol = CustomData_add_layer_named( - &result->ldata, CD_MLOOPCOL, CD_CALLOC, NULL, totloop, surface->output_name); + mloopcol = CustomData_add_layer_named(&result->ldata, + CD_PROP_BYTE_COLOR, + CD_CALLOC, + NULL, + totloop, + surface->output_name); } /* wet layer */ MLoopCol *mloopcol_wet = CustomData_get_layer_named( - &result->ldata, CD_MLOOPCOL, surface->output_name2); + &result->ldata, CD_PROP_BYTE_COLOR, surface->output_name2); /* if output layer is lost from a constructive modifier, re-add it */ if (!mloopcol_wet && dynamicPaint_outputLayerExists(surface, ob, 1)) { - mloopcol_wet = CustomData_add_layer_named( - &result->ldata, CD_MLOOPCOL, CD_CALLOC, NULL, totloop, surface->output_name2); + mloopcol_wet = CustomData_add_layer_named(&result->ldata, + CD_PROP_BYTE_COLOR, + CD_CALLOC, + NULL, + totloop, + surface->output_name2); } data.ob = ob; diff --git a/source/blender/blenkernel/intern/geometry_component_mesh.cc b/source/blender/blenkernel/intern/geometry_component_mesh.cc index 47f7bb00b8f..597e4efe284 100644 --- a/source/blender/blenkernel/intern/geometry_component_mesh.cc +++ b/source/blender/blenkernel/intern/geometry_component_mesh.cc @@ -1296,7 +1296,7 @@ static ComponentAttributeProviders create_attribute_providers_for_mesh() static NamedLegacyCustomDataProvider vertex_colors( ATTR_DOMAIN_CORNER, CD_PROP_COLOR, - CD_MLOOPCOL, + CD_PROP_BYTE_COLOR, corner_access, make_derived_read_attribute<MLoopCol, ColorGeometry4f, get_loop_color>, make_derived_write_attribute<MLoopCol, ColorGeometry4f, get_loop_color, set_loop_color>); diff --git a/source/blender/blenkernel/intern/mesh.cc b/source/blender/blenkernel/intern/mesh.cc index 7f005fda6a5..c13a2bc794a 100644 --- a/source/blender/blenkernel/intern/mesh.cc +++ b/source/blender/blenkernel/intern/mesh.cc @@ -463,7 +463,8 @@ static int customdata_compare( CustomDataLayer *l1, *l2; int layer_count1 = 0, layer_count2 = 0, j; const uint64_t cd_mask_non_generic = CD_MASK_MVERT | CD_MASK_MEDGE | CD_MASK_MPOLY | - CD_MASK_MLOOPUV | CD_MASK_MLOOPCOL | CD_MASK_MDEFORMVERT; + CD_MASK_MLOOPUV | CD_MASK_PROP_BYTE_COLOR | + CD_MASK_MDEFORMVERT; const uint64_t cd_mask_all_attr = CD_MASK_PROP_ALL | cd_mask_non_generic; for (int i = 0; i < c1->totlayer; i++) { @@ -581,7 +582,7 @@ static int customdata_compare( } break; } - case CD_MLOOPCOL: { + case CD_PROP_BYTE_COLOR: { MLoopCol *lp1 = (MLoopCol *)l1->data; MLoopCol *lp2 = (MLoopCol *)l2->data; int ltot = m1->totloop; @@ -768,7 +769,7 @@ static void mesh_ensure_tessellation_customdata(Mesh *me) } else { const int tottex_original = CustomData_number_of_layers(&me->ldata, CD_MLOOPUV); - const int totcol_original = CustomData_number_of_layers(&me->ldata, CD_MLOOPCOL); + const int totcol_original = CustomData_number_of_layers(&me->ldata, CD_PROP_BYTE_COLOR); const int tottex_tessface = CustomData_number_of_layers(&me->fdata, CD_MTFACE); const int totcol_tessface = CustomData_number_of_layers(&me->fdata, CD_MCOL); @@ -786,7 +787,8 @@ static void mesh_ensure_tessellation_customdata(Mesh *me) * some info to help troubleshoot what's going on. */ printf( "%s: warning! Tessellation uvs or vcol data got out of sync, " - "had to reset!\n CD_MTFACE: %d != CD_MLOOPUV: %d || CD_MCOL: %d != CD_MLOOPCOL: " + "had to reset!\n CD_MTFACE: %d != CD_MLOOPUV: %d || CD_MCOL: %d != " + "CD_PROP_BYTE_COLOR: " "%d\n", __func__, tottex_tessface, @@ -871,7 +873,7 @@ bool BKE_mesh_clear_facemap_customdata(struct Mesh *me) /** * This ensures grouped custom-data (e.g. #CD_MLOOPUV and #CD_MTFACE, or - * #CD_MLOOPCOL and #CD_MCOL) have the same relative active/render/clone/mask indices. + * #CD_PROP_BYTE_COLOR and #CD_MCOL) have the same relative active/render/clone/mask indices. * * NOTE(@campbellbarton): that for undo mesh data we want to skip 'ensure_tess_cd' call since * we don't want to store memory for #MFace data when its only used for older @@ -902,7 +904,7 @@ void BKE_mesh_update_customdata_pointers(Mesh *me, const bool do_ensure_tess_cd) me->mpoly = (MPoly *)CustomData_get_layer(&me->pdata, CD_MPOLY); me->mloop = (MLoop *)CustomData_get_layer(&me->ldata, CD_MLOOP); - me->mloopcol = (MLoopCol *)CustomData_get_layer(&me->ldata, CD_MLOOPCOL); + me->mloopcol = (MLoopCol *)CustomData_get_layer(&me->ldata, CD_PROP_BYTE_COLOR); me->mloopuv = (MLoopUV *)CustomData_get_layer(&me->ldata, CD_MLOOPUV); } diff --git a/source/blender/blenkernel/intern/mesh_evaluate.cc b/source/blender/blenkernel/intern/mesh_evaluate.cc index 6c5a5de31fc..ec2660a0145 100644 --- a/source/blender/blenkernel/intern/mesh_evaluate.cc +++ b/source/blender/blenkernel/intern/mesh_evaluate.cc @@ -661,7 +661,7 @@ static void bm_corners_to_loops_ex(ID *id, } for (int i = 0; i < numCol; i++) { - MLoopCol *mloopcol = (MLoopCol *)CustomData_get_n(ldata, CD_MLOOPCOL, loopstart, i); + MLoopCol *mloopcol = (MLoopCol *)CustomData_get_n(ldata, CD_PROP_BYTE_COLOR, loopstart, i); MCol *mcol = (MCol *)CustomData_get_n(fdata, CD_MCOL, findex, i); MESH_MLOOPCOL_FROM_MCOL(mloopcol, &mcol[0]); diff --git a/source/blender/blenkernel/intern/mesh_tessellate.c b/source/blender/blenkernel/intern/mesh_tessellate.c index ae52e31cb9b..ea3cc043267 100644 --- a/source/blender/blenkernel/intern/mesh_tessellate.c +++ b/source/blender/blenkernel/intern/mesh_tessellate.c @@ -58,7 +58,7 @@ static void mesh_loops_to_tessdata(CustomData *fdata, * The issue is, unless having two different functions with nearly the same code, * there's not much ways to solve this. Better IMHO to live with it for now (sigh). */ const int numUV = CustomData_number_of_layers(ldata, CD_MLOOPUV); - const int numCol = CustomData_number_of_layers(ldata, CD_MLOOPCOL); + const int numCol = CustomData_number_of_layers(ldata, CD_PROP_BYTE_COLOR); const bool hasPCol = CustomData_has_layer(ldata, CD_PREVIEW_MLOOPCOL); const bool hasOrigSpace = CustomData_has_layer(ldata, CD_ORIGSPACE_MLOOP); const bool hasLoopNormal = CustomData_has_layer(ldata, CD_NORMAL); @@ -81,7 +81,7 @@ static void mesh_loops_to_tessdata(CustomData *fdata, for (i = 0; i < numCol; i++) { MCol(*mcol)[4] = CustomData_get_layer_n(fdata, CD_MCOL, i); - MLoopCol *mloopcol = CustomData_get_layer_n(ldata, CD_MLOOPCOL, i); + MLoopCol *mloopcol = CustomData_get_layer_n(ldata, CD_PROP_BYTE_COLOR, i); for (findex = 0, lidx = loopindices; findex < num_faces; lidx++, findex++, mcol++) { for (j = (mface ? mface[findex].v4 : (*lidx)[3]) ? 4 : 3; j--;) { diff --git a/source/blender/blenkernel/intern/mesh_validate.cc b/source/blender/blenkernel/intern/mesh_validate.cc index 6af765d7de5..d16f7eaf588 100644 --- a/source/blender/blenkernel/intern/mesh_validate.cc +++ b/source/blender/blenkernel/intern/mesh_validate.cc @@ -1017,7 +1017,7 @@ bool BKE_mesh_validate_all_customdata(CustomData *vdata, pdata, mask.pmask, totpoly, do_verbose, do_fixes, &is_change_p); const int tot_uvloop = CustomData_number_of_layers(ldata, CD_MLOOPUV); - const int tot_vcolloop = CustomData_number_of_layers(ldata, CD_MLOOPCOL); + const int tot_vcolloop = CustomData_number_of_layers(ldata, CD_PROP_BYTE_COLOR); if (tot_uvloop > MAX_MTFACE) { PRINT_ERR( "\tMore UV layers than %d allowed, %d last ones won't be available for render, shaders, " diff --git a/source/blender/blenkernel/intern/object_update.c b/source/blender/blenkernel/intern/object_update.c index fbbd429f58a..f41d59c77ba 100644 --- a/source/blender/blenkernel/intern/object_update.c +++ b/source/blender/blenkernel/intern/object_update.c @@ -167,7 +167,7 @@ void BKE_object_handle_data_update(Depsgraph *depsgraph, Scene *scene, Object *o #endif if (DEG_get_mode(depsgraph) == DAG_EVAL_RENDER) { /* Always compute UVs, vertex colors as orcos for render. */ - cddata_masks.lmask |= CD_MASK_MLOOPUV | CD_MASK_MLOOPCOL; + cddata_masks.lmask |= CD_MASK_MLOOPUV | CD_MASK_PROP_BYTE_COLOR; cddata_masks.vmask |= CD_MASK_ORCO | CD_MASK_PROP_COLOR; } makeDerivedMesh(depsgraph, scene, ob, &cddata_masks); /* was CD_MASK_BAREMESH */ diff --git a/source/blender/blenkernel/intern/paint.c b/source/blender/blenkernel/intern/paint.c index 5fd7984ea90..fe8b002302c 100644 --- a/source/blender/blenkernel/intern/paint.c +++ b/source/blender/blenkernel/intern/paint.c @@ -1845,7 +1845,7 @@ void BKE_sculpt_color_layer_create_if_needed(struct Object *object) { Mesh *orig_me = BKE_object_get_original_mesh(object); - int types[] = {CD_PROP_COLOR, CD_MLOOPCOL}; + int types[] = {CD_PROP_COLOR, CD_PROP_BYTE_COLOR}; bool has_color = false; for (int i = 0; i < ARRAY_SIZE(types); i++) { diff --git a/source/blender/blenkernel/intern/pbvh.c b/source/blender/blenkernel/intern/pbvh.c index e91f360ef22..1fb1570b3ff 100644 --- a/source/blender/blenkernel/intern/pbvh.c +++ b/source/blender/blenkernel/intern/pbvh.c @@ -1267,7 +1267,7 @@ bool BKE_pbvh_get_color_layer(const Mesh *me, CustomDataLayer **r_layer, Attribu { CustomDataLayer *layer = BKE_id_attributes_active_color_get((ID *)me); - if (!layer || !ELEM(layer->type, CD_PROP_COLOR, CD_MLOOPCOL)) { + if (!layer || !ELEM(layer->type, CD_PROP_COLOR, CD_PROP_BYTE_COLOR)) { *r_layer = NULL; *r_attr = ATTR_DOMAIN_NUM; return false; diff --git a/source/blender/blenkernel/intern/pbvh.cc b/source/blender/blenkernel/intern/pbvh.cc index d32a03186e3..be6e95426c2 100644 --- a/source/blender/blenkernel/intern/pbvh.cc +++ b/source/blender/blenkernel/intern/pbvh.cc @@ -50,7 +50,7 @@ inline void to_static_color_type(const CustomDataType type, const Func &func) case CD_PROP_COLOR: func(MPropCol()); break; - case CD_MLOOPCOL: + case CD_PROP_BYTE_COLOR: func(MLoopCol()); break; default: diff --git a/source/blender/blenloader/intern/versioning_260.c b/source/blender/blenloader/intern/versioning_260.c index 655dc297c35..e4a93762da4 100644 --- a/source/blender/blenloader/intern/versioning_260.c +++ b/source/blender/blenloader/intern/versioning_260.c @@ -357,7 +357,7 @@ static void do_versions_mesh_mloopcol_swap_2_62_1(Mesh *me) for (a = 0; a < me->ldata.totlayer; a++) { layer = &me->ldata.layers[a]; - if (layer->type == CD_MLOOPCOL) { + if (layer->type == CD_PROP_BYTE_COLOR) { mloopcol = (MLoopCol *)layer->data; for (i = 0; i < me->totloop; i++, mloopcol++) { SWAP(uchar, mloopcol->r, mloopcol->b); diff --git a/source/blender/blenloader/intern/versioning_300.c b/source/blender/blenloader/intern/versioning_300.c index ec60183218c..ddd9405c571 100644 --- a/source/blender/blenloader/intern/versioning_300.c +++ b/source/blender/blenloader/intern/versioning_300.c @@ -2590,11 +2590,11 @@ void blo_do_versions_300(FileData *fd, Library *UNUSED(lib), Main *bmain) if (step) { vact1 = CustomData_get_render_layer_index(&me->vdata, CD_PROP_COLOR); - vact2 = CustomData_get_render_layer_index(&me->ldata, CD_MLOOPCOL); + vact2 = CustomData_get_render_layer_index(&me->ldata, CD_PROP_BYTE_COLOR); } else { vact1 = CustomData_get_active_layer_index(&me->vdata, CD_PROP_COLOR); - vact2 = CustomData_get_active_layer_index(&me->ldata, CD_MLOOPCOL); + vact2 = CustomData_get_active_layer_index(&me->ldata, CD_PROP_BYTE_COLOR); } if (vact1 != -1) { diff --git a/source/blender/bmesh/operators/bmo_join_triangles.c b/source/blender/bmesh/operators/bmo_join_triangles.c index 35614069f96..aa7f0f511ec 100644 --- a/source/blender/bmesh/operators/bmo_join_triangles.c +++ b/source/blender/bmesh/operators/bmo_join_triangles.c @@ -282,7 +282,7 @@ void bmo_join_triangles_exec(BMesh *bm, BMOperator *op) delimit_data.cdata[delimit_data.cdata_len].cd_offset = -1; if (BMO_slot_bool_get(op->slots_in, "cmp_vcols") && bm_edge_delimit_cdata( - &bm->ldata, CD_MLOOPCOL, &delimit_data.cdata[delimit_data.cdata_len])) { + &bm->ldata, CD_PROP_BYTE_COLOR, &delimit_data.cdata[delimit_data.cdata_len])) { delimit_data.cdata_len += 1; } diff --git a/source/blender/draw/engines/workbench/workbench_engine.c b/source/blender/draw/engines/workbench/workbench_engine.c index ccd693bc4c2..60919d0d028 100644 --- a/source/blender/draw/engines/workbench/workbench_engine.c +++ b/source/blender/draw/engines/workbench/workbench_engine.c @@ -289,9 +289,9 @@ static eV3DShadingColorType workbench_color_type_get(WORKBENCH_PrivateData *wpd, const CustomData *cd_ldata = workbench_mesh_get_loop_custom_data(me); bool has_color = (CustomData_has_layer(cd_vdata, CD_PROP_COLOR) || - CustomData_has_layer(cd_vdata, CD_MLOOPCOL) || + CustomData_has_layer(cd_vdata, CD_PROP_BYTE_COLOR) || CustomData_has_layer(cd_ldata, CD_PROP_COLOR) || - CustomData_has_layer(cd_ldata, CD_MLOOPCOL)); + CustomData_has_layer(cd_ldata, CD_PROP_BYTE_COLOR)); if (!has_color) { color_type = V3D_SHADING_OBJECT_COLOR; @@ -314,7 +314,7 @@ static eV3DShadingColorType workbench_color_type_get(WORKBENCH_PrivateData *wpd, *r_texpaint_mode = true; } } - else if (is_vertpaint_mode && me && CustomData_has_layer(ldata, CD_MLOOPCOL)) { + else if (is_vertpaint_mode && me && CustomData_has_layer(ldata, CD_PROP_BYTE_COLOR)) { color_type = V3D_SHADING_VERTEX_COLOR; } } diff --git a/source/blender/draw/intern/draw_cache_impl_mesh.c b/source/blender/draw/intern/draw_cache_impl_mesh.c index c4fa60ef51d..e4aec17eb69 100644 --- a/source/blender/draw/intern/draw_cache_impl_mesh.c +++ b/source/blender/draw/intern/draw_cache_impl_mesh.c @@ -518,15 +518,17 @@ static uint mesh_cd_calc_gpu_layers_vcol_used(const Mesh *me_query, domain = ATTR_DOMAIN_POINT; layer_i = CustomData_get_named_layer_index(cd_vdata, CD_PROP_COLOR, name); - layer_i = layer_i == -1 ? CustomData_get_named_layer_index(cd_vdata, CD_MLOOPCOL, name) : - layer_i; + layer_i = layer_i == -1 ? + CustomData_get_named_layer_index(cd_vdata, CD_PROP_BYTE_COLOR, name) : + layer_i; if (layer_i == -1) { domain = ATTR_DOMAIN_CORNER; layer_i = layer_i == -1 ? CustomData_get_named_layer_index(cd_ldata, CD_PROP_COLOR, name) : layer_i; - layer_i = layer_i == -1 ? CustomData_get_named_layer_index(cd_ldata, CD_MLOOPCOL, name) : - layer_i; + layer_i = layer_i == -1 ? + CustomData_get_named_layer_index(cd_ldata, CD_PROP_BYTE_COLOR, name) : + layer_i; } /* Note: this is not the same as the layer_i below. */ @@ -610,17 +612,17 @@ static DRW_MeshCDMask mesh_cd_calc_used_gpu_layers(const Object *object, } if (layer == -1) { - layer = CustomData_get_named_layer(cd_vdata, CD_MLOOPCOL, name); + layer = CustomData_get_named_layer(cd_vdata, CD_PROP_BYTE_COLOR, name); if (layer != -1) { - type = CD_MLOOPCOL; + type = CD_PROP_BYTE_COLOR; domain = ATTR_DOMAIN_POINT; } } if (layer == -1) { - layer = CustomData_get_named_layer(cd_ldata, CD_MLOOPCOL, name); + layer = CustomData_get_named_layer(cd_ldata, CD_PROP_BYTE_COLOR, name); if (layer != -1) { - type = CD_MLOOPCOL; + type = CD_PROP_BYTE_COLOR; domain = ATTR_DOMAIN_CORNER; } } @@ -700,11 +702,11 @@ static DRW_MeshCDMask mesh_cd_calc_used_gpu_layers(const Object *object, } /* Note: attr->type will always be CD_PROP_COLOR even for - * CD_MLOOPCOL layers, see node_shader_gpu_vertex_color in + * CD_PROP_BYTE_COLOR layers, see node_shader_gpu_vertex_color in * node_shader_vertex_color.cc. */ case CD_MCOL: - case CD_MLOOPCOL: + case CD_PROP_BYTE_COLOR: case CD_PROP_COLOR: { int vcol_bit = mesh_cd_calc_gpu_layers_vcol_used(&me_query, cd_vdata, cd_ldata, name); diff --git a/source/blender/draw/intern/draw_cache_impl_particles.c b/source/blender/draw/intern/draw_cache_impl_particles.c index c6b56723818..545ffb16e9d 100644 --- a/source/blender/draw/intern/draw_cache_impl_particles.c +++ b/source/blender/draw/intern/draw_cache_impl_particles.c @@ -822,10 +822,11 @@ static void particle_batch_cache_ensure_procedural_strand_data(PTCacheEdit *edit active_uv = CustomData_get_active_layer(&psmd->mesh_final->ldata, CD_MLOOPUV); render_uv = CustomData_get_render_layer(&psmd->mesh_final->ldata, CD_MLOOPUV); } - if (CustomData_has_layer(&psmd->mesh_final->ldata, CD_MLOOPCOL)) { - cache->num_col_layers = CustomData_number_of_layers(&psmd->mesh_final->ldata, CD_MLOOPCOL); - active_col = CustomData_get_active_layer(&psmd->mesh_final->ldata, CD_MLOOPCOL); - render_col = CustomData_get_render_layer(&psmd->mesh_final->ldata, CD_MLOOPCOL); + if (CustomData_has_layer(&psmd->mesh_final->ldata, CD_PROP_BYTE_COLOR)) { + cache->num_col_layers = CustomData_number_of_layers(&psmd->mesh_final->ldata, + CD_PROP_BYTE_COLOR); + active_col = CustomData_get_active_layer(&psmd->mesh_final->ldata, CD_PROP_BYTE_COLOR); + render_col = CustomData_get_render_layer(&psmd->mesh_final->ldata, CD_PROP_BYTE_COLOR); } } @@ -891,7 +892,7 @@ static void particle_batch_cache_ensure_procedural_strand_data(PTCacheEdit *edit GPU_vertbuf_attr_get_raw_data(cache->proc_col_buf[i], col_id, &col_step[i]); char attr_safe_name[GPU_MAX_SAFE_ATTR_NAME]; - const char *name = CustomData_get_layer_name(&psmd->mesh_final->ldata, CD_MLOOPCOL, i); + const char *name = CustomData_get_layer_name(&psmd->mesh_final->ldata, CD_PROP_BYTE_COLOR, i); GPU_vertformat_safe_attr_name(name, attr_safe_name, GPU_MAX_SAFE_ATTR_NAME); int n = 0; @@ -1162,9 +1163,9 @@ static void particle_batch_cache_ensure_pos_and_seg(PTCacheEdit *edit, num_uv_layers = CustomData_number_of_layers(&psmd->mesh_final->ldata, CD_MLOOPUV); active_uv = CustomData_get_active_layer(&psmd->mesh_final->ldata, CD_MLOOPUV); } - if (CustomData_has_layer(&psmd->mesh_final->ldata, CD_MLOOPCOL)) { - num_col_layers = CustomData_number_of_layers(&psmd->mesh_final->ldata, CD_MLOOPCOL); - active_col = CustomData_get_active_layer(&psmd->mesh_final->ldata, CD_MLOOPCOL); + if (CustomData_has_layer(&psmd->mesh_final->ldata, CD_PROP_BYTE_COLOR)) { + num_col_layers = CustomData_number_of_layers(&psmd->mesh_final->ldata, CD_PROP_BYTE_COLOR); + active_col = CustomData_get_active_layer(&psmd->mesh_final->ldata, CD_PROP_BYTE_COLOR); } } @@ -1195,7 +1196,8 @@ static void particle_batch_cache_ensure_pos_and_seg(PTCacheEdit *edit, for (int i = 0; i < num_col_layers; i++) { char uuid[32], attr_safe_name[GPU_MAX_SAFE_ATTR_NAME]; - const char *name = CustomData_get_layer_name(&psmd->mesh_final->ldata, CD_MLOOPCOL, i); + const char *name = CustomData_get_layer_name( + &psmd->mesh_final->ldata, CD_PROP_BYTE_COLOR, i); GPU_vertformat_safe_attr_name(name, attr_safe_name, GPU_MAX_SAFE_ATTR_NAME); BLI_snprintf(uuid, sizeof(uuid), "c%s", attr_safe_name); diff --git a/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_vcol.cc b/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_vcol.cc index d52226a4c90..4cb68cad66c 100644 --- a/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_vcol.cc +++ b/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_vcol.cc @@ -173,7 +173,7 @@ static void extract_vcol_init(const MeshRenderData *mr, } BMIter iter; - const bool is_byte = ref.layer->type == CD_MLOOPCOL; + const bool is_byte = ref.layer->type == CD_PROP_BYTE_COLOR; const bool is_point = ref.domain == ATTR_DOMAIN_POINT; BMFace *f; @@ -318,7 +318,7 @@ static void extract_vcol_init_subdiv(const DRWSubdivCache *subdiv_cache, BMIter iter; BMFace *f; int cd_ofs = cdata->layers[layer_i].offset; - const bool is_byte = ref.layer->type == CD_MLOOPCOL; + const bool is_byte = ref.layer->type == CD_PROP_BYTE_COLOR; BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) { BMLoop *l_iter = f->l_first; diff --git a/source/blender/editors/geometry/geometry_attributes.cc b/source/blender/editors/geometry/geometry_attributes.cc index 467b8efa622..446aabd13c8 100644 --- a/source/blender/editors/geometry/geometry_attributes.cc +++ b/source/blender/editors/geometry/geometry_attributes.cc @@ -288,7 +288,7 @@ static int geometry_attribute_convert_exec(bContext *C, wmOperator *op) const CustomDataType dst_type = static_cast<CustomDataType>( RNA_enum_get(op->ptr, "data_type")); - if (ELEM(dst_type, CD_PROP_STRING, CD_MLOOPCOL)) { + if (ELEM(dst_type, CD_PROP_STRING, CD_PROP_BYTE_COLOR)) { BKE_report(op->reports, RPT_ERROR, "Cannot convert to the selected type"); return OPERATOR_CANCELLED; } @@ -325,7 +325,7 @@ static int geometry_attribute_convert_exec(bContext *C, wmOperator *op) } mesh_component.attribute_try_delete(name); CustomData_add_layer_named( - &mesh->ldata, CD_MLOOPCOL, CD_ASSIGN, dst_colors, mesh->totloop, name.c_str()); + &mesh->ldata, CD_PROP_BYTE_COLOR, CD_ASSIGN, dst_colors, mesh->totloop, name.c_str()); break; } case ConvertAttributeMode::VertexGroup: { @@ -385,7 +385,7 @@ void GEOMETRY_OT_color_attribute_add(wmOperatorType *ot) {0, nullptr, 0, nullptr, nullptr}}; static EnumPropertyItem types[3] = {{CD_PROP_COLOR, "COLOR", 0, "Color", ""}, - {CD_MLOOPCOL, "BYTE_COLOR", 0, "Byte Color", ""}, + {CD_PROP_BYTE_COLOR, "BYTE_COLOR", 0, "Byte Color", ""}, {0, nullptr, 0, nullptr, nullptr}}; prop = RNA_def_enum(ot->srna, @@ -415,9 +415,9 @@ static int geometry_color_attribute_set_render_exec(bContext *C, wmOperator *op) RNA_string_get(op->ptr, "name", name); CustomDataLayer *layer = BKE_id_attribute_find(id, name, CD_PROP_COLOR, ATTR_DOMAIN_POINT); - layer = !layer ? BKE_id_attribute_find(id, name, CD_MLOOPCOL, ATTR_DOMAIN_POINT) : layer; + layer = !layer ? BKE_id_attribute_find(id, name, CD_PROP_BYTE_COLOR, ATTR_DOMAIN_POINT) : layer; layer = !layer ? BKE_id_attribute_find(id, name, CD_PROP_COLOR, ATTR_DOMAIN_CORNER) : layer; - layer = !layer ? BKE_id_attribute_find(id, name, CD_MLOOPCOL, ATTR_DOMAIN_CORNER) : layer; + layer = !layer ? BKE_id_attribute_find(id, name, CD_PROP_BYTE_COLOR, ATTR_DOMAIN_CORNER) : layer; if (layer) { BKE_id_attributes_render_color_set(id, layer); diff --git a/source/blender/editors/mesh/editmesh_utils.c b/source/blender/editors/mesh/editmesh_utils.c index 7feb04b3672..c3d5f33705c 100644 --- a/source/blender/editors/mesh/editmesh_utils.c +++ b/source/blender/editors/mesh/editmesh_utils.c @@ -937,7 +937,7 @@ bool EDBM_uv_check(BMEditMesh *em) bool EDBM_vert_color_check(BMEditMesh *em) { /* some of these checks could be a touch overkill */ - return em && em->bm->totface && CustomData_has_layer(&em->bm->ldata, CD_MLOOPCOL); + return em && em->bm->totface && CustomData_has_layer(&em->bm->ldata, CD_PROP_BYTE_COLOR); } /** \} */ diff --git a/source/blender/editors/mesh/mesh_data.c b/source/blender/editors/mesh/mesh_data.c index f6f4260b762..39dccb66899 100644 --- a/source/blender/editors/mesh/mesh_data.c +++ b/source/blender/editors/mesh/mesh_data.c @@ -109,7 +109,7 @@ static void delete_customdata_layer(Mesh *me, CustomDataLayer *layer) int layer_index, tot, n; char htype = BM_FACE; - if (ELEM(type, CD_MLOOPCOL, CD_MLOOPUV)) { + if (ELEM(type, CD_PROP_BYTE_COLOR, CD_MLOOPUV)) { htype = BM_LOOP; } else if (ELEM(type, CD_PROP_COLOR)) { @@ -379,25 +379,25 @@ int ED_mesh_color_add( if (me->edit_mesh) { em = me->edit_mesh; - layernum = CustomData_number_of_layers(&em->bm->ldata, CD_MLOOPCOL); + layernum = CustomData_number_of_layers(&em->bm->ldata, CD_PROP_BYTE_COLOR); if (layernum >= MAX_MCOL) { BKE_reportf(reports, RPT_WARNING, "Cannot add more than %i vertex color layers", MAX_MCOL); return -1; } - /* CD_MLOOPCOL */ - BM_data_layer_add_named(em->bm, &em->bm->ldata, CD_MLOOPCOL, name); + /* CD_PROP_BYTE_COLOR */ + BM_data_layer_add_named(em->bm, &em->bm->ldata, CD_PROP_BYTE_COLOR, name); /* copy data from active vertex color layer */ if (layernum && do_init) { - const int layernum_dst = CustomData_get_active_layer(&em->bm->ldata, CD_MLOOPCOL); - BM_data_layer_copy(em->bm, &em->bm->ldata, CD_MLOOPCOL, layernum_dst, layernum); + const int layernum_dst = CustomData_get_active_layer(&em->bm->ldata, CD_PROP_BYTE_COLOR); + BM_data_layer_copy(em->bm, &em->bm->ldata, CD_PROP_BYTE_COLOR, layernum_dst, layernum); } if (active_set || layernum == 0) { - CustomData_set_layer_active(&em->bm->ldata, CD_MLOOPCOL, layernum); + CustomData_set_layer_active(&em->bm->ldata, CD_PROP_BYTE_COLOR, layernum); } } else { - layernum = CustomData_number_of_layers(&me->ldata, CD_MLOOPCOL); + layernum = CustomData_number_of_layers(&me->ldata, CD_PROP_BYTE_COLOR); if (layernum >= MAX_MCOL) { BKE_reportf(reports, RPT_WARNING, "Cannot add more than %i vertex color layers", MAX_MCOL); return -1; @@ -405,14 +405,15 @@ int ED_mesh_color_add( if (me->mloopcol && do_init) { CustomData_add_layer_named( - &me->ldata, CD_MLOOPCOL, CD_DUPLICATE, me->mloopcol, me->totloop, name); + &me->ldata, CD_PROP_BYTE_COLOR, CD_DUPLICATE, me->mloopcol, me->totloop, name); } else { - CustomData_add_layer_named(&me->ldata, CD_MLOOPCOL, CD_DEFAULT, NULL, me->totloop, name); + CustomData_add_layer_named( + &me->ldata, CD_PROP_BYTE_COLOR, CD_DEFAULT, NULL, me->totloop, name); } if (active_set || layernum == 0) { - CustomData_set_layer_active(&me->ldata, CD_MLOOPCOL, layernum); + CustomData_set_layer_active(&me->ldata, CD_PROP_BYTE_COLOR, layernum); } BKE_mesh_update_customdata_pointers(me, true); @@ -429,8 +430,9 @@ bool ED_mesh_color_ensure(struct Mesh *me, const char *name) BLI_assert(me->edit_mesh == NULL); if (!me->mloopcol && me->totloop) { - CustomData_add_layer_named(&me->ldata, CD_MLOOPCOL, CD_DEFAULT, NULL, me->totloop, name); - int layer_i = CustomData_get_layer_index(&me->ldata, CD_MLOOPCOL); + CustomData_add_layer_named( + &me->ldata, CD_PROP_BYTE_COLOR, CD_DEFAULT, NULL, me->totloop, name); + int layer_i = CustomData_get_layer_index(&me->ldata, CD_PROP_BYTE_COLOR); BKE_id_attributes_active_color_set(&me->id, me->ldata.layers + layer_i); BKE_mesh_update_customdata_pointers(me, true); @@ -447,7 +449,7 @@ bool ED_mesh_color_remove_index(Mesh *me, const int n) CustomDataLayer *cdl; int index; - index = CustomData_get_layer_index_n(ldata, CD_MLOOPCOL, n); + index = CustomData_get_layer_index_n(ldata, CD_PROP_BYTE_COLOR, n); cdl = (index == -1) ? NULL : &ldata->layers[index]; if (!cdl) { @@ -463,7 +465,7 @@ bool ED_mesh_color_remove_index(Mesh *me, const int n) bool ED_mesh_color_remove_active(Mesh *me) { CustomData *ldata = GET_CD_DATA(me, ldata); - const int n = CustomData_get_active_layer(ldata, CD_MLOOPCOL); + const int n = CustomData_get_active_layer(ldata, CD_PROP_BYTE_COLOR); if (n != -1) { return ED_mesh_color_remove_index(me, n); } @@ -472,7 +474,7 @@ bool ED_mesh_color_remove_active(Mesh *me) bool ED_mesh_color_remove_named(Mesh *me, const char *name) { CustomData *ldata = GET_CD_DATA(me, ldata); - const int n = CustomData_get_named_layer(ldata, CD_MLOOPCOL, name); + const int n = CustomData_get_named_layer(ldata, CD_PROP_BYTE_COLOR, name); if (n != -1) { return ED_mesh_color_remove_index(me, n); } @@ -715,7 +717,7 @@ static bool vertex_color_remove_poll(bContext *C) Object *ob = ED_object_context(C); Mesh *me = ob->data; CustomData *ldata = GET_CD_DATA(me, ldata); - const int active = CustomData_get_active_layer(ldata, CD_MLOOPCOL); + const int active = CustomData_get_active_layer(ldata, CD_PROP_BYTE_COLOR); if (active != -1) { return true; } diff --git a/source/blender/editors/object/object_bake_api.c b/source/blender/editors/object/object_bake_api.c index 3060a1ecf62..4ec8b7a05d5 100644 --- a/source/blender/editors/object/object_bake_api.c +++ b/source/blender/editors/object/object_bake_api.c @@ -443,7 +443,7 @@ static bool bake_object_check(ViewLayer *view_layer, if (target == R_BAKE_TARGET_VERTEX_COLORS) { MPropCol *mcol = CustomData_get_layer(&me->vdata, CD_PROP_COLOR); const bool mcol_valid = (mcol != NULL); - MLoopCol *mloopcol = CustomData_get_layer(&me->ldata, CD_MLOOPCOL); + MLoopCol *mloopcol = CustomData_get_layer(&me->ldata, CD_PROP_BYTE_COLOR); if (mloopcol == NULL && !mcol_valid) { BKE_reportf(reports, RPT_ERROR, @@ -927,7 +927,7 @@ static bool bake_targets_init_vertex_colors(BakeTargets *targets, Object *ob, Re Mesh *me = ob->data; MPropCol *mcol = CustomData_get_layer(&me->vdata, CD_PROP_COLOR); const bool mcol_valid = (mcol != NULL); - MLoopCol *mloopcol = CustomData_get_layer(&me->ldata, CD_MLOOPCOL); + MLoopCol *mloopcol = CustomData_get_layer(&me->ldata, CD_PROP_BYTE_COLOR); if (mloopcol == NULL && !mcol_valid) { BKE_report(reports, RPT_ERROR, "No vertex colors layer found to bake to"); return false; @@ -1081,7 +1081,7 @@ static bool bake_targets_output_vertex_colors(BakeTargets *targets, Object *ob) Mesh *me = ob->data; MPropCol *mcol = CustomData_get_layer(&me->vdata, CD_PROP_COLOR); const bool mcol_valid = (mcol != NULL); - MLoopCol *mloopcol = CustomData_get_layer(&me->ldata, CD_MLOOPCOL); + MLoopCol *mloopcol = CustomData_get_layer(&me->ldata, CD_PROP_BYTE_COLOR); const int channels_num = targets->channels_num; const float *result = targets->result; diff --git a/source/blender/editors/object/object_data_transfer.c b/source/blender/editors/object/object_data_transfer.c index 23d2327fe72..dfe858e5bd9 100644 --- a/source/blender/editors/object/object_data_transfer.c +++ b/source/blender/editors/object/object_data_transfer.c @@ -89,7 +89,7 @@ static void dt_add_vcol_layers(CustomData *cdata, EnumPropertyItem **r_item, int *r_totitem) { - int types[2] = {CD_PROP_COLOR, CD_MLOOPCOL}; + int types[2] = {CD_PROP_COLOR, CD_PROP_BYTE_COLOR}; for (int i = 0; i < 2; i++) { CustomDataType type = types[i]; @@ -196,14 +196,14 @@ static const EnumPropertyItem *dt_layers_select_src_itemf(bContext *C, cddata_masks.vmask |= CD_MASK_PROP_COLOR; } if (data_type & (DT_TYPE_MLOOPCOL_VERT)) { - cddata_masks.vmask |= CD_MASK_MLOOPCOL; + cddata_masks.vmask |= CD_MASK_PROP_BYTE_COLOR; } if (data_type & (DT_TYPE_MPROPCOL_LOOP)) { cddata_masks.lmask |= CD_MASK_PROP_COLOR; } if (data_type & (DT_TYPE_MLOOPCOL_LOOP)) { - cddata_masks.lmask |= CD_MASK_MLOOPCOL; + cddata_masks.lmask |= CD_MASK_PROP_BYTE_COLOR; } Mesh *me_eval = mesh_get_eval_final(depsgraph, scene_eval, ob_src_eval, &cddata_masks); diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index 33b92c22d3f..10d24af53ee 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -172,7 +172,7 @@ static bool vertex_paint_use_fast_update_check(Object *ob) if (me_eval != NULL) { Mesh *me = BKE_mesh_from_object(ob); if (me && me->mloopcol) { - return (me->mloopcol == CustomData_get_layer(&me_eval->ldata, CD_MLOOPCOL)); + return (me->mloopcol == CustomData_get_layer(&me_eval->ldata, CD_PROP_BYTE_COLOR)); } } @@ -198,7 +198,7 @@ bool vertex_paint_mode_poll(bContext *C) CustomDataLayer *layer = BKE_id_attributes_active_color_get((ID *)ob->data); AttributeDomain domain = BKE_id_attribute_domain((ID *)ob->data, layer); - return layer && layer->type == CD_MLOOPCOL && domain == ATTR_DOMAIN_CORNER; + return layer && layer->type == CD_PROP_BYTE_COLOR && domain == ATTR_DOMAIN_CORNER; } static bool vertex_paint_poll_ex(bContext *C, bool check_tool) diff --git a/source/blender/editors/sculpt_paint/sculpt_ops.c b/source/blender/editors/sculpt_paint/sculpt_ops.c index 49286ce3308..1984678bb00 100644 --- a/source/blender/editors/sculpt_paint/sculpt_ops.c +++ b/source/blender/editors/sculpt_paint/sculpt_ops.c @@ -627,11 +627,11 @@ static int vertex_to_loop_colors_exec(bContext *C, wmOperator *UNUSED(op)) Mesh *mesh = ob->data; - const int mloopcol_layer_n = CustomData_get_active_layer(&mesh->ldata, CD_MLOOPCOL); + const int mloopcol_layer_n = CustomData_get_active_layer(&mesh->ldata, CD_PROP_BYTE_COLOR); if (mloopcol_layer_n == -1) { return OPERATOR_CANCELLED; } - MLoopCol *loopcols = CustomData_get_layer_n(&mesh->ldata, CD_MLOOPCOL, mloopcol_layer_n); + MLoopCol *loopcols = CustomData_get_layer_n(&mesh->ldata, CD_PROP_BYTE_COLOR, mloopcol_layer_n); const int MPropCol_layer_n = CustomData_get_active_layer(&mesh->vdata, CD_PROP_COLOR); if (MPropCol_layer_n == -1) { @@ -692,11 +692,11 @@ static int loop_to_vertex_colors_exec(bContext *C, wmOperator *UNUSED(op)) Mesh *mesh = ob->data; - const int mloopcol_layer_n = CustomData_get_active_layer(&mesh->ldata, CD_MLOOPCOL); + const int mloopcol_layer_n = CustomData_get_active_layer(&mesh->ldata, CD_PROP_BYTE_COLOR); if (mloopcol_layer_n == -1) { return OPERATOR_CANCELLED; } - MLoopCol *loopcols = CustomData_get_layer_n(&mesh->ldata, CD_MLOOPCOL, mloopcol_layer_n); + MLoopCol *loopcols = CustomData_get_layer_n(&mesh->ldata, CD_PROP_BYTE_COLOR, mloopcol_layer_n); const int MPropCol_layer_n = CustomData_get_active_layer(&mesh->vdata, CD_PROP_COLOR); if (MPropCol_layer_n == -1) { diff --git a/source/blender/editors/space_node/node_geometry_attribute_search.cc b/source/blender/editors/space_node/node_geometry_attribute_search.cc index 2536496b50d..fee64da0459 100644 --- a/source/blender/editors/space_node/node_geometry_attribute_search.cc +++ b/source/blender/editors/space_node/node_geometry_attribute_search.cc @@ -135,7 +135,7 @@ static CustomDataType data_type_in_attribute_input_node(const CustomDataType typ case CD_PROP_COLOR: case CD_PROP_BOOL: return type; - case CD_MLOOPCOL: + case CD_PROP_BYTE_COLOR: return CD_PROP_COLOR; case CD_PROP_STRING: /* Unsupported currently. */ diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index 593c4f6e755..5a27349dc7f 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -2371,7 +2371,7 @@ void ED_view3d_datamask(const bContext *C, CustomData_MeshMasks *r_cddata_masks) { if (ELEM(v3d->shading.type, OB_TEXTURE, OB_MATERIAL, OB_RENDER)) { - r_cddata_masks->lmask |= CD_MASK_MLOOPUV | CD_MASK_MLOOPCOL; + r_cddata_masks->lmask |= CD_MASK_MLOOPUV | CD_MASK_PROP_BYTE_COLOR; r_cddata_masks->vmask |= CD_MASK_ORCO | CD_MASK_PROP_COLOR; } else if (v3d->shading.type == OB_SOLID) { @@ -2379,7 +2379,7 @@ void ED_view3d_datamask(const bContext *C, r_cddata_masks->lmask |= CD_MASK_MLOOPUV; } if (v3d->shading.color_type == V3D_SHADING_VERTEX_COLOR) { - r_cddata_masks->lmask |= CD_MASK_MLOOPCOL; + r_cddata_masks->lmask |= CD_MASK_PROP_BYTE_COLOR; r_cddata_masks->vmask |= CD_MASK_ORCO | CD_MASK_PROP_COLOR; } } diff --git a/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp b/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp index 54a6bb44bad..03e9134c6c2 100644 --- a/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp +++ b/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp @@ -608,9 +608,9 @@ void BlenderStrokeRenderer::GenerateStrokeMesh(StrokeGroup *group, bool hasTex) // colors and transparency (the latter represented by grayscale colors) MLoopCol *colors = (MLoopCol *)CustomData_add_layer_named( - &mesh->ldata, CD_MLOOPCOL, CD_CALLOC, nullptr, mesh->totloop, "Color"); + &mesh->ldata, CD_PROP_BYTE_COLOR, CD_CALLOC, nullptr, mesh->totloop, "Color"); MLoopCol *transp = (MLoopCol *)CustomData_add_layer_named( - &mesh->ldata, CD_MLOOPCOL, CD_CALLOC, nullptr, mesh->totloop, "Alpha"); + &mesh->ldata, CD_PROP_BYTE_COLOR, CD_CALLOC, nullptr, mesh->totloop, "Alpha"); mesh->mloopcol = colors; mesh->mat = (Material **)MEM_mallocN(sizeof(Material *) * mesh->totcol, "MaterialList"); diff --git a/source/blender/gpu/intern/gpu_buffers.c b/source/blender/gpu/intern/gpu_buffers.c index 110fdfbd2d9..fed998bb33e 100644 --- a/source/blender/gpu/intern/gpu_buffers.c +++ b/source/blender/gpu/intern/gpu_buffers.c @@ -207,7 +207,7 @@ void GPU_pbvh_mesh_buffers_update(GPU_PBVH_Buffers *buffers, int update_flags) { const MPropCol *vtcol = vcol_type == CD_PROP_COLOR ? vcol_data : NULL; - const MLoopCol *vcol = vcol_type == CD_MLOOPCOL ? vcol_data : NULL; + const MLoopCol *vcol = vcol_type == CD_PROP_BYTE_COLOR ? vcol_data : NULL; const float(*f3col)[3] = vcol_type == CD_PROP_FLOAT3 ? vcol_data : NULL; const bool color_loops = vcol_domain == ATTR_DOMAIN_CORNER; diff --git a/source/blender/gpu/intern/gpu_node_graph.c b/source/blender/gpu/intern/gpu_node_graph.c index 20551785535..7f96a3b01c4 100644 --- a/source/blender/gpu/intern/gpu_node_graph.c +++ b/source/blender/gpu/intern/gpu_node_graph.c @@ -336,7 +336,7 @@ static char attr_prefix_get(CustomDataType type) case CD_TANGENT: return 't'; case CD_MCOL: - case CD_MLOOPCOL: + case CD_PROP_BYTE_COLOR: return 'c'; case CD_PROP_COLOR: return 'c'; diff --git a/source/blender/io/alembic/exporter/abc_writer_mesh.cc b/source/blender/io/alembic/exporter/abc_writer_mesh.cc index bbb196dc383..07b185ffd64 100644 --- a/source/blender/io/alembic/exporter/abc_writer_mesh.cc +++ b/source/blender/io/alembic/exporter/abc_writer_mesh.cc @@ -359,7 +359,7 @@ void ABCGenericMeshWriter::write_arb_geo_params(struct Mesh *me) else { arb_geom_params = abc_poly_mesh_.getSchema().getArbGeomParams(); } - write_custom_data(arb_geom_params, m_custom_data_config, &me->ldata, CD_MLOOPCOL); + write_custom_data(arb_geom_params, m_custom_data_config, &me->ldata, CD_PROP_BYTE_COLOR); } bool ABCGenericMeshWriter::get_velocities(struct Mesh *mesh, std::vector<Imath::V3f> &vels) diff --git a/source/blender/io/alembic/intern/abc_customdata.cc b/source/blender/io/alembic/intern/abc_customdata.cc index c413fbf0ff9..45bf898f3f5 100644 --- a/source/blender/io/alembic/intern/abc_customdata.cc +++ b/source/blender/io/alembic/intern/abc_customdata.cc @@ -294,7 +294,7 @@ void write_custom_data(const OCompoundProperty &prop, write_uv(prop, config, cd_data, name); } - else if (cd_data_type == CD_MLOOPCOL) { + else if (cd_data_type == CD_PROP_BYTE_COLOR) { write_mcol(prop, config, cd_data, name); } } @@ -412,7 +412,7 @@ static void read_custom_data_mcols(const std::string &iobject_full_name, /* Read the vertex colors */ void *cd_data = config.add_customdata_cb( - config.mesh, prop_header.getName().c_str(), CD_MLOOPCOL); + config.mesh, prop_header.getName().c_str(), CD_PROP_BYTE_COLOR); MCol *cfaces = static_cast<MCol *>(cd_data); MPoly *mpolys = config.mpoly; MLoop *mloops = config.mloop; diff --git a/source/blender/io/alembic/intern/abc_reader_mesh.cc b/source/blender/io/alembic/intern/abc_reader_mesh.cc index 9b65707bc91..2d2dcfb1f42 100644 --- a/source/blender/io/alembic/intern/abc_reader_mesh.cc +++ b/source/blender/io/alembic/intern/abc_reader_mesh.cc @@ -382,7 +382,7 @@ static void *add_customdata_cb(Mesh *mesh, const char *name, int data_type) int numloops; /* unsupported custom data type -- don't do anything. */ - if (!ELEM(cd_data_type, CD_MLOOPUV, CD_MLOOPCOL)) { + if (!ELEM(cd_data_type, CD_MLOOPUV, CD_PROP_BYTE_COLOR)) { return nullptr; } diff --git a/source/blender/io/collada/GeometryExporter.cpp b/source/blender/io/collada/GeometryExporter.cpp index 3b21d423df5..3952a4ae334 100644 --- a/source/blender/io/collada/GeometryExporter.cpp +++ b/source/blender/io/collada/GeometryExporter.cpp @@ -378,12 +378,12 @@ void GeometryExporter::create_mesh_primitive_list(short material_index, } } - int totlayer_mcol = CustomData_number_of_layers(&me->ldata, CD_MLOOPCOL); + int totlayer_mcol = CustomData_number_of_layers(&me->ldata, CD_PROP_BYTE_COLOR); if (totlayer_mcol > 0) { int map_index = 0; for (int a = 0; a < totlayer_mcol; a++) { - char *layer_name = bc_CustomData_get_layer_name(&me->ldata, CD_MLOOPCOL, a); + char *layer_name = bc_CustomData_get_layer_name(&me->ldata, CD_PROP_BYTE_COLOR, a); COLLADASW::Input input4(COLLADASW::InputSemantic::COLOR, makeUrl(makeVertexColorSourceId(geom_id, layer_name)), (has_uvs) ? 3 : 2, /* all color layers have same index order */ @@ -468,7 +468,7 @@ void GeometryExporter::createVertsSource(std::string geom_id, Mesh *me) void GeometryExporter::createVertexColorSource(std::string geom_id, Mesh *me) { /* Find number of vertex color layers */ - int totlayer_mcol = CustomData_number_of_layers(&me->ldata, CD_MLOOPCOL); + int totlayer_mcol = CustomData_number_of_layers(&me->ldata, CD_PROP_BYTE_COLOR); if (totlayer_mcol == 0) { return; } @@ -477,11 +477,11 @@ void GeometryExporter::createVertexColorSource(std::string geom_id, Mesh *me) for (int a = 0; a < totlayer_mcol; a++) { map_index++; - MLoopCol *mloopcol = (MLoopCol *)CustomData_get_layer_n(&me->ldata, CD_MLOOPCOL, a); + MLoopCol *mloopcol = (MLoopCol *)CustomData_get_layer_n(&me->ldata, CD_PROP_BYTE_COLOR, a); COLLADASW::FloatSourceF source(mSW); - char *layer_name = bc_CustomData_get_layer_name(&me->ldata, CD_MLOOPCOL, a); + char *layer_name = bc_CustomData_get_layer_name(&me->ldata, CD_PROP_BYTE_COLOR, a); std::string layer_id = makeVertexColorSourceId(geom_id, layer_name); source.setId(layer_id); diff --git a/source/blender/io/collada/MeshImporter.cpp b/source/blender/io/collada/MeshImporter.cpp index cdd35d23daf..6e109353be8 100644 --- a/source/blender/io/collada/MeshImporter.cpp +++ b/source/blender/io/collada/MeshImporter.cpp @@ -471,9 +471,9 @@ void MeshImporter::allocate_poly_data(COLLADAFW::Mesh *collada_mesh, Mesh *me) collada_mesh->getColors().getInputInfosArray()[i]; COLLADAFW::String colname = extract_vcolname(info->mName); CustomData_add_layer_named( - &me->ldata, CD_MLOOPCOL, CD_DEFAULT, nullptr, me->totloop, colname.c_str()); + &me->ldata, CD_PROP_BYTE_COLOR, CD_DEFAULT, nullptr, me->totloop, colname.c_str()); } - me->mloopcol = (MLoopCol *)CustomData_get_layer_n(&me->ldata, CD_MLOOPCOL, 0); + me->mloopcol = (MLoopCol *)CustomData_get_layer_n(&me->ldata, CD_PROP_BYTE_COLOR, 0); } } } @@ -724,7 +724,7 @@ void MeshImporter::read_polys(COLLADAFW::Mesh *collada_mesh, Mesh *me) COLLADAFW::IndexList &color_index_list = *mp->getColorIndices(vcolor_index); COLLADAFW::String colname = extract_vcolname(color_index_list.getName()); MLoopCol *mloopcol = (MLoopCol *)CustomData_get_layer_named( - &me->ldata, CD_MLOOPCOL, colname.c_str()); + &me->ldata, CD_PROP_BYTE_COLOR, colname.c_str()); if (mloopcol == nullptr) { fprintf(stderr, "Collada import: Mesh [%s] : Unknown reference to VCOLOR [#%s].\n", diff --git a/source/blender/io/usd/intern/usd_reader_mesh.cc b/source/blender/io/usd/intern/usd_reader_mesh.cc index 646d1ba1fde..328b4109616 100644 --- a/source/blender/io/usd/intern/usd_reader_mesh.cc +++ b/source/blender/io/usd/intern/usd_reader_mesh.cc @@ -149,7 +149,7 @@ static void *add_customdata_cb(Mesh *mesh, const char *name, const int data_type int numloops; /* unsupported custom data type -- don't do anything. */ - if (!ELEM(cd_data_type, CD_MLOOPUV, CD_MLOOPCOL)) { + if (!ELEM(cd_data_type, CD_MLOOPUV, CD_PROP_BYTE_COLOR)) { return nullptr; } @@ -457,7 +457,7 @@ void USDMeshReader::read_colors(Mesh *mesh, const double motionSampleTime) return; } - void *cd_ptr = add_customdata_cb(mesh, "displayColors", CD_MLOOPCOL); + void *cd_ptr = add_customdata_cb(mesh, "displayColors", CD_PROP_BYTE_COLOR); if (!cd_ptr) { std::cerr << "WARNING: Couldn't add displayColors custom data.\n"; diff --git a/source/blender/makesdna/DNA_customdata_types.h b/source/blender/makesdna/DNA_customdata_types.h index 858de733558..ef937fb139b 100644 --- a/source/blender/makesdna/DNA_customdata_types.h +++ b/source/blender/makesdna/DNA_customdata_types.h @@ -113,7 +113,7 @@ typedef enum CustomDataType { CD_MTEXPOLY = 15, /* deprecated */ #endif CD_MLOOPUV = 16, - CD_MLOOPCOL = 17, + CD_PROP_BYTE_COLOR = 17, CD_TANGENT = 18, CD_MDISPS = 19, CD_PREVIEW_MCOL = 20, /* for displaying weightpaint colors */ @@ -181,7 +181,7 @@ typedef enum CustomDataType { #define CD_MASK_ORCO (1 << CD_ORCO) // #define CD_MASK_MTEXPOLY (1 << CD_MTEXPOLY) /* DEPRECATED */ #define CD_MASK_MLOOPUV (1 << CD_MLOOPUV) -#define CD_MASK_MLOOPCOL (1 << CD_MLOOPCOL) +#define CD_MASK_PROP_BYTE_COLOR (1 << CD_PROP_BYTE_COLOR) #define CD_MASK_TANGENT (1 << CD_TANGENT) #define CD_MASK_MDISPS (1 << CD_MDISPS) #define CD_MASK_PREVIEW_MCOL (1 << CD_PREVIEW_MCOL) @@ -224,11 +224,11 @@ typedef enum CustomDataType { /* All generic attributes. */ #define CD_MASK_PROP_ALL \ (CD_MASK_PROP_FLOAT | CD_MASK_PROP_FLOAT2 | CD_MASK_PROP_FLOAT3 | CD_MASK_PROP_INT32 | \ - CD_MASK_PROP_COLOR | CD_MASK_PROP_STRING | CD_MASK_MLOOPCOL | CD_MASK_PROP_BOOL | \ + CD_MASK_PROP_COLOR | CD_MASK_PROP_STRING | CD_MASK_PROP_BYTE_COLOR | CD_MASK_PROP_BOOL | \ CD_MASK_PROP_INT8) /* All color attributes */ -#define CD_MASK_COLOR_ALL (CD_MASK_PROP_COLOR | CD_MASK_MLOOPCOL) +#define CD_MASK_COLOR_ALL (CD_MASK_PROP_COLOR | CD_MASK_PROP_BYTE_COLOR) typedef struct CustomData_MeshMasks { uint64_t vmask; diff --git a/source/blender/makesdna/DNA_mesh_types.h b/source/blender/makesdna/DNA_mesh_types.h index 2b4858d4106..cd4676ee08e 100644 --- a/source/blender/makesdna/DNA_mesh_types.h +++ b/source/blender/makesdna/DNA_mesh_types.h @@ -221,7 +221,7 @@ typedef struct Mesh { /** * The active vertex corner color layer, if it exists. Also called "Vertex Color" in Blender's * UI, even though it is stored per face corner. - * \note This pointer is for convenient access to the #CD_MLOOPCOL layer in #ldata. + * \note This pointer is for convenient access to the #CD_PROP_BYTE_COLOR layer in #ldata. */ struct MLoopCol *mloopcol; diff --git a/source/blender/makesrna/intern/rna_attribute.c b/source/blender/makesrna/intern/rna_attribute.c index b11250cf891..6f3688b66f5 100644 --- a/source/blender/makesrna/intern/rna_attribute.c +++ b/source/blender/makesrna/intern/rna_attribute.c @@ -28,7 +28,7 @@ const EnumPropertyItem rna_enum_attribute_type_items[] = { {CD_PROP_INT32, "INT", 0, "Integer", "32-bit integer"}, {CD_PROP_FLOAT3, "FLOAT_VECTOR", 0, "Vector", "3D vector with floating-point values"}, {CD_PROP_COLOR, "FLOAT_COLOR", 0, "Color", "RGBA color with floating-point values"}, - {CD_MLOOPCOL, "BYTE_COLOR", 0, "Byte Color", "RGBA color with 8-bit values"}, + {CD_PROP_BYTE_COLOR, "BYTE_COLOR", 0, "Byte Color", "RGBA color with 8-bit values"}, {CD_PROP_STRING, "STRING", 0, "String", "Text string"}, {CD_PROP_BOOL, "BOOLEAN", 0, "Boolean", "True or false"}, {CD_PROP_FLOAT2, "FLOAT2", 0, "2D Vector", "2D vector with floating-point values"}, @@ -42,7 +42,7 @@ const EnumPropertyItem rna_enum_attribute_type_with_auto_items[] = { {CD_PROP_INT32, "INT", 0, "Integer", "32-bit integer"}, {CD_PROP_FLOAT3, "FLOAT_VECTOR", 0, "Vector", "3D vector with floating-point values"}, {CD_PROP_COLOR, "FLOAT_COLOR", 0, "Color", "RGBA color with floating-point values"}, - {CD_MLOOPCOL, "BYTE_COLOR", 0, "Byte Color", "RGBA color with 8-bit values"}, + {CD_PROP_BYTE_COLOR, "BYTE_COLOR", 0, "Byte Color", "RGBA color with 8-bit values"}, {CD_PROP_STRING, "STRING", 0, "String", "Text string"}, {CD_PROP_BOOL, "BOOLEAN", 0, "Boolean", "True or false"}, {CD_PROP_FLOAT2, "FLOAT2", 0, "2D Vector", "2D vector with floating-point values"}, @@ -113,7 +113,7 @@ static StructRNA *srna_by_custom_data_layer_type(const CustomDataType type) return &RNA_FloatVectorAttribute; case CD_PROP_COLOR: return &RNA_FloatColorAttribute; - case CD_MLOOPCOL: + case CD_PROP_BYTE_COLOR: return &RNA_ByteColorAttribute; case CD_PROP_STRING: return &RNA_StringAttribute; @@ -231,7 +231,7 @@ static void rna_Attribute_data_begin(CollectionPropertyIterator *iter, PointerRN case CD_PROP_COLOR: struct_size = sizeof(MPropCol); break; - case CD_MLOOPCOL: + case CD_PROP_BYTE_COLOR: struct_size = sizeof(MLoopCol); break; case CD_PROP_STRING: @@ -423,7 +423,7 @@ int rna_AttributeGroup_color_length(PointerRNA *ptr) { return BKE_id_attributes_length(ptr->owner_id, ATTR_DOMAIN_MASK_POINT | ATTR_DOMAIN_MASK_CORNER, - CD_MASK_PROP_COLOR | CD_MASK_MLOOPCOL); + CD_MASK_PROP_COLOR | CD_MASK_PROP_BYTE_COLOR); } int rna_AttributeGroup_length(PointerRNA *ptr) diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c index 7e2b6d9c8ef..0e7c332f6a4 100644 --- a/source/blender/makesrna/intern/rna_mesh.c +++ b/source/blender/makesrna/intern/rna_mesh.c @@ -753,9 +753,9 @@ static void rna_MeshUVLoopLayer_clone_set(PointerRNA *ptr, bool value) /* vertex_color_layers */ -DEFINE_CUSTOMDATA_LAYER_COLLECTION(vertex_color, ldata, CD_MLOOPCOL) +DEFINE_CUSTOMDATA_LAYER_COLLECTION(vertex_color, ldata, CD_PROP_BYTE_COLOR) DEFINE_CUSTOMDATA_LAYER_COLLECTION_ACTIVEITEM( - vertex_color, ldata, CD_MLOOPCOL, active, MeshLoopColorLayer) + vertex_color, ldata, CD_PROP_BYTE_COLOR, active, MeshLoopColorLayer) static void rna_MeshLoopColorLayer_data_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) { @@ -773,22 +773,22 @@ static int rna_MeshLoopColorLayer_data_length(PointerRNA *ptr) static bool rna_MeshLoopColorLayer_active_render_get(PointerRNA *ptr) { - return rna_CustomDataLayer_active_get(ptr, rna_mesh_ldata(ptr), CD_MLOOPCOL, 1); + return rna_CustomDataLayer_active_get(ptr, rna_mesh_ldata(ptr), CD_PROP_BYTE_COLOR, 1); } static bool rna_MeshLoopColorLayer_active_get(PointerRNA *ptr) { - return rna_CustomDataLayer_active_get(ptr, rna_mesh_ldata(ptr), CD_MLOOPCOL, 0); + return rna_CustomDataLayer_active_get(ptr, rna_mesh_ldata(ptr), CD_PROP_BYTE_COLOR, 0); } static void rna_MeshLoopColorLayer_active_render_set(PointerRNA *ptr, bool value) { - rna_CustomDataLayer_active_set(ptr, rna_mesh_ldata(ptr), value, CD_MLOOPCOL, 1); + rna_CustomDataLayer_active_set(ptr, rna_mesh_ldata(ptr), value, CD_PROP_BYTE_COLOR, 1); } static void rna_MeshLoopColorLayer_active_set(PointerRNA *ptr, bool value) { - rna_CustomDataLayer_active_set(ptr, rna_mesh_ldata(ptr), value, CD_MLOOPCOL, 0); + rna_CustomDataLayer_active_set(ptr, rna_mesh_ldata(ptr), value, CD_PROP_BYTE_COLOR, 0); } /* sculpt_vertex_color_layers */ @@ -1340,7 +1340,7 @@ static char *rna_MeshLoopColorLayer_path(PointerRNA *ptr) static char *rna_MeshColor_path(PointerRNA *ptr) { - return rna_LoopCustomData_data_path(ptr, "vertex_colors", CD_MLOOPCOL); + return rna_LoopCustomData_data_path(ptr, "vertex_colors", CD_PROP_BYTE_COLOR); } static char *rna_MeshVertColorLayer_path(PointerRNA *ptr) @@ -1564,7 +1564,7 @@ static PointerRNA rna_Mesh_vertex_color_new(struct Mesh *me, if (index != -1) { ldata = rna_mesh_ldata_helper(me); - cdl = &ldata->layers[CustomData_get_layer_index_n(ldata, CD_MLOOPCOL, index)]; + cdl = &ldata->layers[CustomData_get_layer_index_n(ldata, CD_PROP_BYTE_COLOR, index)]; } RNA_pointer_create(&me->id, &RNA_MeshLoopColorLayer, cdl, &ptr); diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index 16045e6cddf..c2ab4897d60 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -1389,7 +1389,7 @@ static const EnumPropertyItem *rna_DataTransferModifier_layers_select_src_itemf( cdata = &me_eval->ldata; } - CustomDataType types[2] = {CD_PROP_COLOR, CD_MLOOPCOL}; + CustomDataType types[2] = {CD_PROP_COLOR, CD_PROP_BYTE_COLOR}; int idx = 0; for (int i = 0; i < 2; i++) { @@ -1485,7 +1485,7 @@ static const EnumPropertyItem *rna_DataTransferModifier_layers_select_dst_itemf( Object *ob_dst = CTX_data_active_object(C); /* XXX Is this OK? */ if (ob_dst && ob_dst->data) { - CustomDataType types[2] = {CD_PROP_COLOR, CD_MLOOPCOL}; + CustomDataType types[2] = {CD_PROP_COLOR, CD_PROP_BYTE_COLOR}; Mesh *me_dst = ob_dst->data; CustomData *cdata = STREQ(RNA_property_identifier(prop), "layers_vcol_vert_select_dst") ? diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c index 03f800d14d1..6f2264680c8 100644 --- a/source/blender/makesrna/intern/rna_particle.c +++ b/source/blender/makesrna/intern/rna_particle.c @@ -676,7 +676,7 @@ static void rna_ParticleSystem_mcol_on_emitter(ParticleSystem *particlesystem, int vcol_no, float r_mcol[3]) { - if (!CustomData_has_layer(&modifier->mesh_final->ldata, CD_MLOOPCOL)) { + if (!CustomData_has_layer(&modifier->mesh_final->ldata, CD_PROP_BYTE_COLOR)) { BKE_report(reports, RPT_ERROR, "Mesh has no VCol data"); zero_v3(r_mcol); return; diff --git a/source/blender/modifiers/intern/MOD_dynamicpaint.c b/source/blender/modifiers/intern/MOD_dynamicpaint.c index f8cf80b673c..1891ac5df7c 100644 --- a/source/blender/modifiers/intern/MOD_dynamicpaint.c +++ b/source/blender/modifiers/intern/MOD_dynamicpaint.c @@ -91,7 +91,7 @@ static void requiredDataMask(Object *UNUSED(ob), /* mcol */ if (surface->type == MOD_DPAINT_SURFACE_T_PAINT || surface->init_color_type == MOD_DPAINT_INITIAL_VERTEXCOLOR) { - r_cddata_masks->lmask |= CD_MASK_MLOOPCOL; + r_cddata_masks->lmask |= CD_MASK_PROP_BYTE_COLOR; } /* CD_MDEFORMVERT */ if (surface->type == MOD_DPAINT_SURFACE_T_WEIGHT) { diff --git a/source/blender/modifiers/intern/MOD_ocean.c b/source/blender/modifiers/intern/MOD_ocean.c index fbc5b7c288f..b5411eee883 100644 --- a/source/blender/modifiers/intern/MOD_ocean.c +++ b/source/blender/modifiers/intern/MOD_ocean.c @@ -373,17 +373,17 @@ static Mesh *doOcean(ModifierData *md, const ModifierEvalContext *ctx, Mesh *mes /* add vcols before displacement - allows lookup based on position */ if (omd->flag & MOD_OCEAN_GENERATE_FOAM) { - if (CustomData_number_of_layers(&result->ldata, CD_MLOOPCOL) < MAX_MCOL) { + if (CustomData_number_of_layers(&result->ldata, CD_PROP_BYTE_COLOR) < MAX_MCOL) { const int polys_num = result->totpoly; const int loops_num = result->totloop; MLoop *mloops = result->mloop; MLoopCol *mloopcols = CustomData_add_layer_named( - &result->ldata, CD_MLOOPCOL, CD_CALLOC, NULL, loops_num, omd->foamlayername); + &result->ldata, CD_PROP_BYTE_COLOR, CD_CALLOC, NULL, loops_num, omd->foamlayername); MLoopCol *mloopcols_spray = NULL; if (omd->flag & MOD_OCEAN_GENERATE_SPRAY) { mloopcols_spray = CustomData_add_layer_named( - &result->ldata, CD_MLOOPCOL, CD_CALLOC, NULL, loops_num, omd->spraylayername); + &result->ldata, CD_PROP_BYTE_COLOR, CD_CALLOC, NULL, loops_num, omd->spraylayername); } if (mloopcols) { /* unlikely to fail */ diff --git a/source/blender/modifiers/intern/MOD_particleinstance.c b/source/blender/modifiers/intern/MOD_particleinstance.c index 5af95a0f289..2a8d2454670 100644 --- a/source/blender/modifiers/intern/MOD_particleinstance.c +++ b/source/blender/modifiers/intern/MOD_particleinstance.c @@ -59,7 +59,7 @@ static void requiredDataMask(Object *UNUSED(ob), ParticleInstanceModifierData *pimd = (ParticleInstanceModifierData *)md; if (pimd->index_layer_name[0] != '\0' || pimd->value_layer_name[0] != '\0') { - r_cddata_masks->lmask |= CD_MASK_MLOOPCOL; + r_cddata_masks->lmask |= CD_MASK_PROP_BYTE_COLOR; } } @@ -328,9 +328,9 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh * orig_mloop = mesh->mloop; MLoopCol *mloopcols_index = CustomData_get_layer_named( - &result->ldata, CD_MLOOPCOL, pimd->index_layer_name); + &result->ldata, CD_PROP_BYTE_COLOR, pimd->index_layer_name); MLoopCol *mloopcols_value = CustomData_get_layer_named( - &result->ldata, CD_MLOOPCOL, pimd->value_layer_name); + &result->ldata, CD_PROP_BYTE_COLOR, pimd->value_layer_name); int *vert_part_index = NULL; float *vert_part_value = NULL; if (mloopcols_index != NULL) { diff --git a/source/blender/python/bmesh/bmesh_py_types_customdata.c b/source/blender/python/bmesh/bmesh_py_types_customdata.c index e591dfa2929..58bfb922327 100644 --- a/source/blender/python/bmesh/bmesh_py_types_customdata.c +++ b/source/blender/python/bmesh/bmesh_py_types_customdata.c @@ -193,7 +193,7 @@ static PyGetSetDef bpy_bmlayeraccess_vert_getseters[] = { (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, bpy_bmlayeraccess_collection__color_doc, - (void *)CD_MLOOPCOL}, + (void *)CD_PROP_BYTE_COLOR}, {"string", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, @@ -254,7 +254,7 @@ static PyGetSetDef bpy_bmlayeraccess_edge_getseters[] = { (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, bpy_bmlayeraccess_collection__color_doc, - (void *)CD_MLOOPCOL}, + (void *)CD_PROP_BYTE_COLOR}, {"string", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, @@ -307,7 +307,7 @@ static PyGetSetDef bpy_bmlayeraccess_face_getseters[] = { (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, bpy_bmlayeraccess_collection__color_doc, - (void *)CD_MLOOPCOL}, + (void *)CD_PROP_BYTE_COLOR}, {"string", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, @@ -365,7 +365,7 @@ static PyGetSetDef bpy_bmlayeraccess_loop_getseters[] = { (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, bpy_bmlayeraccess_collection__color_doc, - (void *)CD_MLOOPCOL}, + (void *)CD_PROP_BYTE_COLOR}, {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ }; @@ -1134,7 +1134,7 @@ PyObject *BPy_BMLayerItem_GetItem(BPy_BMElem *py_ele, BPy_BMLayerItem *py_layer) ret = BPy_BMLoopUV_CreatePyObject(value); break; } - case CD_MLOOPCOL: { + case CD_PROP_BYTE_COLOR: { ret = BPy_BMLoopColor_CreatePyObject(value); break; } @@ -1236,7 +1236,7 @@ int BPy_BMLayerItem_SetItem(BPy_BMElem *py_ele, BPy_BMLayerItem *py_layer, PyObj ret = BPy_BMLoopUV_AssignPyObject(value, py_value); break; } - case CD_MLOOPCOL: { + case CD_PROP_BYTE_COLOR: { ret = BPy_BMLoopColor_AssignPyObject(value, py_value); break; } diff --git a/source/blender/render/intern/texture_pointdensity.c b/source/blender/render/intern/texture_pointdensity.c index bb313d4962c..8ba3bac7cad 100644 --- a/source/blender/render/intern/texture_pointdensity.c +++ b/source/blender/render/intern/texture_pointdensity.c @@ -277,11 +277,12 @@ static void pointdensity_cache_vertex_color(PointDensity *pd, BLI_assert(data_color); - if (!CustomData_has_layer(&mesh->ldata, CD_MLOOPCOL)) { + if (!CustomData_has_layer(&mesh->ldata, CD_PROP_BYTE_COLOR)) { return; } - CustomData_validate_layer_name(&mesh->ldata, CD_MLOOPCOL, pd->vertex_attribute_name, layername); - mcol = CustomData_get_layer_named(&mesh->ldata, CD_MLOOPCOL, layername); + CustomData_validate_layer_name( + &mesh->ldata, CD_PROP_BYTE_COLOR, pd->vertex_attribute_name, layername); + mcol = CustomData_get_layer_named(&mesh->ldata, CD_PROP_BYTE_COLOR, layername); if (!mcol) { return; } @@ -372,7 +373,7 @@ static void pointdensity_cache_object(PointDensity *pd, Object *ob) mask.fmask |= CD_MASK_MTFACE | CD_MASK_MCOL; switch (pd->ob_color_source) { case TEX_PD_COLOR_VERTCOL: - mask.lmask |= CD_MASK_MLOOPCOL; + mask.lmask |= CD_MASK_PROP_BYTE_COLOR; break; case TEX_PD_COLOR_VERTWEIGHT: mask.vmask |= CD_MASK_MDEFORMVERT; |