Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2011-11-02 22:55:32 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2011-11-02 22:55:32 +0400
commit30f1f28a8af3b393608b5869512a8823111294ad (patch)
tree035cee751100c31e25b55087efa476145b29af64 /source/blender/editors/space_node/space_node.c
parent97a0ae3e1b7eea3c069da8c6d3c7a3535734059d (diff)
Nodes: add support for shader nodes on world and lamps, in addition to materials.
The internal render engine does not support them, and they are not accesible in the UI yet, but cycles will use them.
Diffstat (limited to 'source/blender/editors/space_node/space_node.c')
-rw-r--r--source/blender/editors/space_node/space_node.c26
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);