[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [57950] branches/soc-2013-paint/source/ blender/editors/sculpt_paint/paint_image_2d.c: Fix issue reported on blenderartists: 2d painting does not respect the

Antony Riakiotakis kalast at gmail.com
Tue Jul 2 23:56:29 CEST 2013


Revision: 57950
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=57950
Author:   psy-fi
Date:     2013-07-02 21:56:28 +0000 (Tue, 02 Jul 2013)
Log Message:
-----------
Fix issue reported on blenderartists: 2d painting does not respect the
brush strength when masking is off. I hope behaviour will at last be
consistent in every case now.

Modified Paths:
--------------
    branches/soc-2013-paint/source/blender/editors/sculpt_paint/paint_image_2d.c

Modified: branches/soc-2013-paint/source/blender/editors/sculpt_paint/paint_image_2d.c
===================================================================
--- branches/soc-2013-paint/source/blender/editors/sculpt_paint/paint_image_2d.c	2013-07-02 21:47:42 UTC (rev 57949)
+++ branches/soc-2013-paint/source/blender/editors/sculpt_paint/paint_image_2d.c	2013-07-02 21:56:28 UTC (rev 57950)
@@ -235,7 +235,7 @@
 }
 
 
-/* create a mask with the falloff strength and optionally brush alpha */
+/* create a mask with the falloff strength */
 static unsigned short *brush_painter_curve_mask_new(BrushPainter *painter, int size)
 {
 	Scene *scene = painter->scene;
@@ -281,7 +281,8 @@
 
 	int x, y, thread = 0;
 	float brush_rgb[3];
-	float alpha = BKE_brush_alpha_get(scene, brush) * 65535.0f;
+	float alpha = (is_maskbrush)? BKE_brush_alpha_get(scene, brush) :
+	                              BKE_brush_alpha_get(scene, brush) * 65535.0f;
 
 	unsigned short *mask = painter->cache.curve_mask;
 	unsigned short *max_mask = painter->cache.max_mask;
@@ -324,7 +325,7 @@
 			/* when not using masking, multiply in falloff and strength */
 			if (!use_masking) {
 				unsigned short *m = mask + (y * ibuf->x + x);
-				unsigned short max_m = (is_maskbrush)? *(max_mask + (y * ibuf->x + x)) : alpha;
+				unsigned short max_m = (is_maskbrush)? *(max_mask + (y * ibuf->x + x)) * alpha : alpha;
 				rgba[3] *= (*m) * (1.0f / 65535.0f) * (max_m) * (1.0f / 65535.0f);
 			}
 
@@ -364,7 +365,8 @@
 	bool is_maskbrush = painter->cache.is_maskbrush;
 	bool use_texture_old = (oldtexibuf != NULL);
 
-	float alpha = BKE_brush_alpha_get(scene, brush) * 65535.0f;
+	float alpha = (is_maskbrush)? BKE_brush_alpha_get(scene, brush) :
+	                              BKE_brush_alpha_get(scene, brush) * 65535.0f;
 
 	int x, y, thread = 0;
 	float brush_rgb[3];
@@ -422,7 +424,7 @@
 				/* if not using masking, multiply in the mask now */
 				if (!use_masking) {
 					unsigned short *m = mask + (y * ibuf->x + x);
-					unsigned short max_m = (is_maskbrush)? *(max_mask + (y * ibuf->x + x)) : alpha;
+					unsigned short max_m = (is_maskbrush)? *(max_mask + (y * ibuf->x + x)) * alpha : alpha;
 					rgba[3] *= (*m) * (1.0f / 65535.0f) * (max_m) * (1.0f / 65535.0f);
 				}
 
@@ -457,7 +459,7 @@
 				/* if not using masking, multiply in the mask now */
 				if (!use_masking) {
 					unsigned short *m = mask + (y * ibuf->x + x);
-					unsigned short max_m = (is_maskbrush)? *(max_mask + (y * ibuf->x + x)) : alpha;
+					unsigned short max_m = (is_maskbrush)? *(max_mask + (y * ibuf->x + x)) * alpha : alpha;
 					crgba[3] = crgba[3] * (*m) * 1/(65535.0f) * (max_m) * 1/(65535.0f);
 				}
 




More information about the Bf-blender-cvs mailing list