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_draw.cc
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_draw.cc')
-rw-r--r--source/blender/editors/space_node/node_draw.cc57
1 files changed, 0 insertions, 57 deletions
diff --git a/source/blender/editors/space_node/node_draw.cc b/source/blender/editors/space_node/node_draw.cc
index 5a0cacf070b..bb0cd754c7b 100644
--- a/source/blender/editors/space_node/node_draw.cc
+++ b/source/blender/editors/space_node/node_draw.cc
@@ -1780,25 +1780,6 @@ void node_update_nodetree(const bContext *C, bNodeTree *ntree)
}
}
-static bool compare_link_by_angle_to_node(const bNodeLink *link_a, const bNodeLink *link_b)
-{
- BLI_assert(link_a->tosock == link_b->tosock);
- const float socket_location[2] = {link_a->tosock->locx, link_a->tosock->locy};
- const float up_direction[2] = {0.0f, 1.0f};
-
- float delta_a[2] = {link_a->fromsock->locx - socket_location[0],
- link_a->fromsock->locy - socket_location[1]};
- normalize_v2(delta_a);
- const float angle_a = angle_normalized_v2v2(up_direction, delta_a);
-
- float delta_b[2] = {link_b->fromsock->locx - socket_location[0],
- link_b->fromsock->locy - socket_location[1]};
- normalize_v2(delta_b);
- const float angle_b = angle_normalized_v2v2(up_direction, delta_b);
-
- return angle_a > angle_b;
-}
-
static void node_draw(const bContext *C,
ARegion *region,
SpaceNode *snode,
@@ -1813,42 +1794,6 @@ static void node_draw(const bContext *C,
#define USE_DRAW_TOT_UPDATE
-/**
- * Automatically sort the input links to multi-input sockets to avoid crossing noodles.
- */
-static void sort_multi_input_socket_links(bNodeTree *ntree, SpaceNode *snode)
-{
- LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
- LISTBASE_FOREACH (bNodeSocket *, socket, &node->inputs) {
- if (socket->flag & SOCK_MULTI_INPUT) {
- /* The total is calculated in #node_update_nodetree, which runs before this draw step. */
- const int total_inputs = socket->total_inputs;
- Vector<bNodeLink *> input_links;
- input_links.reserve(total_inputs);
-
- LISTBASE_FOREACH (bNodeLink *, link, &ntree->links) {
- if (link->tosock == socket) {
- input_links.append(link);
- }
- }
- LISTBASE_FOREACH (bNodeLinkDrag *, nldrag, &snode->runtime->linkdrag) {
- LISTBASE_FOREACH (LinkData *, linkdata, &nldrag->links) {
- bNodeLink *link = (bNodeLink *)linkdata->data;
- if (link->tosock == socket) {
- input_links.append(link);
- }
- }
- }
-
- std::sort(input_links.begin(), input_links.end(), compare_link_by_angle_to_node);
- for (const int i : input_links.index_range()) {
- input_links[i]->multi_input_socket_index = i;
- }
- }
- }
- }
-}
-
void node_draw_nodetree(const bContext *C,
ARegion *region,
SpaceNode *snode,
@@ -1885,8 +1830,6 @@ void node_draw_nodetree(const bContext *C,
GPU_blend(GPU_BLEND_ALPHA);
nodelink_batch_start(snode);
- sort_multi_input_socket_links(ntree, snode);
-
LISTBASE_FOREACH (bNodeLink *, link, &ntree->links) {
if (!nodeLinkIsHidden(link)) {
node_draw_link(&region->v2d, snode, link);