Texture node previews: Well and truly fixed.
authorRobin Allen <roblovski@gmail.com>
Wed, 19 Aug 2009 00:46:06 +0000 (00:46 +0000)
committerRobin Allen <roblovski@gmail.com>
Wed, 19 Aug 2009 00:46:06 +0000 (00:46 +0000)
(Probably.)

source/blender/editors/space_node/node_draw.c
source/blender/editors/space_node/space_node.c
source/blender/nodes/intern/TEX_util.c

index 93e7505693fd814228823581db2591ab014bf4d3..f3df7a29c2e059663534212cf0007d22cf6160c1 100644 (file)
@@ -609,7 +609,6 @@ static void do_node_internal_buttons(bContext *C, void *node_v, int event)
                }                       
                else if(snode->treetype==NTREE_TEXTURE) {
                        WM_event_add_notifier(C, NC_TEXTURE|ND_NODES, snode->id);
-                       ntreeTexUpdatePreviews(snode->nodetree);
                }
        }
        
index 07277fe878d4e62919ec8308429abecc13077b2f..2087356686729335ef0745bb1f88d4800ed39975 100644 (file)
@@ -46,6 +46,7 @@
 #include "BKE_colortools.h"
 #include "BKE_context.h"
 #include "BKE_screen.h"
+#include "BKE_node.h"
 
 #include "ED_previewrender.h"
 #include "ED_space_api.h"
@@ -181,6 +182,11 @@ static void node_area_refresh(const struct bContext *C, struct ScrArea *sa)
                        if(scene->use_nodes)
                                snode_composite_job(C, sa);
                }
+               else if(snode->treetype==NTREE_TEXTURE) {
+                       Tex *tex= (Tex *)snode->id;
+                       if(tex->use_nodes)
+                               ntreeTexUpdatePreviews(tex->nodetree);
+               }
        }
 }
 
index 0bb9d887ae3399d6470cd11401bcca86682390b1..a6a5877722b4bab6bbdfdd73f0280c833be7f9ed 100644 (file)
@@ -246,14 +246,12 @@ void ntreeTexUpdatePreviews(bNodeTree* nodetree)
        
        for(tex= G.main->tex.first; tex; tex= tex->id.next)
                if(tex->nodetree == nodetree) break;
-       if(!tex) return;
-       
-       dummy_texres.nor = 0;
-       
-       ntreeBeginExecTree(nodetree);
-       ntreeTexExecTree(nodetree, &dummy_texres, coord, 0, 0, 1, 0, tex, 0, 0);
-       ntreeEndExecTree(nodetree);
+       if(tex) {
+               dummy_texres.nor = 0;
        
+               ntreeBeginExecTree(nodetree);
+               ntreeTexExecTree(nodetree, &dummy_texres, coord, 0, 0, 1, 0, tex, 0, 0);
+       }
 }
 
 char* ntreeTexOutputMenu(bNodeTree *ntree)