diff options
author | Ton Roosendaal <ton@blender.org> | 2007-03-26 19:07:38 +0400 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2007-03-26 19:07:38 +0400 |
commit | 5c760e481114da07ef2ee364bc305bb7716abe8c (patch) | |
tree | 623d328cfd9383efb051d197e6264af185cf1e37 /source/blender/src/header_node.c | |
parent | d1315a342d7db1653a7fc3cecb646ab785e08f6e (diff) |
Changed node type definitions to use a dynamic list.
This will allow python or plugin defined nodes to work as well.
(And fixes compile issues with MSVC in yesterdays commit for nodes)
Code provided by Nathan L.
Fixes in his code:
- free_nodesystem() was called too late (after guarded alloc was closed)
- free_nodesystem() was freeing nodes that were not malloced even
- free_nodesystem was using free, not freeN :)
- the typedefs needed to be malloced yes, to allow duplicate nodes like
group but also for dynamic nodes.
Diffstat (limited to 'source/blender/src/header_node.c')
-rw-r--r-- | source/blender/src/header_node.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/source/blender/src/header_node.c b/source/blender/src/header_node.c index 2697cb0c39b..b9f02cc7bd0 100644 --- a/source/blender/src/header_node.c +++ b/source/blender/src/header_node.c @@ -247,9 +247,12 @@ static void node_make_addmenu(SpaceNode *snode, int nodeclass, uiBlock *block) tot++; } else { - for(typedefs= ntree->alltypes; *typedefs; typedefs++) - if( (*typedefs)->nclass == nodeclass ) + bNodeType *type = ntree->alltypes.first; + while(type) { + if(type->nclass == nodeclass) tot++; + type= type->next; + } } } @@ -270,10 +273,12 @@ static void node_make_addmenu(SpaceNode *snode, int nodeclass, uiBlock *block) } } else { - for(a=0, typedefs= ntree->alltypes; *typedefs; typedefs++) { - if( (*typedefs)->nclass == nodeclass ) { - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, (*typedefs)->name, 0, - yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, (*typedefs)->type, ""); + bNodeType *type; + for(a=0, type= ntree->alltypes.first; type; type=type->next) { + if( type->nclass == nodeclass ) { + printf("node %s\n", type->name); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, type->name, 0, + yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, type->type, ""); a++; } } |