Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Goudey <h.goudey@me.com>2022-04-20 17:10:10 +0300
committerHans Goudey <h.goudey@me.com>2022-04-20 17:10:10 +0300
commit03ec505fa549840936d7425269073dc82fd29b10 (patch)
tree63d94605acd1248689852735ae07056c08505cd7 /source/blender/editors
parent0385e2f1f90ff10c75773cc22125292a82cddaa6 (diff)
Cleanup: Rename CD_MLOOPCOL to CD_PROP_BYTE_COLOR
The "PROP" in the name reflects its generic status, and removing "LOOP" makes sense because it is no longer associated with just mesh face corners. In general the goal is to remove extra semantic meaning from the custom data types.
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/geometry/geometry_attributes.cc10
-rw-r--r--source/blender/editors/mesh/editmesh_utils.c2
-rw-r--r--source/blender/editors/mesh/mesh_data.c36
-rw-r--r--source/blender/editors/object/object_bake_api.c6
-rw-r--r--source/blender/editors/object/object_data_transfer.c6
-rw-r--r--source/blender/editors/sculpt_paint/paint_vertex.c4
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_ops.c8
-rw-r--r--source/blender/editors/space_node/node_geometry_attribute_search.cc2
-rw-r--r--source/blender/editors/space_view3d/view3d_draw.c4
9 files changed, 40 insertions, 38 deletions
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;
}
}