[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [54554] trunk/blender/source/blender: Fix: Tiled image painting in image editor was broken for float canvas.

Antony Riakiotakis kalast at gmail.com
Thu Feb 14 16:44:10 CET 2013


Revision: 54554
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=54554
Author:   psy-fi
Date:     2013-02-14 15:44:09 +0000 (Thu, 14 Feb 2013)
Log Message:
-----------
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.

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/intern/brush.c
    trunk/blender/source/blender/editors/sculpt_paint/paint_image_2d.c

Modified: trunk/blender/source/blender/blenkernel/intern/brush.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/brush.c	2013-02-14 14:50:16 UTC (rev 54553)
+++ trunk/blender/source/blender/blenkernel/intern/brush.c	2013-02-14 15:44:09 UTC (rev 54554)
@@ -588,11 +588,16 @@
 				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);
+				}
 			}
 		}
 	}

Modified: trunk/blender/source/blender/editors/sculpt_paint/paint_image_2d.c
===================================================================
--- trunk/blender/source/blender/editors/sculpt_paint/paint_image_2d.c	2013-02-14 14:50:16 UTC (rev 54553)
+++ trunk/blender/source/blender/editors/sculpt_paint/paint_image_2d.c	2013-02-14 15:44:09 UTC (rev 54554)
@@ -197,8 +197,7 @@
 
 			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_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 @@
 
 	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 @@
 
 		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 @@
 		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);
 	}
 }
 




More information about the Bf-blender-cvs mailing list