Quick addition to the node sidebar "Active Node" panel: draw input socket values in addition to non-socket settings. This makes it possible to actually use the sidebar for all node settings without

having to go to the main area for changing socket values.

This patch should be considered a temporary solution. The Active Node panel is a horrible mess and needs to be split up and cleaned. It should probably be moved to python as well.
This commit is contained in:
Lukas Toenne 2013-05-28 18:10:00 +00:00
parent 3223518e32
commit 3128a47d22

@ -79,8 +79,10 @@ static void active_node_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; // xxx... for editing group nodes
bNodeSocket *sock;
uiLayout *layout, *row, *col, *sub;
PointerRNA ptr, opptr;
bool show_inputs;
/* verify pointers, and create RNA pointer for the node */
if (ELEM(NULL, ntree, node))
@ -130,6 +132,33 @@ static void active_node_panel(const bContext *C, Panel *pa)
uiItemS(layout);
node->typeinfo->uifunc(layout, (bContext *)C, &ptr);
}
uiItemS(layout);
/* socket input values */
/* XXX this is not quite perfect yet, it still shows sockets without meaningful input values
* and does not yet use the socket link template - but better than nothing.
* Eventually could move this panel to python
* and leave it up to the individual node system implementation.
*/
show_inputs = false;
for (sock = node->inputs.first; sock; sock = sock->next) {
if (!nodeSocketIsHidden(sock) && !(sock->flag & SOCK_IN_USE)) {
show_inputs = true;
break;
}
}
if (show_inputs) {
uiItemL(layout, "Inputs:", 0);
for (sock = node->inputs.first; sock; sock = sock->next) {
if (!nodeSocketIsHidden(sock) && !(sock->flag & SOCK_IN_USE)) {
uiLayout *row = uiLayoutRow(layout, false);
PointerRNA sock_ptr;
RNA_pointer_create(&ntree->id, &RNA_NodeSocket, sock, &sock_ptr);
sock->typeinfo->draw((bContext *)C, row, &sock_ptr, &ptr, sock->name);
}
}
}
}
static int node_sockets_poll(const bContext *C, PanelType *UNUSED(pt))