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:
authorJoseph Eagar <joeedh@gmail.com>2022-03-22 20:08:51 +0300
committerJoseph Eagar <joeedh@gmail.com>2022-03-22 20:09:16 +0300
commit19ea75f8cf367da7e44e26933892a973ab9725d4 (patch)
tree65f2ef43b6b8f68068bedb26aac7cb7e5b89cbaa
parent4c7ea01cbdc3ed0c37c9ea8e5cc223ee2fa1926b (diff)
temp-sculpt-colors: Fix vertex paint color attribute
auto creation.
-rw-r--r--source/blender/editors/geometry/geometry_attributes.cc6
-rw-r--r--source/blender/editors/mesh/mesh_data.c4
2 files changed, 10 insertions, 0 deletions
diff --git a/source/blender/editors/geometry/geometry_attributes.cc b/source/blender/editors/geometry/geometry_attributes.cc
index a200f8bcdb0..4f864c15751 100644
--- a/source/blender/editors/geometry/geometry_attributes.cc
+++ b/source/blender/editors/geometry/geometry_attributes.cc
@@ -17,6 +17,7 @@
#include "BKE_context.h"
#include "BKE_deform.h"
#include "BKE_geometry_set.hh"
+#include "BKE_mesh.h"
#include "BKE_object_deform.h"
#include "BKE_report.h"
@@ -423,6 +424,11 @@ static int geometry_color_attribute_remove_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
+ if (GS(id->name) == ID_ME) {
+ Mesh *me = static_cast<Mesh *>(ob->data);
+ BKE_mesh_update_customdata_pointers(me, true);
+ }
+
DEG_id_tag_update(id, ID_RECALC_GEOMETRY);
WM_main_add_notifier(NC_GEOM | ND_DATA, id);
diff --git a/source/blender/editors/mesh/mesh_data.c b/source/blender/editors/mesh/mesh_data.c
index b99ff8296f3..93f69d299f5 100644
--- a/source/blender/editors/mesh/mesh_data.c
+++ b/source/blender/editors/mesh/mesh_data.c
@@ -17,6 +17,7 @@
#include "BLI_math.h"
#include "BLI_utildefines.h"
+#include "BKE_attribute.h"
#include "BKE_context.h"
#include "BKE_customdata.h"
#include "BKE_editmesh.h"
@@ -429,6 +430,9 @@ bool ED_mesh_color_ensure(struct Mesh *me, const char *name)
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);
+
+ BKE_id_attributes_active_color_set(&me->id, me->ldata.layers + layer_i);
BKE_mesh_update_customdata_pointers(me, true);
}