[Bf-blender-cvs] [3ac2028] master: Fix T48202: Project paint hangs on UV's w/ sharp corners

Campbell Barton noreply at git.blender.org
Mon Apr 25 14:18:48 CEST 2016


Commit: 3ac2028df0c4e6e30135b79537e3f0af8e59382f
Author: Campbell Barton
Date:   Mon Apr 25 22:15:50 2016 +1000
Branches: master
https://developer.blender.org/rB3ac2028df0c4e6e30135b79537e3f0af8e59382f

Fix T48202: Project paint hangs on UV's w/ sharp corners

Using 'shell-thickness' to offset UV's meant very sharp corners would offset far outside the image
causing project-paint to hang while collecting all pixels for each UV face.

Clamp the maximum offset to prevent this.

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

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 b869363..f614025 100644
--- a/source/blender/editors/sculpt_paint/paint_image_proj.c
+++ b/source/blender/editors/sculpt_paint/paint_image_proj.c
@@ -1100,6 +1100,10 @@ static void uv_image_outset(
         float (*orig_uv)[2], float (*outset_uv)[2], const float scaler,
         const int ibuf_x, const int ibuf_y, const bool cw)
 {
+	/* disallow shell-thickness to outset extreme values,
+	 * otherwise near zero area UV's may extend thousands of pixels. */
+	const float scale_clamp = 5.0f;
+
 	float a1, a2, a3;
 	float puv[3][2]; /* pixelspace uv's */
 	float no1[2], no2[2], no3[2]; /* normals */
@@ -1150,6 +1154,10 @@ static void uv_image_outset(
 	a2 = shell_v2v2_normal_dir_to_dist(no2, dir1);
 	a3 = shell_v2v2_normal_dir_to_dist(no3, dir2);
 
+	CLAMP_MAX(a1, scale_clamp);
+	CLAMP_MAX(a2, scale_clamp);
+	CLAMP_MAX(a3, scale_clamp);
+
 	mul_v2_fl(no1, a1 * scaler);
 	mul_v2_fl(no2, a2 * scaler);
 	mul_v2_fl(no3, a3 * scaler);




More information about the Bf-blender-cvs mailing list