diff options
author | Joseph Eagar <joeedh@gmail.com> | 2022-04-21 08:03:45 +0300 |
---|---|---|
committer | Joseph Eagar <joeedh@gmail.com> | 2022-04-21 08:14:03 +0300 |
commit | 575ade22d4de472ccf9e7d2dc1ffca37416c58f6 (patch) | |
tree | a3f3432ea1c1ad6c4792ec3cfeea55e97b9280b8 /source/blender/editors/mesh | |
parent | c6ed879f9aa7cd863f146cc7104f16cfe8a73e8a (diff) |
Commit D14179: Revamp Vertex Paint With C++
- Verrtex paint mode has been refactored into C++ templates.
It now works with both byte and float colors and point
& corner attribute domains.
- There is a new API for mixing colors (also based
on C++ templates). Unlike the existing APIs byte
and float colors are interpolated identically.
Interpolation does happen in a squared rgb space,
this may be changed in the future.
- Vertex paint now uses the sculpt undo system.
Reviewed By: Brecht Van Lommel.
Differential Revision: https://developer.blender.org/D14179
Ref D14179
Diffstat (limited to 'source/blender/editors/mesh')
-rw-r--r-- | source/blender/editors/mesh/mesh_data.c | 12 |
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) |