Revision: 29243
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=29243
Author:   blendix
Date:     2010-06-05 17:59:48 +0200 (Sat, 05 Jun 2010)

Log Message:
-----------
Node Editor: link to viewer (ctrl+shift click on node) now cycles through
the node outputs instead of always linking the first one to the viewer.

Modified Paths:
--------------
    trunk/blender/source/blender/editors/space_node/node_edit.c

Modified: trunk/blender/source/blender/editors/space_node/node_edit.c
===================================================================
--- trunk/blender/source/blender/editors/space_node/node_edit.c 2010-06-05 
15:49:04 UTC (rev 29242)
+++ trunk/blender/source/blender/editors/space_node/node_edit.c 2010-06-05 
15:59:48 UTC (rev 29243)
@@ -1046,19 +1046,37 @@
        }
                
        if(node) {
-               bNodeSocket *sock;
+               bNodeLink *link;
+               bNodeSocket *sock= NULL;
+
+               /* try to find an already connected socket to cycle to the next 
*/
+               for(link= snode->edittree->links.first; link; link= link->next)
+                       if(link->tonode==node && link->fromnode==tonode)
+                               if(link->tosock==node->inputs.first)
+                                       break;
+
+               if(link) {
+                       /* unlink existing connection */
+                       sock= link->fromsock;
+                       nodeRemLink(snode->edittree, link);
+
+                       /* find a socket after the previously connected socket 
*/
+                       for(sock=sock->next; sock; sock= sock->next)
+                               if(!(sock->flag & (SOCK_HIDDEN|SOCK_UNAVAIL)))
+                                       break;
+               }
+
+               /* find a socket starting from the first socket */
+               if(!sock) {
+                       for(sock= tonode->outputs.first; sock; sock= sock->next)
+                               if(!(sock->flag & (SOCK_HIDDEN|SOCK_UNAVAIL)))
+                                       break;
+               }
                
-               /* get a good socket to view from */
-               for(sock= tonode->outputs.first; sock; sock= sock->next)
-                       if(!(sock->flag & (SOCK_HIDDEN|SOCK_UNAVAIL)))
-                               break;
-               
                if(sock) {
-                       bNodeLink *link;
-                       
                        /* get link to viewer */
                        for(link= snode->edittree->links.first; link; link= 
link->next)
-                               if(link->tonode==node)
+                               if(link->tonode==node && 
link->tosock==node->inputs.first)
                                        break;
                        
                        if(link==NULL) {


_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to