[Bf-blender-cvs] [19ea75f8cf3] temp-sculpt-colors: temp-sculpt-colors: Fix vertex paint color attribute auto creation.

Joseph Eagar noreply at git.blender.org
Tue Mar 22 18:09:30 CET 2022


Commit: 19ea75f8cf367da7e44e26933892a973ab9725d4
Author: Joseph Eagar
Date:   Tue Mar 22 10:08:51 2022 -0700
Branches: temp-sculpt-colors
https://developer.blender.org/rB19ea75f8cf367da7e44e26933892a973ab9725d4

temp-sculpt-colors: Fix vertex paint color attribute
                    auto creation.

===================================================================

M	source/blender/editors/geometry/geometry_attributes.cc
M	source/blender/editors/mesh/mesh_data.c

===================================================================

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);
   }



More information about the Bf-blender-cvs mailing list