Spelling Cleanup
[blender.git] / source / blender / editors / space_node / space_node.c
index 0990afa4fe6877ba26a532bd3bafe7f957cc1a69..93d3b22e09234679f5a243014ef5f58f2ad00cb7 100644 (file)
@@ -1,6 +1,4 @@
 /*
- * $Id$
- *
  * ***** BEGIN GPL LICENSE BLOCK *****
  *
  * This program is free software; you can redistribute it and/or
 #include <string.h>
 #include <stdio.h>
 
+#include "DNA_lamp_types.h"
+#include "DNA_material_types.h"
 #include "DNA_node_types.h"
 #include "DNA_object_types.h"
-#include "DNA_material_types.h"
 #include "DNA_scene_types.h"
+#include "DNA_world_types.h"
 
 #include "MEM_guardedalloc.h"
 
@@ -169,6 +169,7 @@ static void node_area_listener(ScrArea *sa, wmNotifier *wmn)
        /* note, ED_area_tag_refresh will re-execute compositor */
        SpaceNode *snode= sa->spacedata.first;
        int type= snode->treetype;
+       short shader_type = snode->shaderfrom;
        
        /* preview renders */
        switch(wmn->category) {
@@ -178,6 +179,9 @@ static void node_area_listener(ScrArea *sa, wmNotifier *wmn)
                                case ND_FRAME:
                                        ED_area_tag_refresh(sa);
                                        break;
+                               case ND_COMPO_RESULT:
+                                       ED_area_tag_redraw(sa);
+                                       break;
                                case ND_TRANSFORM_DONE:
                                        if(type==NTREE_COMPOSIT) {
                                                if(snode->flag & SNODE_AUTO_RENDER) {
@@ -211,6 +215,17 @@ static void node_area_listener(ScrArea *sa, wmNotifier *wmn)
                                        ED_area_tag_refresh(sa);
                        }
                        break;
+               case NC_WORLD:
+                       if(type==NTREE_SHADER && shader_type==SNODE_SHADER_WORLD) {
+                               ED_area_tag_refresh(sa);        
+                       }
+                       break;
+               case NC_OBJECT:
+                       if(type==NTREE_SHADER) {
+                               if(wmn->data==ND_OB_SHADING)
+                                       ED_area_tag_refresh(sa);
+                       }
+                       break;
                case NC_TEXT:
                        /* pynodes */
                        if(wmn->data==ND_SHADING)
@@ -239,12 +254,10 @@ static void node_area_listener(ScrArea *sa, wmNotifier *wmn)
                case NC_IMAGE:
                        if (wmn->action == NA_EDITED) {
                                if(type==NTREE_COMPOSIT) {
-                                       Scene *scene= wmn->window->screen->scene;
-                                       
-                                       /* note that NodeTagIDChanged is already called by BKE_image_signal() on all
+                                       /* note that nodeUpdateID is already called by BKE_image_signal() on all
                                         * scenes so really this is just to know if the images is used in the compo else
                                         * painting on images could become very slow when the compositor is open. */
-                                       if(NodeTagIDChanged(scene->nodetree, wmn->reference))
+                                       if(nodeUpdateID(snode->nodetree, wmn->reference))
                                                ED_area_tag_refresh(sa);
                                }
                        }
@@ -261,9 +274,21 @@ static void node_area_refresh(const struct bContext *C, struct ScrArea *sa)
        
        if(snode->nodetree) {
                if(snode->treetype==NTREE_SHADER) {
-                       Material *ma= (Material *)snode->id;
-                       if(ma->use_nodes)
-                               ED_preview_shader_job(C, sa, snode->id, NULL, NULL, 100, 100, PR_NODE_RENDER);
+                       if(GS(snode->id->name) == ID_MA) {
+                               Material *ma= (Material *)snode->id;
+                               if(ma->use_nodes)
+                                       ED_preview_shader_job(C, sa, snode->id, NULL, NULL, 100, 100, PR_NODE_RENDER);
+                       }
+                       else if(GS(snode->id->name) == ID_LA) {
+                               Lamp *la= (Lamp *)snode->id;
+                               if(la->use_nodes)
+                                       ED_preview_shader_job(C, sa, snode->id, NULL, NULL, 100, 100, PR_NODE_RENDER);
+                       }
+                       else if(GS(snode->id->name) == ID_WO) {
+                               World *wo= (World *)snode->id;
+                               if(wo->use_nodes)
+                                       ED_preview_shader_job(C, sa, snode->id, NULL, NULL, 100, 100, PR_NODE_RENDER);
+                       }
                }
                else if(snode->treetype==NTREE_COMPOSIT) {
                        Scene *scene= (Scene *)snode->id;
@@ -314,7 +339,7 @@ static void node_buttons_area_draw(const bContext *C, ARegion *ar)
        ED_region_panels(C, ar, 1, NULL, -1);
 }
 
-/* Initialise main area, setting handlers. */
+/* Initialize main area, setting handlers. */
 static void node_main_area_init(wmWindowManager *wm, ARegion *ar)
 {
        wmKeyMap *keymap;
@@ -419,6 +444,10 @@ static void node_region_listener(ARegion *ar, wmNotifier *wmn)
                case NC_NODE:
                        ED_region_tag_redraw(ar);
                        break;
+               case NC_OBJECT:
+                       if(wmn->data==ND_OB_SHADING)
+                               ED_region_tag_redraw(ar);
+                       break;
                case NC_ID:
                        if(wmn->action == NA_RENAME)
                                ED_region_tag_redraw(ar);