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:
authorFabian Schempp <fabianschempp@googlemail.com>2021-03-10 16:57:57 +0300
committerFabian Schempp <fabianschempp@googlemail.com>2021-03-10 16:57:57 +0300
commit576c392241bde1d6497b00490e97e104ac887132 (patch)
tree97a7455970cb104b5571ed37386ca3fa22dad0ad /source/blender/editors/space_node/node_edit.c
parent5991c5c9289792e8f9d14375b254ba81306680ac (diff)
Nodes: Sortable Multi Input Sockets
This Patch removes the auto sorting from Multi-Input Sockets and allows the links to be sorted by drag and drop instead. As a minor related change, it fixes the drawing of the mute line to connect to the first input instead of the socket's center.
Diffstat (limited to 'source/blender/editors/space_node/node_edit.c')
-rw-r--r--source/blender/editors/space_node/node_edit.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c
index 5205e50b0bf..afdc9efb78b 100644
--- a/source/blender/editors/space_node/node_edit.c
+++ b/source/blender/editors/space_node/node_edit.c
@@ -107,14 +107,15 @@ float node_socket_calculate_height(const bNodeSocket *socket)
return sock_height;
}
-void node_link_calculate_multi_input_position(const bNodeLink *link, float r[2])
-{
- float offset = (link->tosock->total_inputs * NODE_MULTI_INPUT_LINK_GAP -
- NODE_MULTI_INPUT_LINK_GAP) *
- 0.5;
- r[0] = link->tosock->locx - NODE_SOCKSIZE * 0.5f;
- r[1] = link->tosock->locy - offset +
- (link->multi_input_socket_index * NODE_MULTI_INPUT_LINK_GAP);
+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);
}
static void compo_tag_output_nodes(bNodeTree *nodetree, int recalc_flags)