forked from bartvdbraak/blender
Mask: Fix possible nan values in the weight interpolation
Noticed while looking into animation data being created as per steps to reproduce bug in T76872.
This commit is contained in:
parent
10e05bb413
commit
51f8dbe081
@ -1893,10 +1893,17 @@ static void interp_weights_uv_v2_calc(float r_uv[2],
|
||||
const float pt_a[2],
|
||||
const float pt_b[2])
|
||||
{
|
||||
const float segment_len = len_v2v2(pt_a, pt_b);
|
||||
if (segment_len == 0.0f) {
|
||||
r_uv[0] = 1.0f;
|
||||
r_uv[1] = 0.0f;
|
||||
return;
|
||||
}
|
||||
|
||||
float pt_on_line[2];
|
||||
r_uv[0] = closest_to_line_v2(pt_on_line, pt, pt_a, pt_b);
|
||||
|
||||
r_uv[1] = (len_v2v2(pt_on_line, pt) / len_v2v2(pt_a, pt_b)) *
|
||||
r_uv[1] = (len_v2v2(pt_on_line, pt) / segment_len) *
|
||||
/* This line only sets the sign. */
|
||||
((line_point_side_v2(pt_a, pt_b, pt) < 0.0f) ? -1.0f : 1.0f);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user