[Bf-blender-cvs] [3b4031718a4] temp-T96709-painting-target: Update paint slots when object changes.

Jeroen Bakker noreply at git.blender.org
Wed Mar 30 09:13:21 CEST 2022


Commit: 3b4031718a46025e4b2d4fe56fafe6e74b1e7a7e
Author: Jeroen Bakker
Date:   Wed Mar 30 09:13:18 2022 +0200
Branches: temp-T96709-painting-target
https://developer.blender.org/rB3b4031718a46025e4b2d4fe56fafe6e74b1e7a7e

Update paint slots when object changes.

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

M	source/blender/blenkernel/intern/paint.c
M	source/blender/makesdna/DNA_material_types.h

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

diff --git a/source/blender/blenkernel/intern/paint.c b/source/blender/blenkernel/intern/paint.c
index 1c58173f570..6f6dc1282fd 100644
--- a/source/blender/blenkernel/intern/paint.c
+++ b/source/blender/blenkernel/intern/paint.c
@@ -41,6 +41,7 @@
 #include "BKE_key.h"
 #include "BKE_lib_id.h"
 #include "BKE_main.h"
+#include "BKE_material.h"
 #include "BKE_mesh.h"
 #include "BKE_mesh_mapping.h"
 #include "BKE_mesh_runtime.h"
@@ -1601,6 +1602,12 @@ static bool sculpt_modifiers_active(Scene *scene, Sculpt *sd, Object *ob)
   return false;
 }
 
+static void sculpt_update_object_paint_slots(Depsgraph *depsgraph, Object *ob)
+{
+  Scene *scene = DEG_get_input_scene(depsgraph);
+  BKE_texpaint_slots_refresh_object(scene, ob);
+}
+
 /**
  * \param need_mask: So that the evaluated mesh that is returned has mask data.
  */
@@ -1617,6 +1624,7 @@ static void sculpt_update_object(Depsgraph *depsgraph,
   const Mesh *me = BKE_object_get_original_mesh(ob);
   MultiresModifierData *mmd = BKE_sculpt_multires_active(scene, ob);
   const bool use_face_sets = (ob->mode & OB_MODE_SCULPT) != 0;
+  const bool use_paint_slots = (ob->mode & OB_MODE_SCULPT) != 0;
 
   ss->depsgraph = depsgraph;
 
@@ -1743,6 +1751,10 @@ static void sculpt_update_object(Depsgraph *depsgraph,
       }
     }
   }
+
+  if (use_paint_slots) {
+    sculpt_update_object_paint_slots(depsgraph, ob);
+  }
 }
 
 void BKE_sculpt_update_object_before_eval(Object *ob)
diff --git a/source/blender/makesdna/DNA_material_types.h b/source/blender/makesdna/DNA_material_types.h
index d20a2e86a5e..b535d3cdb8a 100644
--- a/source/blender/makesdna/DNA_material_types.h
+++ b/source/blender/makesdna/DNA_material_types.h
@@ -31,7 +31,10 @@ typedef struct TexPaintSlot {
   struct Image *ima;
   /** Custom-data index for uv layer, #MAX_NAME. */
   char *uvname;
-  /** Color attribute name when painting using color attributes. Mutual exclusive with ima. */
+  /**
+   * Color attribute name when painting using color attributes. Mutual exclusive with ima.
+   * Points to the name of a CustomDataLayer.
+   */
   char *attribute_name;
   /** Do we have a valid image and UV map or attribute. */
   int valid;



More information about the Bf-blender-cvs mailing list