diff options
Diffstat (limited to 'source/blender/editors/space_node/space_node.c')
-rw-r--r-- | source/blender/editors/space_node/space_node.c | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/source/blender/editors/space_node/space_node.c b/source/blender/editors/space_node/space_node.c index 35b8666f274..1a808e8ee5f 100644 --- a/source/blender/editors/space_node/space_node.c +++ b/source/blender/editors/space_node/space_node.c @@ -32,10 +32,12 @@ #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" @@ -268,9 +270,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; @@ -426,6 +440,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); |