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/toolbox.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/toolbox.c')
-rw-r--r-- | source/blender/src/toolbox.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/source/blender/src/toolbox.c b/source/blender/src/toolbox.c index a200e8d44eb..3143b9652aa 100644 --- a/source/blender/src/toolbox.c +++ b/source/blender/src/toolbox.c @@ -1576,7 +1576,6 @@ static TBitem *node_add_sublevel(ListBase *storage, bNodeTree *ntree, int nodecl { static TBitem _addmenu[]= { { 0, " ", 0, NULL}, { -1, "", 0, NULL}}; Link *link; - bNodeType **typedefs; TBitem *addmenu; int tot= 0, a; @@ -1588,9 +1587,13 @@ static TBitem *node_add_sublevel(ListBase *storage, bNodeTree *ntree, int nodecl tot++; } else { - for(typedefs= ntree->alltypes; *typedefs; typedefs++) - if( (*typedefs)->nclass == nodeclass ) + bNodeType *ntype = ntree->alltypes.first; + while(ntype) { + if(ntype->nclass == nodeclass) { tot++; + } + ntype= ntype->next; + } } } if(tot==0) { @@ -1612,15 +1615,16 @@ static TBitem *node_add_sublevel(ListBase *storage, bNodeTree *ntree, int nodecl } } else { - for(a=0, typedefs= ntree->alltypes; *typedefs; typedefs++) { - if( (*typedefs)->nclass == nodeclass ) { - addmenu[a].name= (*typedefs)->name; - addmenu[a].retval= (*typedefs)->type; + bNodeType *ntype= ntree->alltypes.first; + for(a=0; ntype; ntype= ntype->next) { + if( ntype->nclass == nodeclass ) { + addmenu[a].name= ntype->name; + addmenu[a].retval= ntype->type; a++; } } } - + addmenu[a].icon= -1; /* end signal */ addmenu[a].name= ""; addmenu[a].retval= a; |