Revision: 22600
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=22600
Author:   kakbarnf
Date:     2009-08-18 16:31:13 +0200 (Tue, 18 Aug 2009)

Log Message:
-----------
Fixed some redraw problems with texture nodes.

Modified Paths:
--------------
    branches/blender2.5/blender/source/blender/blenkernel/intern/node.c
    branches/blender2.5/blender/source/blender/editors/space_node/node_draw.c
    branches/blender2.5/blender/source/blender/editors/space_node/node_edit.c
    branches/blender2.5/blender/source/blender/editors/space_node/space_node.c
    
branches/blender2.5/blender/source/blender/nodes/intern/TEX_nodes/TEX_output.c
    branches/blender2.5/blender/source/blender/nodes/intern/TEX_util.c

Modified: branches/blender2.5/blender/source/blender/blenkernel/intern/node.c
===================================================================
--- branches/blender2.5/blender/source/blender/blenkernel/intern/node.c 
2009-08-18 12:58:51 UTC (rev 22599)
+++ branches/blender2.5/blender/source/blender/blenkernel/intern/node.c 
2009-08-18 14:31:13 UTC (rev 22600)
@@ -950,9 +950,6 @@
        if(ntype->initfunc!=NULL)
                ntype->initfunc(node);
        
-       if(type==TEX_NODE_OUTPUT)
-               ntreeTexAssignIndex(ntree, node);
-
        nodeAddSockets(node, ntype);
        
        return node;
@@ -1021,9 +1018,6 @@
        nnode->new_node= NULL;
        nnode->preview= NULL;
        
-       if(node->type==TEX_NODE_OUTPUT)
-               ntreeTexAssignIndex(ntree, node);
-
        return nnode;
 }
 

Modified: 
branches/blender2.5/blender/source/blender/editors/space_node/node_draw.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/space_node/node_draw.c   
2009-08-18 12:58:51 UTC (rev 22599)
+++ branches/blender2.5/blender/source/blender/editors/space_node/node_draw.c   
2009-08-18 14:31:13 UTC (rev 22600)
@@ -607,9 +607,9 @@
                        }
                        WM_event_add_notifier(C, NC_SCENE|ND_NODES, 
CTX_data_scene(C));
                }                       
-               
-       //      else if(snode->treetype==NTREE_TEXTURE)
-       //              texture_node_event(snode, val);
+               else if(snode->treetype==NTREE_TEXTURE) {
+                       WM_event_add_notifier(C, NC_TEXTURE|ND_NODES, 
snode->id);
+               }
        }
        
 }

Modified: 
branches/blender2.5/blender/source/blender/editors/space_node/node_edit.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/space_node/node_edit.c   
2009-08-18 12:58:51 UTC (rev 22599)
+++ branches/blender2.5/blender/source/blender/editors/space_node/node_edit.c   
2009-08-18 14:31:13 UTC (rev 22600)
@@ -213,10 +213,8 @@
                WM_event_add_notifier(C, NC_MATERIAL|ND_NODES, snode->id);
        else if(snode->treetype==NTREE_COMPOSIT)
                WM_event_add_notifier(C, NC_SCENE|ND_NODES, snode->id);
-       else if(snode->treetype==NTREE_TEXTURE) {
-               // ntreeTexUpdatePreviews(snode->nodetree); /* XXX texture 
nodes should follow shader node methods (ton) */
-               // XXX BIF_preview_changed(ID_TE);
-       }
+       else if(snode->treetype==NTREE_TEXTURE)
+               WM_event_add_notifier(C, NC_TEXTURE|ND_NODES, snode->id);
 }
 
 #if 0

Modified: 
branches/blender2.5/blender/source/blender/editors/space_node/space_node.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/space_node/space_node.c  
2009-08-18 12:58:51 UTC (rev 22599)
+++ branches/blender2.5/blender/source/blender/editors/space_node/space_node.c  
2009-08-18 14:31:13 UTC (rev 22600)
@@ -152,12 +152,16 @@
                        if(wmn->data==ND_FILEREAD)
                                ED_area_tag_refresh(sa);
                        break;
-                               
+                       
+               /* future: add ID checks? */
                case NC_MATERIAL:
-                       /* future: add ID check? */
                        if(wmn->data==ND_SHADING)
                                ED_area_tag_refresh(sa);
                        break;
+               case NC_TEXTURE:
+                       if(wmn->data==ND_NODES)
+                               ED_area_tag_refresh(sa);
+                       break;
        }
 }
 
@@ -280,6 +284,9 @@
                case NC_MATERIAL:
                        ED_region_tag_redraw(ar);
                        break;
+               case NC_TEXTURE:
+                       ED_region_tag_redraw(ar);
+                       break;
        }
 }
 

Modified: 
branches/blender2.5/blender/source/blender/nodes/intern/TEX_nodes/TEX_output.c
===================================================================
--- 
branches/blender2.5/blender/source/blender/nodes/intern/TEX_nodes/TEX_output.c  
    2009-08-18 12:58:51 UTC (rev 22599)
+++ 
branches/blender2.5/blender/source/blender/nodes/intern/TEX_nodes/TEX_output.c  
    2009-08-18 14:31:13 UTC (rev 22600)
@@ -152,6 +152,26 @@
        }
 }
 
+static void assign_index(struct bNode *node)
+{
+       bNode *tnode;
+       int index = 1;
+       
+       tnode = node;
+       while(tnode->prev)
+               tnode = tnode->prev;
+       
+       check_index:
+       for(; tnode; tnode= tnode->next)
+               if(tnode->type == TEX_NODE_OUTPUT && tnode != node)
+                       if(tnode->custom1 == index) {
+                               index ++;
+                               goto check_index;
+                       }
+                       
+       node->custom1 = index;
+}
+
 static void init(bNode *node)
 {
        TexNodeOutput *tno = MEM_callocN(sizeof(TexNodeOutput), "TEX_output");
@@ -159,17 +179,16 @@
        
        strcpy(tno->name, "Default");
        unique_name(node);
-       ntreeTexAssignIndex(0, node);
+       assign_index(node);
 }
 
 static void copy(bNode *orig, bNode *new)
 {
        node_copy_standard_storage(orig, new);
        unique_name(new);
-       ntreeTexAssignIndex(0, new);
+       assign_index(new);
 }
 
-
 bNodeType tex_node_output= {
        /* *next,*prev     */  NULL, NULL,
        /* type code       */  TEX_NODE_OUTPUT,

Modified: branches/blender2.5/blender/source/blender/nodes/intern/TEX_util.c
===================================================================
--- branches/blender2.5/blender/source/blender/nodes/intern/TEX_util.c  
2009-08-18 12:58:51 UTC (rev 22599)
+++ branches/blender2.5/blender/source/blender/nodes/intern/TEX_util.c  
2009-08-18 14:31:13 UTC (rev 22600)
@@ -297,26 +297,3 @@
        return str;
 }
 
-void ntreeTexAssignIndex(struct bNodeTree *ntree, struct bNode *node)
-{
-       bNode *tnode;
-       int index = 1;
-       
-       if(ntree) 
-               tnode = ntree->nodes.first;
-       else {
-               tnode = node;
-               while(tnode->prev) tnode = tnode->prev;
-       }
-       
-       check_index:
-       for(; tnode; tnode= tnode->next)
-               if(tnode->type == TEX_NODE_OUTPUT && tnode != node)
-                       if(tnode->custom1 == index) {
-                               index ++;
-                               goto check_index;
-                       }
-                       
-       node->custom1 = index;
-}
-


_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to