Corrected updating inside edited groups, fix for #27018. This was caused by edit...
authorLukas Toenne <lukas.toenne@googlemail.com>
Tue, 19 Apr 2011 15:15:50 +0000 (15:15 +0000)
committerLukas Toenne <lukas.toenne@googlemail.com>
Tue, 19 Apr 2011 15:15:50 +0000 (15:15 +0000)
source/blender/blenkernel/intern/node.c
source/blender/editors/space_node/node_edit.c

index dc1f80ce1d4744b10894478cf2c53fa42fd3dd1d..272df18c73d206dc61983cfa13d9689a3f92ed28 100644 (file)
@@ -56,7 +56,6 @@
 #include "BKE_fcurve.h"
 #include "BKE_node.h"
 #include "BKE_utildefines.h"
-#include "BKE_node.h"
 
 #include "PIL_time.h"
 
index 3877e7abf5e3042c1eb59774617c30b1b825c006..4b1930114678aa4fdc34d78a2e68739fc3a4a51e 100644 (file)
@@ -460,6 +460,19 @@ void snode_set_context(SpaceNode *snode, Scene *scene)
                node_tree_from_ID(snode->id, &snode->nodetree, &snode->edittree, NULL);
 }
 
+static void snode_tag_changed(SpaceNode *snode, bNode *node)
+{
+       bNode *gnode;
+       
+       if (node)
+               NodeTagChanged(snode->edittree, node);
+       
+       /* if inside group, tag entire group */
+       gnode= node_tree_get_editgroup(snode->nodetree);
+       if(gnode)
+               NodeTagIDChanged(snode->nodetree, gnode->id);
+}
+
 void node_set_active(SpaceNode *snode, bNode *node)
 {
        nodeSetActive(snode->edittree, node);
@@ -508,14 +521,7 @@ void node_set_active(SpaceNode *snode, bNode *node)
                                
                                node->flag |= NODE_DO_OUTPUT;
                                if(was_output==0) {
-                                       bNode *gnode;
-                                       
-                                       NodeTagChanged(snode->edittree, node);
-                                       
-                                       /* if inside group, tag entire group */
-                                       gnode= node_tree_get_editgroup(snode->nodetree);
-                                       if(gnode)
-                                               NodeTagIDChanged(snode->nodetree, gnode->id);
+                                       snode_tag_changed(snode, node);
                                        
                                        ED_node_changed_update(snode->id, node);
                                }
@@ -1553,7 +1559,7 @@ static void node_link_viewer(SpaceNode *snode, bNode *tonode)
                                link->fromsock= sock;
                        }
                        ntreeSolveOrder(snode->edittree);
-                       NodeTagChanged(snode->edittree, node);
+                       snode_tag_changed(snode, node);
                }
        }
 }
@@ -1896,7 +1902,7 @@ void snode_autoconnect(SpaceNode *snode, int allow_multiple, int replace)
                        if (replace)
                                nodeRemSocketLinks(snode->edittree, sock_to);
                        nodeAddLink(snode->edittree, node_fr, sock_fr, node_to, sock_to);
-                       NodeTagChanged(snode->edittree, node_to);
+                       snode_tag_changed(snode, node_to);
                        ++numlinks;
                        break;
                }
@@ -1960,7 +1966,7 @@ bNode *node_add_node(SpaceNode *snode, Scene *scene, int type, float locx, float
                if(node->id)
                        id_us_plus(node->id);
                        
-               NodeTagChanged(snode->edittree, node);
+               snode_tag_changed(snode, node);
        }
        
        if(snode->nodetree->type==NTREE_TEXTURE) {
@@ -2135,8 +2141,7 @@ static int node_link_modal(bContext *C, wmOperator *op, wmEvent *event)
                case MIDDLEMOUSE:
                        if(link->tosock && link->fromsock) {
                                /* send changed events for original tonode and new */
-                               if(link->tonode)
-                                       NodeTagChanged(snode->edittree, link->tonode);
+                               snode_tag_changed(snode, link->tonode);
                                
                                /* we might need to remove a link */
                                if(in_out==SOCK_OUT)
@@ -2209,7 +2214,7 @@ static int node_link_init(SpaceNode *snode, bNodeLinkDrag *nldrag)
                        if(link) {
                                /* send changed event to original tonode */
                                if(link->tonode) 
-                                       NodeTagChanged(snode->edittree, link->tonode);
+                                       snode_tag_changed(snode, link->tonode);
                                
                                nldrag->node= link->fromnode;
                                nldrag->sock= link->fromsock;
@@ -2363,7 +2368,7 @@ static int cut_links_exec(bContext *C, wmOperator *op)
                        next= link->next;
                        
                        if(cut_links_intersect(link, mcoords, i)) {
-                               NodeTagChanged(snode->edittree, link->tonode);
+                               snode_tag_changed(snode, link->tonode);
                                nodeRemLink(snode->edittree, link);
                        }
                }
@@ -2746,7 +2751,7 @@ static int node_mute_exec(bContext *C, wmOperator *UNUSED(op))
                if(node->flag & SELECT) {
                        if(node->inputs.first && node->outputs.first) {
                                node->flag ^= NODE_MUTED;
-                               NodeTagChanged(snode->edittree, node);
+                               snode_tag_changed(snode, node);
                        }
                }
        }