Fix T85149: Wrong reroute position when adding with quick gesture

In the operation of adding reroute node to the intersection with the
gesture segment, each rerount was added to the middle of two points that
are part of the segment.

Now add the reroute point to the intersection position.

Maniphest Tasks: T85149

Differential Revision: https://developer.blender.org/D10247
This commit is contained in:
Germano Cavalcante
2021-01-28 09:48:53 -03:00
parent d0f59d3842
commit 036b65d778

View File

@@ -104,9 +104,8 @@ static bool add_reroute_intersect_check(bNodeLink *link,
if (node_link_bezier_points(NULL, NULL, link, coord_array, NODE_LINK_RESOL)) {
for (int i = 0; i < tot - 1; i++) {
for (int b = 0; b < NODE_LINK_RESOL; b++) {
if (isect_seg_seg_v2(mcoords[i], mcoords[i + 1], coord_array[b], coord_array[b + 1]) > 0) {
result[0] = (mcoords[i][0] + mcoords[i + 1][0]) / 2.0f;
result[1] = (mcoords[i][1] + mcoords[i + 1][1]) / 2.0f;
if (isect_seg_seg_v2_point(
mcoords[i], mcoords[i + 1], coord_array[b], coord_array[b + 1], result) > 0) {
return true;
}
}