rename pose_channels to bones
[blender.git] / source / blender / editors / space_node / node_ops.c
1 /**
2  * $Id:
3  *
4  * ***** BEGIN GPL LICENSE BLOCK *****
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version. 
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software Foundation,
18  * Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19  *
20  * The Original Code is Copyright (C) 2008 Blender Foundation.
21  * All rights reserved.
22  *
23  * 
24  * Contributor(s): Blender Foundation, Nathan Letwory
25  *
26  * ***** END GPL LICENSE BLOCK *****
27  */
28
29 #include "DNA_node_types.h"
30 #include "DNA_material_types.h"
31 #include "DNA_texture_types.h"
32 #include "DNA_scene_types.h"
33 #include "DNA_space_types.h"
34
35 #include "BKE_context.h"
36 #include "BKE_node.h"
37
38 #include "ED_space_api.h"
39 #include "ED_screen.h"
40 #include "ED_transform.h"
41
42 #include "RNA_access.h"
43 #include "RNA_define.h"
44
45 #include "WM_api.h"
46 #include "WM_types.h"
47
48 #include "node_intern.h"
49
50 void node_operatortypes(void)
51 {
52         WM_operatortype_append(NODE_OT_properties);
53         
54         WM_operatortype_append(NODE_OT_select);
55         WM_operatortype_append(NODE_OT_select_extend);
56         WM_operatortype_append(NODE_OT_select_all);
57         WM_operatortype_append(NODE_OT_select_linked_to);
58         WM_operatortype_append(NODE_OT_select_linked_from);
59         WM_operatortype_append(NODE_OT_visibility_toggle);
60         WM_operatortype_append(NODE_OT_view_all);
61         WM_operatortype_append(NODE_OT_select_border);
62         WM_operatortype_append(NODE_OT_delete);
63         WM_operatortype_append(NODE_OT_link);
64         WM_operatortype_append(NODE_OT_resize);
65         WM_operatortype_append(NODE_OT_links_cut);
66         WM_operatortype_append(NODE_OT_duplicate);
67         WM_operatortype_append(NODE_OT_group_make);
68         WM_operatortype_append(NODE_OT_group_ungroup);
69         WM_operatortype_append(NODE_OT_group_edit);
70 }
71
72 void node_keymap(struct wmKeyConfig *keyconf)
73 {
74         wmKeyMap *keymap;
75 //      wmKeyMapItem *kmi;
76         
77         /* Entire Editor only ----------------- */
78         keymap= WM_keymap_find(keyconf, "Node Generic", SPACE_NODE, 0);
79         
80         WM_keymap_add_item(keymap, "NODE_OT_properties", NKEY, KM_PRESS, 0, 0);
81         
82         /* Main Area only ----------------- */
83         keymap= WM_keymap_find(keyconf, "Node", SPACE_NODE, 0);
84         
85         /* mouse select in nodes used to be both keys, it's UI elements... */
86         RNA_enum_set(WM_keymap_add_item(keymap, "NODE_OT_select", ACTIONMOUSE, KM_PRESS, 0, 0)->ptr, "select_type", NODE_SELECT_MOUSE);
87         RNA_enum_set(WM_keymap_add_item(keymap, "NODE_OT_select", SELECTMOUSE, KM_PRESS, 0, 0)->ptr, "select_type", NODE_SELECT_MOUSE);
88         RNA_enum_set(WM_keymap_add_item(keymap, "NODE_OT_select_extend", ACTIONMOUSE, KM_PRESS, KM_SHIFT, 0)->ptr, "select_type", NODE_SELECT_MOUSE);
89         RNA_enum_set(WM_keymap_add_item(keymap, "NODE_OT_select_extend", SELECTMOUSE, KM_PRESS, KM_SHIFT, 0)->ptr, "select_type", NODE_SELECT_MOUSE);
90         
91         WM_keymap_add_item(keymap, "NODE_OT_duplicate", DKEY, KM_PRESS, KM_SHIFT, 0);
92         
93         WM_keymap_add_item(keymap, "NODE_OT_link", LEFTMOUSE, KM_PRESS, 0, 0);
94         WM_keymap_add_item(keymap, "NODE_OT_resize", LEFTMOUSE, KM_PRESS, 0, 0);
95         WM_keymap_add_item(keymap, "NODE_OT_visibility_toggle", LEFTMOUSE, KM_PRESS, 0, 0);
96         WM_keymap_add_item(keymap, "NODE_OT_links_cut", LEFTMOUSE, KM_PRESS, KM_ALT, 0);
97         
98         WM_keymap_add_item(keymap, "NODE_OT_view_all", HOMEKEY, KM_PRESS, 0, 0);
99         WM_keymap_add_item(keymap, "NODE_OT_select_border", BKEY, KM_PRESS, 0, 0);
100         WM_keymap_add_item(keymap, "NODE_OT_delete", XKEY, KM_PRESS, 0, 0);
101         WM_keymap_add_item(keymap, "NODE_OT_delete", DELKEY, KM_PRESS, 0, 0);
102
103         WM_keymap_add_item(keymap, "NODE_OT_select_all", AKEY, KM_PRESS, 0, 0);
104         WM_keymap_add_item(keymap, "NODE_OT_select_linked_to", LKEY, KM_PRESS, KM_SHIFT, 0);
105         WM_keymap_add_item(keymap, "NODE_OT_select_linked_from", LKEY, KM_PRESS, 0, 0);
106
107         WM_keymap_add_item(keymap, "NODE_OT_group_make", GKEY, KM_PRESS, KM_CTRL, 0);
108         WM_keymap_add_item(keymap, "NODE_OT_group_ungroup", GKEY, KM_PRESS, KM_ALT, 0);
109         WM_keymap_add_item(keymap, "NODE_OT_group_edit", TABKEY, KM_PRESS, 0, 0);
110         
111         WM_keymap_add_menu(keymap, "NODE_MT_add", AKEY, KM_PRESS, KM_SHIFT, 0);
112
113         transform_keymap_for_space(keyconf, keymap, SPACE_NODE);
114 }