diff options
author | Juho Vepsalainen <bebraw@gmail.com> | 2008-01-07 22:38:01 +0300 |
---|---|---|
committer | Juho Vepsalainen <bebraw@gmail.com> | 2008-01-07 22:38:01 +0300 |
commit | aa1c0281c6df642d6c9673c00ac660a36a75f286 (patch) | |
tree | b062ce961329087d2791c118a5f84bfd944cf1cb /source/blender/src/editnode.c | |
parent | 7da95822f0fabf1b554c34f5bcd7c4d6dcb4ae24 (diff) |
Custom Names for Nodes
This commit makes it possible to add a custom name to a node. The feature can be
accessed either by using a menu or shortcut ctrl-r. It currently works only when
a single node is selected. Invoking the feature gives a popup menu in which a new
name can be entered. If the given name is not empty, it will be shown like
"(myCustomName) NodeName" in the node header.
This feature is particularly useful when documenting complex node setups.
I also fixed the size of blur node. It was too short before due to my previous
commit.
Thanks to David Millan Escriva for contribution!
Diffstat (limited to 'source/blender/src/editnode.c')
-rw-r--r-- | source/blender/src/editnode.c | 36 |
1 files changed, 33 insertions, 3 deletions
diff --git a/source/blender/src/editnode.c b/source/blender/src/editnode.c index 660d198aee1..07d77747fac 100644 --- a/source/blender/src/editnode.c +++ b/source/blender/src/editnode.c @@ -22,7 +22,7 @@ * * The Original Code is: all of this file. * - * Contributor(s): none yet. + * Contributor(s): David Millan Escriva, Juho Vepsäläinen * * ***** END GPL LICENSE BLOCK ***** */ @@ -1083,7 +1083,33 @@ static void scale_node(SpaceNode *snode, bNode *node) allqueue(REDRAWNODE, 1); } +/* ******************** rename ******************* */ +void node_rename(SpaceNode *snode) +{ + bNode *node, *rename_node; + short found_node= 0; + + /* don't rename if more than one node is selected */ + /* a nice alternative for this would be to rename last selected node */ + for(node= snode->edittree->nodes.first; node; node= node->next) { + if(node->flag & SELECT) { + if(found_node) { + error("Can rename only one selected node at time"); + return; + } + rename_node= node; + found_node= 1; + } + } + + if(found_node) { + node_rename_but((char *)rename_node->username); + BIF_undo_push("Rename Node"); + + allqueue(REDRAWNODE, 1); + } +} /* ********************** select ******************** */ @@ -2305,8 +2331,12 @@ void winqreadnodespace(ScrArea *sa, void *spacedata, BWinEvent *evt) node_select_linked(snode, G.qual==LR_SHIFTKEY); break; case RKEY: - if(okee("Read saved Render Layers")) - node_read_renderlayers(snode); + if(G.qual==LR_CTRLKEY) { + node_rename(snode); + } else{ + if(okee("Read saved Render Layers")) + node_read_renderlayers(snode); + } break; case DELKEY: case XKEY: |