diff options
author | Antony Riakiotakis <kalast@gmail.com> | 2014-11-24 19:18:56 +0300 |
---|---|---|
committer | Antony Riakiotakis <kalast@gmail.com> | 2014-11-26 17:07:26 +0300 |
commit | 8fa55d95e43392a0e7925e1327e86220a33b4394 (patch) | |
tree | b68b040a975e6231c8ec40d89cebad93582c52af /source/blender/editors/space_node/node_edit.c | |
parent | 8bc84e10f501e516e0839b6a3efa573d55fb4f7b (diff) |
World background working on cycle nodes.
This is added in the spirit of the general cycles GLSL system
which is pretty much WIP still.
This will only work on cycles at the moment but generating for blender
internal is possible too of course though it will be done in a separate
commit.
This hasn't been tested with all and every node in cycles, but
environment and regular textures with texture coordinates work.
There is some difference between the way cycles treats some coordinates,
which is in world space and the way GLSL treats them, which is in view
space.
We might want to explore and improve this further in the future.
...also </drumroll>
Diffstat (limited to 'source/blender/editors/space_node/node_edit.c')
-rw-r--r-- | source/blender/editors/space_node/node_edit.c | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c index d52a351ffc2..1b82e89a364 100644 --- a/source/blender/editors/space_node/node_edit.c +++ b/source/blender/editors/space_node/node_edit.c @@ -342,14 +342,22 @@ void snode_dag_update(bContext *C, SpaceNode *snode) void snode_notify(bContext *C, SpaceNode *snode) { + ID *id = snode->id; + WM_event_add_notifier(C, NC_NODE | NA_EDITED, NULL); - if (ED_node_is_shader(snode)) - WM_event_add_notifier(C, NC_MATERIAL | ND_NODES, snode->id); + if (ED_node_is_shader(snode)) { + if (GS(id->name) == ID_MA) + WM_main_add_notifier(NC_MATERIAL | ND_SHADING, id); + else if (GS(id->name) == ID_LA) + WM_main_add_notifier(NC_LAMP | ND_LIGHTING, id); + else if (GS(id->name) == ID_WO) + WM_main_add_notifier(NC_WORLD | ND_WORLD, id); + } else if (ED_node_is_compositor(snode)) - WM_event_add_notifier(C, NC_SCENE | ND_NODES, snode->id); + WM_event_add_notifier(C, NC_SCENE | ND_NODES, id); else if (ED_node_is_texture(snode)) - WM_event_add_notifier(C, NC_TEXTURE | ND_NODES, snode->id); + WM_event_add_notifier(C, NC_TEXTURE | ND_NODES, id); } void ED_node_set_tree_type(SpaceNode *snode, bNodeTreeType *typeinfo) @@ -662,11 +670,16 @@ void ED_node_set_active(Main *bmain, bNodeTree *ntree, bNode *node) /* if active texture changed, free glsl materials */ if ((node->flag & NODE_ACTIVE_TEXTURE) && !was_active_texture) { Material *ma; + World *wo; for (ma = bmain->mat.first; ma; ma = ma->id.next) if (ma->nodetree && ma->use_nodes && ntreeHasTree(ma->nodetree, ntree)) - GPU_material_free(ma); + GPU_material_free(&ma->gpumaterial); + for (wo = bmain->world.first; wo; wo = wo->id.next) + if (wo->nodetree && wo->use_nodes && ntreeHasTree(wo->nodetree, ntree)) + GPU_material_free(&wo->gpumaterial); + WM_main_add_notifier(NC_IMAGE, NULL); } |