diff options
author | Campbell Barton <ideasman42@gmail.com> | 2017-09-29 12:55:00 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2017-09-29 12:55:00 +0300 |
commit | e3fe8128e41bb7c576f02ba234dfabf5c399cb60 (patch) | |
tree | cd148a38fb32cdb1a36fc576b9f36fe864003e40 /source/blender/editors/mesh/mesh_data.c | |
parent | 31be6fccf83095f4245f97730ccc7e61e51cfcec (diff) | |
parent | 5a1954a5cbd7b0b1458fdc80ada5acd036278309 (diff) |
Merge branch 'master' into blender2.8
Diffstat (limited to 'source/blender/editors/mesh/mesh_data.c')
-rw-r--r-- | source/blender/editors/mesh/mesh_data.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/source/blender/editors/mesh/mesh_data.c b/source/blender/editors/mesh/mesh_data.c index 2767ce75a5f..f2e60c55574 100644 --- a/source/blender/editors/mesh/mesh_data.c +++ b/source/blender/editors/mesh/mesh_data.c @@ -440,6 +440,20 @@ int ED_mesh_color_add(Mesh *me, const char *name, const bool active_set) return layernum; } +bool ED_mesh_color_ensure(struct Mesh *me, const char *name) +{ + BLI_assert(me->edit_btmesh == NULL); + + if (!me->mloopcol && me->totloop) { + CustomData_add_layer_named(&me->ldata, CD_MLOOPCOL, CD_DEFAULT, NULL, me->totloop, name); + BKE_mesh_update_customdata_pointers(me, true); + } + + DEG_id_tag_update(&me->id, 0); + + return (me->mloopcol != NULL); +} + bool ED_mesh_color_remove_index(Mesh *me, const int n) { CustomData *ldata = GET_CD_DATA(me, ldata); |