diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-10-06 19:31:25 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-10-06 19:31:25 +0400 |
commit | 8d54982f37cf48d510fa2de0b2b45c635164a7f3 (patch) | |
tree | c356e1304bf02a2714cde79ea51ce46340a26c58 /source/blender/blenkernel/intern/node.c | |
parent | 86307b58c0991472b25bd0c24ba8d2cdbf332bc3 (diff) |
Material buttons now view the active node material shading settings.
Selecting a material in the node tree sets this as the active material and the buttons view redraws.
Added rna prop material.active_node_material
Currently its not clear what settings are used by the node material and the base material (needs some tedious research) so I made most panels use the node material with the exceptions of volumetrics, physics and halo settings.
We'll probably need to split the panels up to do this properly.
Diffstat (limited to 'source/blender/blenkernel/intern/node.c')
-rw-r--r-- | source/blender/blenkernel/intern/node.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c index aa12894feb9..fad866a7201 100644 --- a/source/blender/blenkernel/intern/node.c +++ b/source/blender/blenkernel/intern/node.c @@ -1575,6 +1575,37 @@ bNode *nodeGetActiveID(bNodeTree *ntree, short idtype) return node; } +int nodeSetActiveID(bNodeTree *ntree, short idtype, ID *id) +{ + bNode *node; + int ok= FALSE; + + if(ntree==NULL) return ok; + + /* check for group edit */ + for(node= ntree->nodes.first; node; node= node->next) + if(node->flag & NODE_GROUP_EDIT) + break; + + if(node) + ntree= (bNodeTree*)node->id; + + /* now find active node with this id */ + for(node= ntree->nodes.first; node; node= node->next) { + if(node->id && GS(node->id->name)==idtype) { + if(id && ok==FALSE && node->id==id) { + node->flag |= NODE_ACTIVE_ID; + ok= TRUE; + } else { + node->flag &= ~NODE_ACTIVE_ID; + } + } + } + + return ok; +} + + /* two active flags, ID nodes have special flag for buttons display */ void nodeClearActiveID(bNodeTree *ntree, short idtype) { |