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.
This commit is contained in:
Brecht Van Lommel 2020-03-25 23:48:10 +01:00
parent 99e693d126
commit 366cb3a059
Notes: blender-bot 2023-02-14 08:47:25 +01:00
Referenced by issue #74711, Tiling Brush option does not works in blender 2.82
1 changed files with 5 additions and 2 deletions

View File

@ -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;