diff options
author | Ton Roosendaal <ton@blender.org> | 2009-01-22 17:59:49 +0300 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2009-01-22 17:59:49 +0300 |
commit | 9cc59fb0c329bb788defe9c56b69d0919caaba96 (patch) | |
tree | f6f1c48441ba6de4f2ff1faf19a0540ce1dc6ba5 /source/blender/editors/space_node/node_draw.c | |
parent | a017982074b3b11fd0157d8d604e02858411db70 (diff) |
2.5
Added WM Jobs manager
- WM can manage threaded jobs for you; just provide a couple
of components to get it work:
- customdata, free callback for it
- timer step, notifier code
- start callback, update callback
- Once started, each job runs an own timer, and will for
every time step check necessary updates, or close the
job when ready.
- No drawing happens in jobs, that's for notifiers!
- Every job stores an owner pointer, and based on this owner
it will prevent multiple jobs to enter the stack.
Instead it will re-use a running job, signal it to stop
and allow caller to re-initialize it even.
- Check new wm_jobs.c for more explanation. Jobs API is still
under construction.
Fun: BLI_addtail(&wm->jobs, steve); :)
Put Node shader previews back using wmJobs
- Preview calculating is now fully threaded (1 thread still)
- Thanks to new event system + notifiers, you can see
previews update even while dragging sliders!
- Currently it only starts when you change a node setting.
Warning: the thread render shares Node data, so don't delete
nodes while it renders! This topic is on the todo to make safe.
Also:
- bug in region initialize (do_versions) showed channel list in
node editor wrong.
- flagged the channel list 'hidden' now, it was really in the
way! This is for later to work on anyway.
- recoded Render API callbacks so it gets handlers passed on,
no globals to use anymore, remember?
- previewrender code gets now so much nicer! Will remove a lot
of stuff from code soon.
Diffstat (limited to 'source/blender/editors/space_node/node_draw.c')
-rw-r--r-- | source/blender/editors/space_node/node_draw.c | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c index 4008e43e83a..11f760bb882 100644 --- a/source/blender/editors/space_node/node_draw.c +++ b/source/blender/editors/space_node/node_draw.c @@ -71,6 +71,7 @@ #include "BMF_Api.h" #include "WM_api.h" +#include "WM_types.h" #include "ED_screen.h" #include "ED_util.h" @@ -497,7 +498,7 @@ static void socket_vector_menu_cb(bContext *C, void *node_v, void *ntree_v) { if(node_v && ntree_v) { NodeTagChanged(ntree_v, node_v); - // addqueue(curarea->win, UI_BUT_EVENT, B_NODE_EXEC+((bNode *)node_v)->nr); XXX + // addqueue(curarea->win, UI_BUT_EVENT, B_NODE_EXEC); XXX } } @@ -606,6 +607,22 @@ static void node_draw_preview(bNodePreview *preview, rctf *prv) } +static void do_node_internal_buttons(bContext *C, void *node_v, int event) +{ + SpaceNode *snode= (SpaceNode*)CTX_wm_space_data(C); + + if(event==B_NODE_EXEC) { + if(snode->treetype==NTREE_SHADER) + WM_event_add_notifier(C, NC_MATERIAL|ND_SHADING, snode->id); + + // else if(snode->treetype==NTREE_COMPOSIT) + // composit_node_event(snode, val); + // else if(snode->treetype==NTREE_TEXTURE) + // texture_node_event(snode, val); + } + +} + static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bNode *node) { bNodeSocket *sock; @@ -742,7 +759,7 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN //block= uiNewBlock(&sa->uiblocks, str, UI_EMBOSS, UI_HELV, sa->win); block= uiBeginBlock(C, ar, str, UI_EMBOSS, UI_HELV); - uiBlockSetFlag(block, UI_BLOCK_NO_HILITE); + uiBlockSetHandleFunc(block, do_node_internal_buttons, node); // XXX if(snode->id) // XXX uiSetButLock(snode->id->lib!=NULL, ERROR_LIBDATA_MESSAGE); } @@ -761,7 +778,7 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN float *butpoin= sock->ns.vec; if(sock->type==SOCK_VALUE) { - bt= uiDefButF(block, NUM, B_NODE_EXEC+node->nr, sock->name, + bt= uiDefButF(block, NUM, B_NODE_EXEC, sock->name, (short)sock->locx+NODE_DYS, (short)(sock->locy)-9, (short)node->width-NODE_DY, 17, butpoin, sock->ns.min, sock->ns.max, 10, 2, ""); uiButSetFunc(bt, node_sync_cb, snode, node); @@ -776,7 +793,7 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN if(labelw>0) width= 40; else width= (short)node->width-NODE_DY; - bt= uiDefButF(block, COL, B_NODE_EXEC+node->nr, "", + bt= uiDefButF(block, COL, B_NODE_EXEC, "", (short)(sock->locx+NODE_DYS), (short)sock->locy-8, width, 15, butpoin, 0, 0, 0, 0, ""); uiButSetFunc(bt, node_sync_cb, snode, node); @@ -826,12 +843,13 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN if(node->typeinfo->butfunc) { node->typeinfo->butfunc(block, snode->nodetree, node, &node->butr); } - uiDrawBlock(C, block); } } - if(block) + if(block) { uiEndBlock(C, block); + uiDrawBlock(C, block); + } } static void node_draw_hidden(View2D *v2d, SpaceNode *snode, bNode *node) |