Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2016-04-25 15:15:50 +0300
committerCampbell Barton <ideasman42@gmail.com>2016-04-25 15:21:30 +0300
commit3ac2028df0c4e6e30135b79537e3f0af8e59382f (patch)
treebca6806f959aabf6caf1fd00564268acf34b25a4
parent42fd1b9abe90c301632c9279fd29ec6650243430 (diff)
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.
-rw-r--r--source/blender/editors/sculpt_paint/paint_image_proj.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c
index b8693639673..f614025fa0e 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);