[Bf-blender-cvs] [366cb3a0592] master: Fix T74711: tiling brush option in image editor not working anymore

Brecht Van Lommel noreply at git.blender.org
Thu Mar 26 00:09:39 CET 2020


Commit: 366cb3a0592af4736fa9efc5881eab4760b7cba7
Author: Brecht Van Lommel
Date:   Wed Mar 25 23:48:10 2020 +0100
Branches: master
https://developer.blender.org/rB366cb3a0592af4736fa9efc5881eab4760b7cba7

Fix T74711: tiling brush option in image editor not working anymore

This makes it work again at least for the non-UDIM case. For UDIM it's not
great still but I'll consider that a known limitation. A proper solution is
probably to find the closest tile at the start of the stroke and then only
paint in that one tile for the rest of the stroke.

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

M	source/blender/editors/sculpt_paint/paint_image_2d.c

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

diff --git a/source/blender/editors/sculpt_paint/paint_image_2d.c b/source/blender/editors/sculpt_paint/paint_image_2d.c
index fc56c5cb6c6..73c099c9407 100644
--- a/source/blender/editors/sculpt_paint/paint_image_2d.c
+++ b/source/blender/editors/sculpt_paint/paint_image_2d.c
@@ -1609,7 +1609,9 @@ void paint_2d_stroke(void *ps,
     copy_v2_v2(last_uv, old_uv);
   }
 
-  float uv_brush_size[2] = {base_size / s->tiles[0].size[0], base_size / s->tiles[0].size[1]};
+  const float uv_brush_size[2] = {
+      (s->symmetry & PAINT_TILE_X) ? FLT_MAX : base_size / s->tiles[0].size[0],
+      (s->symmetry & PAINT_TILE_Y) ? FLT_MAX : base_size / s->tiles[0].size[1]};
 
   for (int i = 0; i < s->num_tiles; i++) {
     ImagePaintTile *tile = &s->tiles[i];
@@ -1640,7 +1642,8 @@ void paint_2d_stroke(void *ps,
     paint_2d_uv_to_coord(tile, last_uv, tile->last_paintpos);
 
     /* Second check in pixel coordinates. */
-    const float pixel_brush_size[] = {size, size};
+    const float pixel_brush_size[] = {(s->symmetry & PAINT_TILE_X) ? FLT_MAX : size,
+                                      (s->symmetry & PAINT_TILE_Y) ? FLT_MAX : size};
     if (!(is_inside_tile(tile->size, new_coord, pixel_brush_size) ||
           is_inside_tile(tile->size, old_coord, pixel_brush_size))) {
       continue;



More information about the Bf-blender-cvs mailing list