From 1140e001a07b7912debbd3166d61f77499b60158 Mon Sep 17 00:00:00 2001 From: Jacques Lucke Date: Mon, 7 Nov 2022 16:12:07 +0100 Subject: Fix T102329: assert when cutting node tree link --- source/blender/editors/space_node/drawnode.cc | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/source/blender/editors/space_node/drawnode.cc b/source/blender/editors/space_node/drawnode.cc index df31a0342cb..c66b8ad4ff0 100644 --- a/source/blender/editors/space_node/drawnode.cc +++ b/source/blender/editors/space_node/drawnode.cc @@ -1581,10 +1581,12 @@ void draw_nodespace_back_pix(const bContext &C, GPU_matrix_pop(); } -static float2 socket_link_connection_location(const bNodeSocket &socket, const bNodeLink &link) +static float2 socket_link_connection_location(const bNode &node, + const bNodeSocket &socket, + const bNodeLink &link) { const float2 socket_location(socket.locx, socket.locy); - if (socket.is_multi_input() && socket.is_input() && !(socket.owner_node().flag & NODE_HIDDEN)) { + if (socket.is_multi_input() && socket.is_input() && !(node.flag & NODE_HIDDEN)) { return node_link_calculate_multi_input_position( socket_location, link.multi_input_socket_index, socket.total_inputs); } @@ -1620,8 +1622,8 @@ static void calculate_inner_link_bezier_points(std::array &points) static std::array node_link_bezier_points(const bNodeLink &link) { std::array points; - points[0] = socket_link_connection_location(*link.fromsock, link); - points[3] = socket_link_connection_location(*link.tosock, link); + points[0] = socket_link_connection_location(*link.fromnode, *link.fromsock, link); + points[3] = socket_link_connection_location(*link.tonode, *link.tosock, link); calculate_inner_link_bezier_points(points); return points; } @@ -2212,8 +2214,11 @@ static std::array node_link_bezier_points_dragged(const SpaceNode &sn { const float2 cursor = snode.runtime->cursor * UI_DPI_FAC; std::array points; - points[0] = link.fromsock ? socket_link_connection_location(*link.fromsock, link) : cursor; - points[3] = link.tosock ? socket_link_connection_location(*link.tosock, link) : cursor; + points[0] = link.fromsock ? + socket_link_connection_location(*link.fromnode, *link.fromsock, link) : + cursor; + points[3] = link.tosock ? socket_link_connection_location(*link.tonode, *link.tosock, link) : + cursor; calculate_inner_link_bezier_points(points); return points; } -- cgit v1.2.3