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:
Diffstat (limited to 'source/blender/editors/mesh/mesh_data.c')
-rw-r--r--source/blender/editors/mesh/mesh_data.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/source/blender/editors/mesh/mesh_data.c b/source/blender/editors/mesh/mesh_data.c
index 39dccb66899..9b069aae7e3 100644
--- a/source/blender/editors/mesh/mesh_data.c
+++ b/source/blender/editors/mesh/mesh_data.c
@@ -428,19 +428,19 @@ int ED_mesh_color_add(
bool ED_mesh_color_ensure(struct Mesh *me, const char *name)
{
BLI_assert(me->edit_mesh == NULL);
+ CustomDataLayer *layer = BKE_id_attributes_active_color_get(&me->id);
- if (!me->mloopcol && me->totloop) {
- 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);
+ if (!layer) {
+ CustomData_add_layer_named(&me->ldata, CD_PROP_BYTE_COLOR, CD_DEFAULT, NULL, me->totloop, name);
+ layer = me->ldata.layers + CustomData_get_layer_index(&me->ldata, CD_PROP_BYTE_COLOR);
- BKE_id_attributes_active_color_set(&me->id, me->ldata.layers + layer_i);
+ BKE_id_attributes_active_color_set(&me->id, layer);
BKE_mesh_update_customdata_pointers(me, true);
}
DEG_id_tag_update(&me->id, 0);
- return (me->mloopcol != NULL);
+ return (layer != NULL);
}
bool ED_mesh_color_remove_index(Mesh *me, const int n)