diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2011-11-08 02:28:49 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2011-11-08 02:28:49 +0400 |
commit | cd191b7d17c42e90dcdda56ba3fbddf08666b3ab (patch) | |
tree | f5e5f411be648797561ca205642c3074e8397748 /source/blender/editors/space_node/node_buttons.c | |
parent | be23090aae643f3c5a01ec47c601aa50a7174eb4 (diff) |
UI/Nodes: templates to edit nodes from the properties editor using a tree view,
to be used by cycles. For testing there's a panel in the node editor if you set
debug to 777, didn't enable it because I'm not sure it's very useful there.
Diffstat (limited to 'source/blender/editors/space_node/node_buttons.c')
-rw-r--r-- | source/blender/editors/space_node/node_buttons.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/source/blender/editors/space_node/node_buttons.c b/source/blender/editors/space_node/node_buttons.c index 3886c709196..15e5719be37 100644 --- a/source/blender/editors/space_node/node_buttons.c +++ b/source/blender/editors/space_node/node_buttons.c @@ -45,6 +45,7 @@ #include "BLI_utildefines.h" #include "BKE_context.h" +#include "BKE_global.h" #include "BKE_node.h" #include "BKE_screen.h" @@ -122,6 +123,34 @@ static void active_node_panel(const bContext *C, Panel *pa) node->typeinfo->uifunc(layout, (bContext *)C, &ptr); } +static int node_sockets_poll(const bContext *C, PanelType *UNUSED(pt)) +{ + SpaceNode *snode= CTX_wm_space_node(C); + + return (snode && snode->nodetree && G.rt == 777); +} + +static void node_sockets_panel(const bContext *C, Panel *pa) +{ + SpaceNode *snode= CTX_wm_space_node(C); + bNodeTree *ntree= (snode) ? snode->edittree : NULL; + bNode *node = (ntree) ? nodeGetActive(ntree) : NULL; + bNodeSocket *sock; + uiLayout *layout= pa->layout, *split; + char name[UI_MAX_NAME_STR]; + + if(ELEM(NULL, ntree, node)) + return; + + for(sock=node->inputs.first; sock; sock=sock->next) { + BLI_snprintf(name, sizeof(name), "%s:", sock->name); + + split = uiLayoutSplit(layout, 0.35f, 0); + uiItemL(split, name, ICON_NONE); + uiTemplateNodeLink(split, ntree, node, sock); + } +} + /* ******************* node buttons registration ************** */ void node_buttons_register(ARegionType *art) @@ -134,6 +163,14 @@ void node_buttons_register(ARegionType *art) pt->draw= active_node_panel; pt->poll= active_node_poll; BLI_addtail(&art->paneltypes, pt); + + pt= MEM_callocN(sizeof(PanelType), "spacetype node panel node sockets"); + strcpy(pt->idname, "NODE_PT_sockets"); + strcpy(pt->label, "Sockets"); + pt->draw= node_sockets_panel; + pt->poll= node_sockets_poll; + pt->flag |= PNL_DEFAULT_CLOSED; + BLI_addtail(&art->paneltypes, pt); pt= MEM_callocN(sizeof(PanelType), "spacetype node panel gpencil"); strcpy(pt->idname, "NODE_PT_gpencil"); |