[Bf-blender-cvs] [a0e8b98] master: Fix T43207 fill brush fails in perspective mode

Antony Riakiotakis noreply at git.blender.org
Thu Jan 29 17:45:57 CET 2015


Commit: a0e8b98b6102ac19f0724b390d9decbc077fcf8f
Author: Antony Riakiotakis
Date:   Thu Jan 29 17:45:36 2015 +0100
Branches: master
https://developer.blender.org/rBa0e8b98b6102ac19f0724b390d9decbc077fcf8f

Fix T43207 fill brush fails in perspective mode

Divide only the length of the edge by the homogenous coordinate, not the
final coordinate. Also fix the swapping (though it's still a bit
doubtfull if it's really needed)

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

M	source/blender/editors/sculpt_paint/paint_image_proj.c

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

diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c
index 34a1096..cbfa53d 100644
--- a/source/blender/editors/sculpt_paint/paint_image_proj.c
+++ b/source/blender/editors/sculpt_paint/paint_image_proj.c
@@ -1989,8 +1989,8 @@ static void line_rect_clip(
 	
 	tmp = (is_ortho) ? 1.0f : (l1[3] + min * (l2[3] - l1[3]));
 	
-	uv[0] = (uv1[0] + min * (uv2[0] - uv1[0])) / tmp;
-	uv[1] = (uv1[1] + min * (uv2[1] - uv1[1])) / tmp;
+	uv[0] = (uv1[0] + min / tmp * (uv2[0] - uv1[0]));
+	uv[1] = (uv1[1] + min / tmp * (uv2[1] - uv1[1]));
 }
 
 
@@ -2076,8 +2076,8 @@ static void project_bucket_clip_face(
 		/* at this point we have all uv points needed in a row. all that's needed is to invert them if necessary */
 		if (flip) {
 			/* flip only to the middle of the array */
-			int i, max = *tot / 2;
-			for (i = 0; i < max; i++) {
+			int i, max = *tot - 1, mid = *tot / 2;
+			for (i = 0; i < mid; i++) {
 				SWAP(float, bucket_bounds_uv[i][0], bucket_bounds_uv[max - i][0]);
 				SWAP(float, bucket_bounds_uv[i][1], bucket_bounds_uv[max - i][1]);
 			}




More information about the Bf-blender-cvs mailing list