From 59a2ed19df86bcb60034af693ee8909ddc57c081 Mon Sep 17 00:00:00 2001 From: Antony Riakiotakis Date: Thu, 14 Feb 2013 15:44:09 +0000 Subject: Fix: Tiled image painting in image editor was broken for float canvas. The mask was initialized using texture values, while it needed to be opaque. --- source/blender/blenkernel/intern/brush.c | 7 ++++++- source/blender/editors/sculpt_paint/paint_image_2d.c | 10 ++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c index 2ce5053bdcc..ce838ce519e 100644 --- a/source/blender/blenkernel/intern/brush.c +++ b/source/blender/blenkernel/intern/brush.c @@ -588,11 +588,16 @@ void BKE_brush_imbuf_new(const Scene *scene, Brush *brush, short flt, short texf else if (texfall == 1) { BKE_brush_sample_tex_2D(scene, brush, xy, dstf, 0); } - else { + else if (texfall == 2){ BKE_brush_sample_tex_2D(scene, brush, xy, rgba, 0); mul_v3_v3v3(dstf, rgba, brush_rgb); dstf[3] = rgba[3] * alpha * BKE_brush_curve_strength_clamp(brush, len_v2(xy), radius); } + else { + BKE_brush_sample_tex_2D(scene, brush, xy, rgba, 0); + copy_v3_v3(dstf, brush_rgb); + dstf[3] = rgba[3] * alpha * BKE_brush_curve_strength_clamp(brush, len_v2(xy), radius); + } } } } diff --git a/source/blender/editors/sculpt_paint/paint_image_2d.c b/source/blender/editors/sculpt_paint/paint_image_2d.c index 0b76c88df66..84250853f38 100644 --- a/source/blender/editors/sculpt_paint/paint_image_2d.c +++ b/source/blender/editors/sculpt_paint/paint_image_2d.c @@ -197,8 +197,7 @@ static void brush_painter_do_partial(BrushPainter *painter, ImBuf *oldtexibuf, for (x = origx; x < w; x++, bf += 4, mf += 4, tf += 4) { if (dotexold) { - copy_v3_v3(tf, otf); - tf[3] = otf[3]; + copy_v4_v4(tf, otf); otf += 4; } else { @@ -249,7 +248,7 @@ static void brush_painter_do_partial(BrushPainter *painter, ImBuf *oldtexibuf, } } -static void brush_painter_fixed_tex_partial_update(BrushPainter *painter, const float pos[2]) +static void brush_painter_tiled_tex_partial_update(BrushPainter *painter, const float pos[2]) { const Scene *scene = painter->scene; Brush *brush = painter->brush; @@ -265,7 +264,6 @@ static void brush_painter_fixed_tex_partial_update(BrushPainter *painter, const oldtexibuf = cache->texibuf; cache->texibuf = IMB_allocImBuf(diameter, diameter, 32, imbflag); - if (oldtexibuf) { srcx = srcy = 0; destx = (int)painter->lastpaintpos[0] - (int)pos[0]; @@ -334,7 +332,7 @@ static void brush_painter_refresh_cache(BrushPainter *painter, const float pos[2 if (do_tiled) { BKE_brush_imbuf_new(scene, brush, flt, 3, size, &cache->maskibuf, use_color_correction); - brush_painter_fixed_tex_partial_update(painter, pos); + brush_painter_tiled_tex_partial_update(painter, pos); } else BKE_brush_imbuf_new(scene, brush, flt, 2, size, &cache->ibuf, use_color_correction); @@ -348,7 +346,7 @@ static void brush_painter_refresh_cache(BrushPainter *painter, const float pos[2 int dy = (int)painter->lastpaintpos[1] - (int)pos[1]; if ((dx != 0) || (dy != 0)) - brush_painter_fixed_tex_partial_update(painter, pos); + brush_painter_tiled_tex_partial_update(painter, pos); } } -- cgit v1.2.3