Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_node/node_templates.c
| Show First 20 Lines • Show All 324 Lines • ▼ Show 20 Lines | static void ui_node_link_items(NodeLinkArg *arg, | ||||
| NodeLinkItem *items = NULL; | NodeLinkItem *items = NULL; | ||||
| int totitems = 0; | int totitems = 0; | ||||
| if (arg->node_type->type == NODE_GROUP) { | if (arg->node_type->type == NODE_GROUP) { | ||||
| bNodeTree *ngroup; | bNodeTree *ngroup; | ||||
| int i; | int i; | ||||
| for (ngroup = arg->bmain->nodetrees.first; ngroup; ngroup = ngroup->id.next) { | for (ngroup = arg->bmain->nodetrees.first; ngroup; ngroup = ngroup->id.next) { | ||||
| if ((ngroup->type != arg->ntree->type) || !nodeGroupPoll(arg->ntree, ngroup)) { | |||||
| continue; | |||||
| } | |||||
| ListBase *lb = ((in_out == SOCK_IN) ? &ngroup->inputs : &ngroup->outputs); | ListBase *lb = ((in_out == SOCK_IN) ? &ngroup->inputs : &ngroup->outputs); | ||||
| totitems += BLI_listbase_count(lb); | totitems += BLI_listbase_count(lb); | ||||
| } | } | ||||
| if (totitems > 0) { | if (totitems > 0) { | ||||
| items = MEM_callocN(sizeof(NodeLinkItem) * totitems, "ui node link items"); | items = MEM_callocN(sizeof(NodeLinkItem) * totitems, "ui node link items"); | ||||
| i = 0; | i = 0; | ||||
| for (ngroup = arg->bmain->nodetrees.first; ngroup; ngroup = ngroup->id.next) { | for (ngroup = arg->bmain->nodetrees.first; ngroup; ngroup = ngroup->id.next) { | ||||
| if ((ngroup->type != arg->ntree->type) || !nodeGroupPoll(arg->ntree, ngroup)) { | |||||
| continue; | |||||
| } | |||||
| ListBase *lb = (in_out == SOCK_IN ? &ngroup->inputs : &ngroup->outputs); | ListBase *lb = (in_out == SOCK_IN ? &ngroup->inputs : &ngroup->outputs); | ||||
| bNodeSocket *stemp; | bNodeSocket *stemp; | ||||
| int index; | int index; | ||||
| for (stemp = lb->first, index = 0; stemp; stemp = stemp->next, index++, i++) { | for (stemp = lb->first, index = 0; stemp; stemp = stemp->next, index++, i++) { | ||||
| NodeLinkItem *item = &items[i]; | NodeLinkItem *item = &items[i]; | ||||
| item->socket_index = index; | item->socket_index = index; | ||||
| /* note: int stemp->type is not fully reliable, not used for node group | /* note: int stemp->type is not fully reliable, not used for node group | ||||
| ▲ Show 20 Lines • Show All 530 Lines • Show Last 20 Lines | |||||