[Bf-blender-cvs] [4c4a5ff] soc-2013-paint: Fix swimming textures on 2D painting with textured brushes + pressure.

Antony Riakiotakis noreply at git.blender.org
Sat May 10 13:40:20 CEST 2014


Commit: 4c4a5ffd01d3093c2e6dd1ba1a2e34a168808261
Author: Antony Riakiotakis
Date:   Sat May 10 14:26:13 2014 +0300
https://developer.blender.org/rB4c4a5ffd01d3093c2e6dd1ba1a2e34a168808261

Fix swimming textures on 2D painting with textured brushes + pressure.

When sampling the old texture buffer we need to account for the diameter
change in the sampling offset as well.

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

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 bf5275b..d6b5e3c 100644
--- a/source/blender/editors/sculpt_paint/paint_image_2d.c
+++ b/source/blender/editors/sculpt_paint/paint_image_2d.c
@@ -299,10 +299,10 @@ static void brush_painter_mask_imbuf_partial_update(BrushPainter *painter, const
 		maskibuf_old.y = cache->tex_mask_old_h;
 
 		srcx = srcy = 0;
-		destx = (int)painter->lastpaintpos[0] - (int)pos[0];
-		desty = (int)painter->lastpaintpos[1] - (int)pos[1];
 		w = cache->tex_mask_old_w;
 		h = cache->tex_mask_old_h;
+		destx = (int)painter->lastpaintpos[0] - (int)pos[0]  + (diameter/2 - w/2);
+		desty = (int)painter->lastpaintpos[1] - (int)pos[1]  + (diameter/2 - h/2);
 
 		/* hack, use temporary rects so that clipping works */
 		IMB_rectclip(&maskibuf, &maskibuf_old, &destx, &desty, &srcx, &srcy, &w, &h);
@@ -567,10 +567,10 @@ static void brush_painter_imbuf_partial_update(BrushPainter *painter, const floa
 
 	if (oldtexibuf) {
 		srcx = srcy = 0;
-		destx = (int)painter->lastpaintpos[0] - (int)pos[0];
-		desty = (int)painter->lastpaintpos[1] - (int)pos[1];
 		w = oldtexibuf->x;
 		h = oldtexibuf->y;
+		destx = (int)painter->lastpaintpos[0] - (int)pos[0] + (diameter/2 - w/2);
+		desty = (int)painter->lastpaintpos[1] - (int)pos[1] + (diameter/2 - h/2);
 
 		IMB_rectclip(cache->texibuf, oldtexibuf, &destx, &desty, &srcx, &srcy, &w, &h);
 	}




More information about the Bf-blender-cvs mailing list