From 78ae587649bb7b3350586e7f2ed68ea67b75d1f0 Mon Sep 17 00:00:00 2001 From: Hans Goudey Date: Mon, 6 Dec 2021 17:12:46 -0500 Subject: Cleanup: Use C++ types for multi input socket sorting The algorithm used is still quite inefficient, but at least the code is easier to read and a little bit simpler now. --- source/blender/editors/space_node/drawnode.cc | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'source/blender/editors/space_node/drawnode.cc') diff --git a/source/blender/editors/space_node/drawnode.cc b/source/blender/editors/space_node/drawnode.cc index 8bce1248e8e..b3c88dafe91 100644 --- a/source/blender/editors/space_node/drawnode.cc +++ b/source/blender/editors/space_node/drawnode.cc @@ -3529,11 +3529,11 @@ bool node_link_bezier_handles(const View2D *v2d, vec[0][0] = link.fromsock->locx; vec[0][1] = link.fromsock->locy; if (link.fromsock->flag & SOCK_MULTI_INPUT) { - node_link_calculate_multi_input_position(link.fromsock->locx, - link.fromsock->locy, - link.fromsock->total_inputs - 1, - link.fromsock->total_inputs, - vec[0]); + const float2 position = node_link_calculate_multi_input_position( + {link.fromsock->locx, link.fromsock->locy}, + link.fromsock->total_inputs - 1, + link.fromsock->total_inputs); + copy_v2_v2(vec[0], position); } fromreroute = (link.fromnode && link.fromnode->type == NODE_REROUTE); } @@ -3548,11 +3548,11 @@ bool node_link_bezier_handles(const View2D *v2d, vec[3][0] = link.tosock->locx; vec[3][1] = link.tosock->locy; if (!(link.tonode->flag & NODE_HIDDEN) && link.tosock->flag & SOCK_MULTI_INPUT) { - node_link_calculate_multi_input_position(link.tosock->locx, - link.tosock->locy, - link.multi_input_socket_index, - link.tosock->total_inputs, - vec[3]); + const float2 position = node_link_calculate_multi_input_position( + {link.tosock->locx, link.tosock->locy}, + link.multi_input_socket_index, + link.tosock->total_inputs); + copy_v2_v2(vec[3], position); } toreroute = (link.tonode && link.tonode->type == NODE_REROUTE); } -- cgit v1.2.3