Cycles UI: keep node input sockets collapsed by default in the properties editor,

when doing the linking in the node editor, to keep the properties editor more
clean in this case.
This commit is contained in:
Brecht Van Lommel
2012-10-24 21:57:16 +00:00
parent b4d9037dfb
commit 5aa6327e2f
3 changed files with 7 additions and 3 deletions

View File

@@ -147,6 +147,7 @@ static bNodeSocket *make_socket(bNodeTree *UNUSED(ntree), int in_out, const char
sock->limit = (in_out == SOCK_IN ? 1 : 0xFFF);
sock->type = type;
sock->storage = NULL;
sock->flag |= SOCK_COLLAPSED;
sock->default_value = node_socket_make_default_value(type);
node_socket_init_default_value(type, sock->default_value);

View File

@@ -122,6 +122,7 @@ static void node_socket_disconnect(Main *bmain, bNodeTree *ntree, bNode *node_to
return;
nodeRemLink(ntree, sock_to->link);
sock_to->flag |= SOCK_COLLAPSED;
nodeUpdate(ntree, node_to);
ntreeUpdateTree(ntree);
@@ -136,6 +137,7 @@ static void node_socket_remove(Main *bmain, bNodeTree *ntree, bNode *node_to, bN
return;
node_remove_linked(ntree, sock_to->link->fromnode);
sock_to->flag |= SOCK_COLLAPSED;
nodeUpdate(ntree, node_to);
ntreeUpdateTree(ntree);
@@ -185,6 +187,7 @@ static void node_socket_add_replace(Main *bmain, bNodeTree *ntree, bNode *node_t
/* add link */
sock_from_tmp = BLI_findlink(&node_from->outputs, sock_num);
nodeAddLink(ntree, node_from, sock_from_tmp, node_to, sock_to);
sock_to->flag &= ~SOCK_COLLAPSED;
/* copy input sockets from previous node */
if (node_prev && node_from != node_prev) {
@@ -613,7 +616,7 @@ static void ui_node_draw_input(uiLayout *layout, bContext *C, bNodeTree *ntree,
/* input linked to a node */
uiTemplateNodeLink(split, ntree, node, input);
if (!(input->flag & SOCK_COLLAPSED)) {
if (depth == 0 || !(input->flag & SOCK_COLLAPSED)) {
if (depth == 0)
uiItemS(layout);

View File

@@ -92,7 +92,7 @@ bNodeSocket *node_group_add_extern_socket(bNodeTree *UNUSED(ntree), ListBase *lb
sock->new_sock = NULL;
/* group sockets are dynamically added */
sock->flag |= SOCK_DYNAMIC;
sock->flag |= SOCK_DYNAMIC|SOCK_COLLAPSED;
sock->own_index = gsock->own_index;
sock->groupsock = gsock;
@@ -115,7 +115,7 @@ bNodeSocket *node_group_add_socket(bNodeTree *ngroup, const char *name, int type
BLI_strncpy(gsock->name, name, sizeof(gsock->name));
gsock->type = type;
/* group sockets are dynamically added */
gsock->flag |= SOCK_DYNAMIC;
gsock->flag |= SOCK_DYNAMIC|SOCK_COLLAPSED;
gsock->next = gsock->prev = NULL;
gsock->new_sock = NULL;