diff options
author | Diego Borghetti <bdiego@gmail.com> | 2010-05-12 16:03:38 +0400 |
---|---|---|
committer | Diego Borghetti <bdiego@gmail.com> | 2010-05-12 16:03:38 +0400 |
commit | 9a4ba57ee9fc8005f734c961b73b99398880b37f (patch) | |
tree | 7019d844fe7b8d3636849fd838caf78e8e03f56e /source/blender/editors/space_node/node_edit.c | |
parent | 285a73d274b6092b7a7dd5feb2013ab5c96234a1 (diff) |
Node Space: Small feature for Venomgfx, Shift + F select node of the same type
This is a small request from Venomgfx, select a node
and then press Shift + F to select all the nodes of the
same type (of the active node).
The key binding can be change, we thing in a "Find Next" (that is
way the FKEY) with venomgfx, but no problem with change that.
Also I add the entry in the select menu.
Diffstat (limited to 'source/blender/editors/space_node/node_edit.c')
-rw-r--r-- | source/blender/editors/space_node/node_edit.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c index 42c9f4ce1a2..bb9bb338767 100644 --- a/source/blender/editors/space_node/node_edit.c +++ b/source/blender/editors/space_node/node_edit.c @@ -922,6 +922,38 @@ void node_deselectall(SpaceNode *snode) node->flag &= ~SELECT; } +/* return 1 if we need redraw otherwise zero. */ +int node_select_same_type(SpaceNode *snode) +{ + bNode *nac, *p; + int redraw; + + /* search for the active node. */ + for (nac= snode->edittree->nodes.first; nac; nac= nac->next) { + if (nac->flag & SELECT) + break; + } + + /* no active node, return. */ + if (!nac) + return(0); + + redraw= 0; + for (p= snode->edittree->nodes.first; p; p= p->next) { + if (p->type != nac->type && p->flag & SELECT) { + /* if it's selected but different type, unselect */ + redraw= 1; + p->flag &= ~SELECT; + } + else if (p->type == nac->type && (!(p->flag & SELECT))) { + /* if it's the same type and is not selected, select! */ + redraw= 1; + p->flag |= SELECT; + } + } + return(redraw); +} + int node_has_hidden_sockets(bNode *node) { bNodeSocket *sock; |