[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [61178] trunk/blender/source/blender/ editors/space_node/node_relationships.c: Removed the automatic " link swapping" feature from the node link operator: When a link was being dragged to an already connected input, the existing links were shifted to the next free socket.
Lukas Toenne
lukas.toenne at googlemail.com
Wed Nov 6 22:21:37 CET 2013
Revision: 61178
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=61178
Author: lukastoenne
Date: 2013-11-06 21:21:37 +0000 (Wed, 06 Nov 2013)
Log Message:
-----------
Removed the automatic "link swapping" feature from the node link operator: When a link was being dragged to an already connected input, the existing links were shifted to the next free socket. This was
originally intended as a way to speed up workflow for math and mix nodes, but more often than not it just gets in the way. Most binary (or n-ary) functions are not even commutative, i.e. changing the
order of sockets does not usually produce the correct result. Also this includes the more common case where one actually wants to replace a socket, which then requires a second click to remove the
shifted connection. All in all this is not a helpful feature.
Modified Paths:
--------------
trunk/blender/source/blender/editors/space_node/node_relationships.c
Modified: trunk/blender/source/blender/editors/space_node/node_relationships.c
===================================================================
--- trunk/blender/source/blender/editors/space_node/node_relationships.c 2013-11-06 21:08:16 UTC (rev 61177)
+++ trunk/blender/source/blender/editors/space_node/node_relationships.c 2013-11-06 21:21:37 UTC (rev 61178)
@@ -395,38 +395,28 @@
/* *************************** add link op ******************** */
-static void node_remove_extra_links(SpaceNode *snode, bNodeSocket *tsock, bNodeLink *link)
+static void node_remove_extra_links(SpaceNode *snode, bNodeLink *link)
{
+ bNodeTree *ntree = snode->edittree;
+ bNodeSocket *from = link->fromsock, *to = link->tosock;
+ int max_from = from->limit, max_to = to->limit;
+ int count_from = 1, count_to = 1; /* start at 1, link is included */
bNodeLink *tlink;
- bNodeSocket *sock;
-
- if (tsock && nodeCountSocketLinks(snode->edittree, link->tosock) > tsock->limit) {
-
- for (tlink = snode->edittree->links.first; tlink; tlink = tlink->next) {
- if (link != tlink && tlink->tosock == link->tosock)
- break;
+
+ for (tlink = ntree->links.first; tlink; tlink = tlink->next) {
+ if (tlink == link)
+ continue;
+
+ if (tlink->fromsock == from) {
+ ++count_from;
+ if (count_from > max_from)
+ nodeRemLink(ntree, tlink);
}
- if (tlink) {
- /* try to move the existing link to the next available socket */
- if (tlink->tonode) {
- /* is there a free input socket with the target type? */
- for (sock = tlink->tonode->inputs.first; sock; sock = sock->next) {
- if (sock->type == tlink->tosock->type)
- if (nodeCountSocketLinks(snode->edittree, sock) < sock->limit)
- break;
- }
- if (sock) {
- tlink->tosock = sock;
- sock->flag &= ~SOCK_HIDDEN;
- }
- else {
- nodeRemLink(snode->edittree, tlink);
- }
- }
- else
- nodeRemLink(snode->edittree, tlink);
-
- snode->edittree->update |= NTREE_UPDATE_LINKS;
+
+ if (tlink->tosock == to) {
+ ++count_to;
+ if (count_to > max_to)
+ nodeRemLink(ntree, tlink);
}
}
}
@@ -527,8 +517,7 @@
link->tonode->update |= NODE_UPDATE;
/* we might need to remove a link */
- if (in_out == SOCK_OUT)
- node_remove_extra_links(snode, link->tosock, link);
+ node_remove_extra_links(snode, link);
}
else
nodeRemLink(ntree, link);
@@ -1325,7 +1314,7 @@
link->tonode = select;
link->tosock = best_input;
- node_remove_extra_links(snode, link->tosock, link);
+ node_remove_extra_links(snode, link);
link->flag &= ~NODE_LINKFLAG_HILITE;
nodeAddLink(snode->edittree, select, best_output, node, sockto);
More information about the Bf-blender-cvs
mailing list