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.
This commit is contained in:
Antony Riakiotakis
2013-02-14 15:44:09 +00:00
parent 8d339a89db
commit 59a2ed19df
2 changed files with 10 additions and 7 deletions

View File

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

View File

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