[Bf-blender-cvs] [94d7db2cc00] temp-3d-texturing-brush-b: Use brush texture as color texture.

Jeroen Bakker noreply at git.blender.org
Mon Mar 21 14:28:08 CET 2022


Commit: 94d7db2cc0024823202f5984be832ced0ec219b3
Author: Jeroen Bakker
Date:   Mon Mar 21 14:27:51 2022 +0100
Branches: temp-3d-texturing-brush-b
https://developer.blender.org/rB94d7db2cc0024823202f5984be832ced0ec219b3

Use brush texture as color texture.

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

M	source/blender/editors/sculpt_paint/sculpt.c
M	source/blender/editors/sculpt_paint/sculpt_intern.h
M	source/blender/editors/sculpt_paint/sculpt_texture_paint_d.cc

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

diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index de6343f6e46..7dea40bd2e6 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -2393,6 +2393,7 @@ float SCULPT_brush_texture_eval(SculptSession *ss,
 
 float SCULPT_brush_strength_factor_custom_automask(SculptSession *ss,
                                                    const Brush *br,
+                                                   const MTex *mtex,
                                                    const float brush_point[3],
                                                    const float len,
                                                    const float vno[3],
@@ -2402,7 +2403,6 @@ float SCULPT_brush_strength_factor_custom_automask(SculptSession *ss,
                                                    const int thread_id)
 {
   StrokeCache *cache = ss->cache;
-  const MTex *mtex = &br->mtex;
   float avg = 1.0f;
   float rgba[4];
 
@@ -2449,7 +2449,7 @@ float SCULPT_brush_strength_factor(SculptSession *ss,
   const float automask_factor = SCULPT_automasking_factor_get(
       ss->cache->automasking, ss, vertex_index);
   return SCULPT_brush_strength_factor_custom_automask(
-      ss, br, brush_point, len, vno, fno, mask, automask_factor, thread_id);
+      ss, br, &br->mtex, brush_point, len, vno, fno, mask, automask_factor, thread_id);
 }
 
 bool SCULPT_search_sphere_cb(PBVHNode *node, void *data_v)
diff --git a/source/blender/editors/sculpt_paint/sculpt_intern.h b/source/blender/editors/sculpt_paint/sculpt_intern.h
index 67d00680988..b22738bf3f7 100644
--- a/source/blender/editors/sculpt_paint/sculpt_intern.h
+++ b/source/blender/editors/sculpt_paint/sculpt_intern.h
@@ -1141,6 +1141,7 @@ float SCULPT_brush_strength_factor(struct SculptSession *ss,
                                    int thread_id);
 float SCULPT_brush_strength_factor_custom_automask(struct SculptSession *ss,
                                                    const struct Brush *br,
+                                                   const MTex *mtex,
                                                    const float point[3],
                                                    float len,
                                                    const float vno[3],
diff --git a/source/blender/editors/sculpt_paint/sculpt_texture_paint_d.cc b/source/blender/editors/sculpt_paint/sculpt_texture_paint_d.cc
index bcc2d32cc3a..57a59ac2d77 100644
--- a/source/blender/editors/sculpt_paint/sculpt_texture_paint_d.cc
+++ b/source/blender/editors/sculpt_paint/sculpt_texture_paint_d.cc
@@ -119,6 +119,7 @@ template<typename ImagePixelAccessor> class PaintingKernel {
 
   SculptSession *ss;
   const Brush *brush;
+  MTex mtex;
   const int thread_id;
   const MVert *mvert;
 
@@ -140,6 +141,7 @@ template<typename ImagePixelAccessor> class PaintingKernel {
   {
     init_brush_strength();
     init_brush_test();
+    mtex = brush->mtex;
   }
 
   bool paint(const Triangles &triangles, const PixelsPackage &encoded_pixels, ImBuf *image_buffer)
@@ -160,8 +162,8 @@ template<typename ImagePixelAccessor> class PaintingKernel {
         continue;
       }
 
-      if (brush->mask_mtex.tex) {
-        SCULPT_brush_texture_eval(ss, brush, &brush->mask_mtex, pixel.pos, thread_id, brush_color);
+      if (mtex.tex) {
+        SCULPT_brush_texture_eval(ss, brush, &mtex, pixel.pos, thread_id, brush_color);
       }
 
       float4 color = image_accessor.read_pixel(image_buffer);
@@ -171,6 +173,7 @@ template<typename ImagePixelAccessor> class PaintingKernel {
       const float falloff_strength = SCULPT_brush_strength_factor_custom_automask(
           ss,
           brush,
+          &brush->mask_mtex,
           pixel.pos,
           sqrtf(test.dist),
           normal,



More information about the Bf-blender-cvs mailing list