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)) { | const char *disabled_hint; | ||||
| if ((ngroup->type != arg->ntree->type) || | |||||
| !nodeGroupPoll(arg->ntree, ngroup, &disabled_hint)) { | |||||
| continue; | 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)) { | const char *disabled_hint; | ||||
| if ((ngroup->type != arg->ntree->type) || | |||||
| !nodeGroupPoll(arg->ntree, ngroup, &disabled_hint)) { | |||||
| continue; | 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]; | ||||
| ▲ Show 20 Lines • Show All 121 Lines • ▼ Show 20 Lines | static void ui_node_menu_column(NodeLinkArg *arg, int nclass, const char *cname) | ||||
| NodeLinkArg *argN; | NodeLinkArg *argN; | ||||
| int first = 1; | int first = 1; | ||||
| /* generate array of node types sorted by UI name */ | /* generate array of node types sorted by UI name */ | ||||
| bNodeType **sorted_ntypes = NULL; | bNodeType **sorted_ntypes = NULL; | ||||
| BLI_array_declare(sorted_ntypes); | BLI_array_declare(sorted_ntypes); | ||||
| NODE_TYPES_BEGIN (ntype) { | NODE_TYPES_BEGIN (ntype) { | ||||
| if (!(ntype->poll && ntype->poll(ntype, ntree))) { | const char *disabled_hint; | ||||
| if (!(ntype->poll && ntype->poll(ntype, ntree, &disabled_hint))) { | |||||
| continue; | continue; | ||||
| } | } | ||||
| if (ntype->nclass != nclass) { | if (ntype->nclass != nclass) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| if (!ui_node_item_special_poll(ntree, ntype)) { | if (!ui_node_item_special_poll(ntree, ntype)) { | ||||
| ▲ Show 20 Lines • Show All 343 Lines • ▼ Show 20 Lines | else { | ||||
| case SOCK_RGBA: | case SOCK_RGBA: | ||||
| uiItemR(sub, &inputptr, "default_value", 0, "", ICON_NONE); | uiItemR(sub, &inputptr, "default_value", 0, "", ICON_NONE); | ||||
| uiItemDecoratorR( | uiItemDecoratorR( | ||||
| split_wrapper.decorate_column, &inputptr, "default_value", RNA_NO_INDEX); | split_wrapper.decorate_column, &inputptr, "default_value", RNA_NO_INDEX); | ||||
| break; | break; | ||||
| case SOCK_STRING: { | case SOCK_STRING: { | ||||
| const bNodeTree *node_tree = (const bNodeTree *)nodeptr.owner_id; | const bNodeTree *node_tree = (const bNodeTree *)nodeptr.owner_id; | ||||
| if (node_tree->type == NTREE_GEOMETRY) { | if (node_tree->type == NTREE_GEOMETRY) { | ||||
| node_geometry_add_attribute_search_button(node_tree, node, &inputptr, row); | node_geometry_add_attribute_search_button(C, node_tree, node, &inputptr, row); | ||||
| } | } | ||||
| else { | else { | ||||
| uiItemR(sub, &inputptr, "default_value", 0, "", ICON_NONE); | uiItemR(sub, &inputptr, "default_value", 0, "", ICON_NONE); | ||||
| } | } | ||||
| uiItemDecoratorR( | uiItemDecoratorR( | ||||
| split_wrapper.decorate_column, &inputptr, "default_value", RNA_NO_INDEX); | split_wrapper.decorate_column, &inputptr, "default_value", RNA_NO_INDEX); | ||||
| break; | break; | ||||
| } | } | ||||
| Show All 35 Lines | |||||