Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(88)

Unified Diff: source/blender/editors/space_node/node_templates.c

Issue 5593050: Node Group Interface Base URL: https://svn.blender.org/svnroot/bf-blender/trunk/blender/
Patch Set: Removed proxy node ntree storage, this causes problems with do_versions + lib_link Created 12 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « source/blender/editors/space_node/node_select.c ('k') | source/blender/makesdna/DNA_node_types.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: source/blender/editors/space_node/node_templates.c
===================================================================
--- source/blender/editors/space_node/node_templates.c (revision 43995)
+++ source/blender/editors/space_node/node_templates.c (working copy)
@@ -302,19 +302,18 @@
static void ui_node_menu_column(NodeLinkArg *arg, int nclass, const char *cname)
{
- Main *bmain = arg->bmain;
bNodeTree *ntree = arg->ntree;
+ bNodeTreeType *ttype= ntreeGetType(ntree->type);
bNodeSocket *sock = arg->sock;
uiLayout *layout = arg->layout;
uiLayout *column = NULL;
uiBlock *block = uiLayoutGetBlock(layout);
uiBut *but;
bNodeType *ntype;
- bNodeTree *ngroup;
NodeLinkArg *argN;
int first = 1;
int compatibility= 0;
-
+
if(ntree->type == NTREE_SHADER) {
if(scene_use_new_shading_nodes(arg->scene))
compatibility= NODE_NEW_SHADING;
@@ -322,112 +321,56 @@
compatibility= NODE_OLD_SHADING;
}
- if(nclass == NODE_CLASS_GROUP) {
- for(ngroup=bmain->nodetree.first; ngroup; ngroup=ngroup->id.next) {
- bNodeSocket *gsock;
- char name[UI_MAX_NAME_STR];
- int i, j, num = 0;
-
- if(ngroup->type != ntree->type)
+ for(ntype=ttype->node_types.first; ntype; ntype=ntype->next) {
+ bNodeSocketTemplate *stemp;
+ char name[UI_MAX_NAME_STR];
+ int i, j, num = 0;
+
+ if(compatibility && !(ntype->compatibility & compatibility))
+ continue;
+
+ if(ntype->nclass != nclass)
+ continue;
+
+ for(i=0, stemp=ntype->outputs; stemp && stemp->type != -1; stemp++, i++)
+ if(ui_compatible_sockets(stemp->type, sock->type))
+ num++;
+
+ for(i=0, j=0, stemp=ntype->outputs; stemp && stemp->type != -1; stemp++, i++) {
+ if(!ui_compatible_sockets(stemp->type, sock->type))
continue;
-
- for(gsock=ngroup->inputs.first; gsock; gsock=gsock->next)
- if(ui_compatible_sockets(gsock->type, sock->type))
- num++;
-
- for(i=0, j=0, gsock=ngroup->outputs.first; gsock; gsock=gsock->next, i++) {
- if(!ui_compatible_sockets(gsock->type, sock->type))
- continue;
-
- if(first) {
- column= uiLayoutColumn(layout, 0);
- uiBlockSetCurLayout(block, column);
-
- uiItemL(column, cname, ICON_NODE);
- but= block->buttons.last;
- but->flag= UI_TEXT_LEFT;
-
- first = 0;
- }
-
- if(num > 1) {
- if(j == 0) {
- uiItemL(column, ngroup->id.name+2, ICON_NODE);
- but= block->buttons.last;
- but->flag= UI_TEXT_LEFT;
- }
-
- BLI_snprintf(name, UI_MAX_NAME_STR, " %s", gsock->name);
- j++;
- }
- else
- BLI_strncpy(name, ngroup->id.name+2, UI_MAX_NAME_STR);
-
- but = uiDefBut(block, BUT, 0, ngroup->id.name+2, 0, 0, UI_UNIT_X*4, UI_UNIT_Y,
- NULL, 0.0, 0.0, 0.0, 0.0, "Add node to input");
-
- argN = MEM_dupallocN(arg);
- argN->type = NODE_GROUP;
- argN->ngroup = ngroup;
- argN->output = i;
- uiButSetNFunc(but, ui_node_link, argN, NULL);
+
+ if(first) {
+ column= uiLayoutColumn(layout, 0);
+ uiBlockSetCurLayout(block, column);
+
+ uiItemL(column, cname, ICON_NODE);
+ but= block->buttons.last;
+ but->flag= UI_TEXT_LEFT;
+
+ first = 0;
}
- }
- }
- else {
- bNodeTreeType *ttype= ntreeGetType(ntree->type);
-
- for(ntype=ttype->node_types.first; ntype; ntype=ntype->next) {
- bNodeSocketTemplate *stemp;
- char name[UI_MAX_NAME_STR];
- int i, j, num = 0;
-
- if(compatibility && !(ntype->compatibility & compatibility))
- continue;
-
- if(ntype->nclass != nclass)
- continue;
-
- for(i=0, stemp=ntype->outputs; stemp && stemp->type != -1; stemp++, i++)
- if(ui_compatible_sockets(stemp->type, sock->type))
- num++;
-
- for(i=0, j=0, stemp=ntype->outputs; stemp && stemp->type != -1; stemp++, i++) {
- if(!ui_compatible_sockets(stemp->type, sock->type))
- continue;
-
- if(first) {
- column= uiLayoutColumn(layout, 0);
- uiBlockSetCurLayout(block, column);
-
- uiItemL(column, cname, ICON_NODE);
+
+ if(num > 1) {
+ if(j == 0) {
+ uiItemL(column, ntype->name, ICON_NODE);
but= block->buttons.last;
but->flag= UI_TEXT_LEFT;
-
- first = 0;
}
-
- if(num > 1) {
- if(j == 0) {
- uiItemL(column, ntype->name, ICON_NODE);
- but= block->buttons.last;
- but->flag= UI_TEXT_LEFT;
- }
-
- BLI_snprintf(name, UI_MAX_NAME_STR, " %s", stemp->name);
- j++;
- }
- else
- BLI_strncpy(name, ntype->name, UI_MAX_NAME_STR);
-
- but = uiDefBut(block, BUT, 0, name, 0, 0, UI_UNIT_X*4, UI_UNIT_Y,
- NULL, 0.0, 0.0, 0.0, 0.0, "Add node to input");
-
- argN = MEM_dupallocN(arg);
- argN->type = ntype->type;
- argN->output = i;
- uiButSetNFunc(but, ui_node_link, argN, NULL);
+
+ BLI_snprintf(name, UI_MAX_NAME_STR, " %s", stemp->name);
+ j++;
}
+ else
+ BLI_strncpy(name, ntype->name, UI_MAX_NAME_STR);
+
+ but = uiDefBut(block, BUT, 0, name, 0, 0, UI_UNIT_X*4, UI_UNIT_Y,
+ NULL, 0.0, 0.0, 0.0, 0.0, "Add node to input");
+
+ argN = MEM_dupallocN(arg);
+ argN->type = ntype->type;
+ argN->output = i;
+ uiButSetNFunc(but, ui_node_link, argN, NULL);
}
}
}
« no previous file with comments | « source/blender/editors/space_node/node_select.c ('k') | source/blender/makesdna/DNA_node_types.h » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b