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:
authorHans Goudey <h.goudey@me.com>2021-12-07 01:12:46 +0300
committerHans Goudey <h.goudey@me.com>2021-12-07 01:12:46 +0300
commit78ae587649bb7b3350586e7f2ed68ea67b75d1f0 (patch)
tree45961ec5bb646e47cf2b723e3a1f61afbf402bcd /source/blender/editors/space_node/node_edit.cc
parentaa23e870ecc9a2542513a016da98cab7e6d7706c (diff)
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.
Diffstat (limited to 'source/blender/editors/space_node/node_edit.cc')
-rw-r--r--source/blender/editors/space_node/node_edit.cc17
1 files changed, 8 insertions, 9 deletions
diff --git a/source/blender/editors/space_node/node_edit.cc b/source/blender/editors/space_node/node_edit.cc
index 5a598a1bd04..3bce32e7af4 100644
--- a/source/blender/editors/space_node/node_edit.cc
+++ b/source/blender/editors/space_node/node_edit.cc
@@ -111,15 +111,14 @@ float node_socket_calculate_height(const bNodeSocket &socket)
return sock_height;
}
-void node_link_calculate_multi_input_position(const float socket_x,
- const float socket_y,
- const int index,
- const int total_inputs,
- float r[2])
-{
- float offset = (total_inputs * NODE_MULTI_INPUT_LINK_GAP - NODE_MULTI_INPUT_LINK_GAP) * 0.5;
- r[0] = socket_x - NODE_SOCKSIZE * 0.5f;
- r[1] = socket_y - offset + (index * NODE_MULTI_INPUT_LINK_GAP);
+float2 node_link_calculate_multi_input_position(const float2 &socket_position,
+ const int index,
+ const int total_inputs)
+{
+ const float offset = (total_inputs * NODE_MULTI_INPUT_LINK_GAP - NODE_MULTI_INPUT_LINK_GAP) *
+ 0.5f;
+ return {socket_position.x - NODE_SOCKSIZE * 0.5f,
+ socket_position.y - offset + index * NODE_MULTI_INPUT_LINK_GAP};
}
static void compo_tag_output_nodes(bNodeTree *nodetree, int recalc_flags)